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

publish index-v1.json and include a gpg signature

This gives a more flexible and direct way for many clients to consume the
index file. #969
This commit is contained in:
Hans-Christoph Steiner 2022-02-21 22:40:22 +01:00
parent 8e02c52a45
commit 707cd7addb
No known key found for this signature in database
GPG Key ID: 3E177817BA1B9BFA
3 changed files with 19 additions and 1 deletions

View File

@ -107,6 +107,8 @@ def update_awsbucket_s3cmd(repo_section):
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')
indexv1jar = os.path.join(repo_section, 'index-v1.jar') indexv1jar = os.path.join(repo_section, 'index-v1.jar')
indexv1json = os.path.join(repo_section, 'index-v1.json')
indexv1jsonasc = os.path.join(repo_section, 'index-v1.json.asc')
s3url = s3bucketurl + '/fdroid/' s3url = s3bucketurl + '/fdroid/'
logging.debug('s3cmd sync new files in ' + repo_section + ' to ' + s3url) logging.debug('s3cmd sync new files in ' + repo_section + ' to ' + s3url)
@ -116,6 +118,8 @@ def update_awsbucket_s3cmd(repo_section):
'--exclude', indexxml, '--exclude', indexxml,
'--exclude', indexjar, '--exclude', indexjar,
'--exclude', indexv1jar, '--exclude', indexv1jar,
'--exclude', indexv1json,
'--exclude', indexv1jsonasc,
repo_section, s3url]) != 0: repo_section, s3url]) != 0:
raise FDroidException() raise FDroidException()
logging.debug('s3cmd sync all files in ' + repo_section + ' to ' + s3url) logging.debug('s3cmd sync all files in ' + repo_section + ' to ' + s3url)
@ -124,6 +128,8 @@ def update_awsbucket_s3cmd(repo_section):
'--exclude', indexxml, '--exclude', indexxml,
'--exclude', indexjar, '--exclude', indexjar,
'--exclude', indexv1jar, '--exclude', indexv1jar,
'--exclude', indexv1json,
'--exclude', indexv1jsonasc,
repo_section, s3url]) != 0: repo_section, s3url]) != 0:
raise FDroidException() raise FDroidException()
@ -251,6 +257,8 @@ def update_serverwebroot(serverwebroot, repo_section):
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')
indexv1jar = os.path.join(repo_section, 'index-v1.jar') indexv1jar = os.path.join(repo_section, 'index-v1.jar')
indexv1json = os.path.join(repo_section, 'index-v1.json')
indexv1jsonasc = os.path.join(repo_section, 'index-v1.json.asc')
# Upload the first time without the index files and delay the deletion as # Upload the first time without the index files and delay the deletion as
# much as possible, that keeps the repo functional while this update is # much as possible, that keeps the repo functional while this update is
# running. Then once it is complete, rerun the command again to upload # running. Then once it is complete, rerun the command again to upload
@ -263,6 +271,8 @@ def update_serverwebroot(serverwebroot, repo_section):
+ ['--exclude', indexxml, + ['--exclude', indexxml,
'--exclude', indexjar, '--exclude', indexjar,
'--exclude', indexv1jar, '--exclude', indexv1jar,
'--exclude', indexv1json,
'--exclude', indexv1jsonasc,
repo_section, serverwebroot]) != 0: repo_section, serverwebroot]) != 0:
raise FDroidException() raise FDroidException()
if subprocess.call(rsyncargs + [repo_section, serverwebroot]) != 0: if subprocess.call(rsyncargs + [repo_section, serverwebroot]) != 0:

View File

@ -67,7 +67,7 @@ def main():
for f in sorted(glob.glob(os.path.join(output_dir, '*.*'))): for f in sorted(glob.glob(os.path.join(output_dir, '*.*'))):
if common.get_file_extension(f) == 'asc': if common.get_file_extension(f) == 'asc':
continue continue
if not common.is_repo_file(f): if not common.is_repo_file(f) and not f.endswith('/index-v1.json'):
continue continue
filename = os.path.basename(f) filename = os.path.basename(f)
sigfilename = filename + ".asc" sigfilename = filename + ".asc"

View File

@ -62,6 +62,10 @@ class DeployTest(unittest.TestCase):
'repo/index.jar', 'repo/index.jar',
'--exclude', '--exclude',
'repo/index-v1.jar', 'repo/index-v1.jar',
'--exclude',
'repo/index-v1.json',
'--exclude',
'repo/index-v1.json.asc',
'repo', 'repo',
'example.com:/var/www/fdroid', 'example.com:/var/www/fdroid',
], ],
@ -143,6 +147,10 @@ class DeployTest(unittest.TestCase):
'archive/index.jar', 'archive/index.jar',
'--exclude', '--exclude',
'archive/index-v1.jar', 'archive/index-v1.jar',
'--exclude',
'archive/index-v1.json',
'--exclude',
'archive/index-v1.json.asc',
'archive', 'archive',
serverwebroot, serverwebroot,
], ],