Upload installers to downloadbestsoftware.com as well

This commit is contained in:
Kovid Goyal 2013-06-24 18:04:07 +05:30
parent f58b8aee4f
commit d2292a759d
2 changed files with 32 additions and 0 deletions

View File

@ -402,6 +402,29 @@ def upload_to_servers(files, version): # {{{
print ('Uploaded in', int(time.time() - start), 'seconds\n\n') print ('Uploaded in', int(time.time() - start), 'seconds\n\n')
# }}} # }}}
def upload_to_dbs(files, version): # {{{
print('Uploading to downloadbestsoftware.com')
server = 'www.downloadbestsoft-mirror1.com'
rdir = 'release/'
check_call(['ssh', 'kovid@%s' % server, 'rm -f release/*'])
for x in files:
start = time.time()
print ('Uploading', x)
for i in range(5):
try:
check_call(['rsync', '-h', '-z', '--progress', '-e', 'ssh -x', x,
'kovid@%s:%s'%(server, rdir)])
except KeyboardInterrupt:
raise SystemExit(1)
except:
print ('\nUpload failed, trying again in 30 seconds')
time.sleep(30)
else:
break
print ('Uploaded in', int(time.time() - start), 'seconds\n\n')
check_call(['ssh', 'kovid@%s' % server, '/home/kovid/uploadFiles'])
# }}}
# CLI {{{ # CLI {{{
def cli_parser(): def cli_parser():
epilog='Copyright Kovid Goyal 2012' epilog='Copyright Kovid Goyal 2012'
@ -434,6 +457,7 @@ def cli_parser():
epilog=epilog) epilog=epilog)
cron = subparsers.add_parser('cron', help='Call script from cron') cron = subparsers.add_parser('cron', help='Call script from cron')
subparsers.add_parser('calibre', help='Upload to calibre file servers') subparsers.add_parser('calibre', help='Upload to calibre file servers')
subparsers.add_parser('dbs', help='Upload to downloadbestsoftware.com')
a = gc.add_argument a = gc.add_argument
@ -498,6 +522,8 @@ def main(args=None):
login_to_google(args.username, args.password) login_to_google(args.username, args.password)
elif args.service == 'calibre': elif args.service == 'calibre':
upload_to_servers(ofiles, args.version) upload_to_servers(ofiles, args.version)
elif args.service == 'dbs':
upload_to_dbs(ofiles, args.version)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -114,6 +114,9 @@ def sf_cmdline(ver, sdata):
def calibre_cmdline(ver): def calibre_cmdline(ver):
return [__appname__, ver, 'fmap', 'calibre'] return [__appname__, ver, 'fmap', 'calibre']
def dbs_cmdline(ver):
return [__appname__, ver, 'fmap', 'dbs']
def run_remote_upload(args): def run_remote_upload(args):
print 'Running remotely:', ' '.join(args) print 'Running remotely:', ' '.join(args)
subprocess.check_call(['ssh', '-x', '%s@%s'%(STAGING_USER, STAGING_HOST), subprocess.check_call(['ssh', '-x', '%s@%s'%(STAGING_USER, STAGING_HOST),
@ -140,6 +143,7 @@ class UploadInstallers(Command): # {{{
self.upload_to_staging(tdir, backup, files) self.upload_to_staging(tdir, backup, files)
self.upload_to_sourceforge() self.upload_to_sourceforge()
self.upload_to_calibre() self.upload_to_calibre()
self.upload_to_dbs()
# self.upload_to_google(opts.replace) # self.upload_to_google(opts.replace)
finally: finally:
shutil.rmtree(tdir, ignore_errors=True) shutil.rmtree(tdir, ignore_errors=True)
@ -184,6 +188,8 @@ class UploadInstallers(Command): # {{{
def upload_to_calibre(self): def upload_to_calibre(self):
run_remote_upload(calibre_cmdline(__version__)) run_remote_upload(calibre_cmdline(__version__))
def upload_to_dbs(self):
run_remote_upload(dbs_cmdline(__version__))
# }}} # }}}
class UploadUserManual(Command): # {{{ class UploadUserManual(Command): # {{{