1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-04 14:30:11 +01:00

server: delay deleting on the server for as long as possible

In order to keep things working as much as possible during the update, the
rsync should only delete the obsolete APKs after it has finished uploading
the new APKs.
This commit is contained in:
Hans-Christoph Steiner 2015-04-30 23:36:10 -04:00
parent f63ea5cb86
commit 463bfc5639

View File

@ -123,7 +123,7 @@ def update_awsbucket(repo_section):
def update_serverwebroot(serverwebroot, repo_section): def update_serverwebroot(serverwebroot, repo_section):
# use a checksum comparison for accurate comparisons on different # use a checksum comparison for accurate comparisons on different
# filesystems, for example, FAT has a low resolution timestamp # filesystems, for example, FAT has a low resolution timestamp
rsyncargs = ['rsync', '--archive', '--delete', '--safe-links'] rsyncargs = ['rsync', '--archive', '--delete-after', '--safe-links']
if not options.no_checksum: if not options.no_checksum:
rsyncargs.append('--checksum') rsyncargs.append('--checksum')
if options.verbose: if options.verbose:
@ -136,13 +136,14 @@ def update_serverwebroot(serverwebroot, repo_section):
rsyncargs += ['-e', 'ssh -i ' + config['identity_file']] rsyncargs += ['-e', 'ssh -i ' + config['identity_file']]
indexxml = os.path.join(repo_section, 'index.xml') indexxml = os.path.join(repo_section, 'index.xml')
indexjar = os.path.join(repo_section, 'index.jar') indexjar = os.path.join(repo_section, 'index.jar')
# upload the first time without the index so that the repo stays working # Upload the first time without the index files and delay the deletion as
# while this update is running. Then once it is complete, rerun the # much as possible, that keeps the repo functional while this update is
# command again to upload the index. Always using the same target with # running. Then once it is complete, rerun the command again to upload
# rsync allows for very strict settings on the receiving server, you can # the index files. Always using the same target with rsync allows for
# literally specify the one rsync command that is allowed to run in # very strict settings on the receiving server, you can literally specify
# ~/.ssh/authorized_keys. (serverwebroot is guaranteed to have a trailing # the one rsync command that is allowed to run in ~/.ssh/authorized_keys.
# slash in common.py) # (serverwebroot is guaranteed to have a trailing slash in common.py)
logging.info('rsyncing ' + repo_section + ' to ' + serverwebroot)
if subprocess.call(rsyncargs + if subprocess.call(rsyncargs +
['--exclude', indexxml, '--exclude', indexjar, ['--exclude', indexxml, '--exclude', indexjar,
repo_section, serverwebroot]) != 0: repo_section, serverwebroot]) != 0: