1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-21 04:10:37 +02:00

feat(deploy): support the index-only option when syncing from/to local copies

This commit is contained in:
proletarius101 2023-12-14 15:50:54 +00:00 committed by Hans-Christoph Steiner
parent 86524ea56d
commit 8e6996b25d
2 changed files with 27 additions and 29 deletions

18
.vscode/settings.json vendored
View File

@ -2,20 +2,8 @@
"python.formatting.blackArgs": [
"--config=pyproject.toml"
],
"python.formatting.provider": "black",
"python.linting.banditEnabled": true,
"python.linting.banditArgs": [
"-ii",
"--ini=.bandit",
"python.analysis.typeCheckingMode": "basic",
"conventionalCommits.scopes": [
"deploy"
],
"python.linting.enabled": true,
"python.linting.mypyArgs": [
"--config-file=mypy.ini"
],
"python.linting.mypyEnabled": true,
"python.linting.flake8Enabled": true,
"python.linting.pylintArgs": [
"--rcfile=.pylint-rcfile"
],
"python.linting.pylintEnabled": true,
}

View File

@ -61,7 +61,7 @@ INDEX_FILES = [
]
def _get_index_file_paths(repo_section):
def _get_index_file_paths(base_dir):
"""Return the list of files to be synced last, since they finalize the deploy.
The process of pushing all the new packages to the various
@ -70,11 +70,11 @@ def _get_index_file_paths(repo_section):
client learns about them from the new index files.
"""
return [os.path.join(repo_section, filename) for filename in INDEX_FILES]
return [os.path.join(base_dir, filename) for filename in INDEX_FILES]
def _get_index_excludes(repo_section):
indexes = _get_index_file_paths(repo_section)
def _get_index_excludes(base_dir):
indexes = _get_index_file_paths(base_dir)
index_excludes = []
for f in indexes:
index_excludes.append('--exclude')
@ -82,8 +82,8 @@ def _get_index_excludes(repo_section):
return index_excludes
def _get_index_includes(repo_section):
indexes = _get_index_file_paths(repo_section)
def _get_index_includes(base_dir):
indexes = _get_index_file_paths(base_dir)
index_includes = []
for f in indexes:
index_includes.append('--include')
@ -387,6 +387,11 @@ def sync_from_localcopy(repo_section, local_copy_dir):
"""
logging.info('Syncing from local_copy_dir to this repo.')
if options.index_only:
common.local_rsync(options,
_get_index_includes(local_copy_dir),
repo_section.rstrip('/') + '/')
else:
# trailing slashes have a meaning in rsync which is not needed here, so
# make sure both paths have exactly one trailing slash
common.local_rsync(options,
@ -407,6 +412,11 @@ def update_localcopy(repo_section, local_copy_dir):
drive.
"""
if options.index_only:
common.local_rsync(options,
_get_index_includes(repo_section),
repo_section.rstrip('/') + '/')
else:
# local_copy_dir is guaranteed to have a trailing slash in main() below
common.local_rsync(options, repo_section, local_copy_dir)