Robustness improvements

This commit is contained in:
Kovid Goyal 2013-10-12 09:19:30 +05:30
parent 424b9e1884
commit dd7f18eb54
2 changed files with 8 additions and 0 deletions

View File

@ -508,12 +508,14 @@ def upload_to_servers(files, version): # {{{
def upload_to_dbs(files, version): # {{{ def upload_to_dbs(files, version): # {{{
print('Uploading to fosshub.com') print('Uploading to fosshub.com')
sys.stdout.flush()
server = 'mirror1.fosshub.com' server = 'mirror1.fosshub.com'
rdir = 'release/' rdir = 'release/'
check_call(['ssh', 'kovid@%s' % server, 'rm -f release/*']) check_call(['ssh', 'kovid@%s' % server, 'rm -f release/*'])
for x in files: for x in files:
start = time.time() start = time.time()
print ('Uploading', x) print ('Uploading', x)
sys.stdout.flush()
for i in range(5): for i in range(5):
try: try:
check_call(['rsync', '-h', '-z', '--progress', '-e', 'ssh -x', x, check_call(['rsync', '-h', '-z', '--progress', '-e', 'ssh -x', x,
@ -522,10 +524,12 @@ def upload_to_dbs(files, version): # {{{
raise SystemExit(1) raise SystemExit(1)
except: except:
print ('\nUpload failed, trying again in 30 seconds') print ('\nUpload failed, trying again in 30 seconds')
sys.stdout.flush()
time.sleep(30) time.sleep(30)
else: else:
break break
print ('Uploaded in', int(time.time() - start), 'seconds\n\n') print ('Uploaded in', int(time.time() - start), 'seconds\n\n')
sys.stdout.flush()
check_call(['ssh', 'kovid@%s' % server, '/home/kovid/uploadFiles']) check_call(['ssh', 'kovid@%s' % server, '/home/kovid/uploadFiles'])
# }}} # }}}

View File

@ -70,6 +70,10 @@ class ReUpload(Command): # {{{
def pre_sub_commands(self, opts): def pre_sub_commands(self, opts):
opts.replace = True opts.replace = True
exists = {x for x in installers() if os.path.exists(x)}
if not exists:
print ('There appear to be no installers!')
raise SystemExit(1)
def run(self, opts): def run(self, opts):
upload_signatures() upload_signatures()