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:
parent
3ec997d58e
commit
7071cc6f6d
20
.vscode/settings.json
vendored
20
.vscode/settings.json
vendored
@ -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,
|
||||
}
|
||||
}
|
@ -63,7 +63,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
|
||||
@ -72,11 +72,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')
|
||||
@ -84,8 +84,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')
|
||||
@ -559,13 +559,18 @@ def sync_from_localcopy(repo_section, local_copy_dir):
|
||||
|
||||
"""
|
||||
logging.info('Syncing from local_copy_dir to this repo.')
|
||||
# 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(
|
||||
common.get_options(),
|
||||
os.path.join(local_copy_dir, repo_section).rstrip('/') + '/',
|
||||
repo_section.rstrip('/') + '/',
|
||||
)
|
||||
if options.index_only:
|
||||
common.local_rsync(common.get_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(
|
||||
common.get_options(),
|
||||
os.path.join(local_copy_dir, repo_section).rstrip('/') + '/',
|
||||
repo_section.rstrip('/') + '/',
|
||||
)
|
||||
|
||||
offline_copy = os.path.join(local_copy_dir, BINARY_TRANSPARENCY_DIR)
|
||||
if os.path.exists(os.path.join(offline_copy, '.git')):
|
||||
@ -581,8 +586,13 @@ def update_localcopy(repo_section, local_copy_dir):
|
||||
drive.
|
||||
|
||||
"""
|
||||
# local_copy_dir is guaranteed to have a trailing slash in main() below
|
||||
common.local_rsync(common.get_options(), repo_section, local_copy_dir)
|
||||
if options.index_only:
|
||||
common.local_rsync(common.get_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(common.get_options(), repo_section, local_copy_dir)
|
||||
|
||||
offline_copy = os.path.join(os.getcwd(), BINARY_TRANSPARENCY_DIR)
|
||||
if os.path.isdir(os.path.join(offline_copy, '.git')):
|
||||
|
Loading…
Reference in New Issue
Block a user