From 7a5ecd0c6d59b5bd3f4c7ad1bc984ff0c0fd5e92 Mon Sep 17 00:00:00 2001 From: proletarius101 Date: Sun, 10 Dec 2023 22:17:28 +0000 Subject: [PATCH] feat: add `--index-only` flag --- completion/bash-completion | 2 +- fdroidserver/deploy.py | 29 ++++++++++++++--------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/completion/bash-completion b/completion/bash-completion index 940b188b..aa68a220 100644 --- a/completion/bash-completion +++ b/completion/bash-completion @@ -264,7 +264,7 @@ __complete_nightly() { __complete_deploy() { opts="-i -v -q" lopts="--identity-file --local-copy-dir --sync-from-local-copy-dir - --verbose --quiet --no-checksum --no-keep-git-mirror-archive" + --verbose --quiet --no-checksum --no-keep-git-mirror-archive --index-only" __complete_options } diff --git a/fdroidserver/deploy.py b/fdroidserver/deploy.py index b120999f..b1db356e 100644 --- a/fdroidserver/deploy.py +++ b/fdroidserver/deploy.py @@ -49,6 +49,7 @@ USER_RCLONE_CONF = None REMOTE_HOSTNAME_REGEX = re.compile(r'\W*\w+\W+(\w+).*') INDEX_FILES = [ + "altstore-index.json", "entry.jar", "entry.json", "entry.json.asc", @@ -62,6 +63,10 @@ INDEX_FILES = [ ] +def _get_index_file_paths(repo_section): + return [os.path.join(repo_section, filename) for filename in INDEX_FILES] + + def _get_index_excludes(repo_section): """Return the list of files to be synced last, since they finalize the deploy. @@ -71,19 +76,7 @@ def _get_index_excludes(repo_section): client learns about them from the new index files. """ - indexes = [ - os.path.join(repo_section, 'altstore-index.json'), - os.path.join(repo_section, 'entry.jar'), - os.path.join(repo_section, 'entry.json'), - os.path.join(repo_section, 'entry.json.asc'), - os.path.join(repo_section, 'index-v1.jar'), - os.path.join(repo_section, 'index-v1.json'), - os.path.join(repo_section, 'index-v1.json.asc'), - os.path.join(repo_section, 'index-v2.json'), - os.path.join(repo_section, 'index-v2.json.asc'), - os.path.join(repo_section, 'index.jar'), - os.path.join(repo_section, 'index.xml'), - ] + indexes = _get_index_file_paths(repo_section) index_excludes = [] for f in indexes: index_excludes.append('--exclude') @@ -1025,8 +1018,14 @@ def main(): default=False, help=_("If a git mirror gets to big, allow the archive to be deleted"), ) - options = common.parse_args(parser) - config = common.read_config() + parser.add_argument( + "--index-only", + action="store_true", + default=False, + help="Only deploy the index files entry.* and index-v*.json", + ) + options = parser.parse_args() + config = common.read_config(options) if config.get('nonstandardwebroot') is True: standardwebroot = False