From 707cd7addbf4ea7d1f00da5718b374d3789765a8 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 21 Feb 2022 22:40:22 +0100 Subject: [PATCH] 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 --- fdroidserver/deploy.py | 10 ++++++++++ fdroidserver/gpgsign.py | 2 +- tests/deploy.TestCase | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/fdroidserver/deploy.py b/fdroidserver/deploy.py index 1ce9e141..a19bdeda 100644 --- a/fdroidserver/deploy.py +++ b/fdroidserver/deploy.py @@ -107,6 +107,8 @@ def update_awsbucket_s3cmd(repo_section): indexxml = os.path.join(repo_section, 'index.xml') indexjar = os.path.join(repo_section, 'index.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/' logging.debug('s3cmd sync new files in ' + repo_section + ' to ' + s3url) @@ -116,6 +118,8 @@ def update_awsbucket_s3cmd(repo_section): '--exclude', indexxml, '--exclude', indexjar, '--exclude', indexv1jar, + '--exclude', indexv1json, + '--exclude', indexv1jsonasc, repo_section, s3url]) != 0: raise FDroidException() logging.debug('s3cmd sync all files in ' + repo_section + ' to ' + s3url) @@ -124,6 +128,8 @@ def update_awsbucket_s3cmd(repo_section): '--exclude', indexxml, '--exclude', indexjar, '--exclude', indexv1jar, + '--exclude', indexv1json, + '--exclude', indexv1jsonasc, repo_section, s3url]) != 0: raise FDroidException() @@ -251,6 +257,8 @@ def update_serverwebroot(serverwebroot, repo_section): indexxml = os.path.join(repo_section, 'index.xml') indexjar = os.path.join(repo_section, 'index.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 # much as possible, that keeps the repo functional while this update is # 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', indexjar, '--exclude', indexv1jar, + '--exclude', indexv1json, + '--exclude', indexv1jsonasc, repo_section, serverwebroot]) != 0: raise FDroidException() if subprocess.call(rsyncargs + [repo_section, serverwebroot]) != 0: diff --git a/fdroidserver/gpgsign.py b/fdroidserver/gpgsign.py index 447c3906..726805b6 100644 --- a/fdroidserver/gpgsign.py +++ b/fdroidserver/gpgsign.py @@ -67,7 +67,7 @@ def main(): for f in sorted(glob.glob(os.path.join(output_dir, '*.*'))): if common.get_file_extension(f) == 'asc': continue - if not common.is_repo_file(f): + if not common.is_repo_file(f) and not f.endswith('/index-v1.json'): continue filename = os.path.basename(f) sigfilename = filename + ".asc" diff --git a/tests/deploy.TestCase b/tests/deploy.TestCase index 54137949..f493d7ea 100755 --- a/tests/deploy.TestCase +++ b/tests/deploy.TestCase @@ -62,6 +62,10 @@ class DeployTest(unittest.TestCase): 'repo/index.jar', '--exclude', 'repo/index-v1.jar', + '--exclude', + 'repo/index-v1.json', + '--exclude', + 'repo/index-v1.json.asc', 'repo', 'example.com:/var/www/fdroid', ], @@ -143,6 +147,10 @@ class DeployTest(unittest.TestCase): 'archive/index.jar', '--exclude', 'archive/index-v1.jar', + '--exclude', + 'archive/index-v1.json', + '--exclude', + 'archive/index-v1.json.asc', 'archive', serverwebroot, ],