mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-21 04:10:37 +02:00
fix(deploy): missing index files trigger errors
This commit is contained in:
parent
76a31463b3
commit
4341343fa4
@ -96,6 +96,16 @@ def _get_index_includes(base_dir):
|
||||
return index_includes
|
||||
|
||||
|
||||
def _remove_missing_files(files: List[str]) -> List[str]:
|
||||
"""Remove files that are missing from the file system."""
|
||||
|
||||
existing = []
|
||||
for f in files:
|
||||
if os.path.exists(f):
|
||||
existing.append(f)
|
||||
return existing
|
||||
|
||||
|
||||
def update_awsbucket(repo_section, is_index_only=False, verbose=False, quiet=False):
|
||||
"""Upload the contents of the directory `repo_section` (including subdirectories) to the AWS S3 "bucket".
|
||||
|
||||
@ -299,8 +309,9 @@ def update_remote_storage_with_rclone(
|
||||
|
||||
if is_index_only:
|
||||
sources = _get_index_file_paths(repo_section)
|
||||
sources = _remove_missing_files(sources)
|
||||
else:
|
||||
sources = repo_section
|
||||
sources = [repo_section]
|
||||
|
||||
for source in sources:
|
||||
if isinstance(config['rclone_config'], str):
|
||||
@ -429,6 +440,7 @@ def update_awsbucket_libcloud(repo_section, is_index_only=False):
|
||||
for name in files
|
||||
]
|
||||
files_to_upload = list(set(files_to_upload) & set(index_files))
|
||||
files_to_upload = _remove_missing_files(files_to_upload)
|
||||
|
||||
else:
|
||||
files_to_upload = [
|
||||
@ -534,6 +546,9 @@ def update_serverwebroot(serverwebroot, repo_section):
|
||||
is_index_only = serverwebroot.get('index_only', False)
|
||||
logging.info('rsyncing ' + repo_section + ' to ' + url)
|
||||
if is_index_only:
|
||||
files_to_upload = _get_index_file_paths(repo_section)
|
||||
files_to_upload = _remove_missing_files(files_to_upload)
|
||||
|
||||
rsyncargs += _get_index_file_paths(repo_section)
|
||||
rsyncargs += [f'{url}/{repo_section}/']
|
||||
logging.info(rsyncargs)
|
||||
@ -733,6 +748,7 @@ def update_servergitmirrors(servergitmirrors, repo_section):
|
||||
# make sure both paths have exactly one trailing slash
|
||||
if is_index_only:
|
||||
files_to_sync = _get_index_file_paths(str(workspace_dir / repo_section))
|
||||
files_to_sync = _remove_missing_files(files_to_sync)
|
||||
else:
|
||||
files_to_sync = [str(workspace_dir / repo_section).rstrip('/') + '/']
|
||||
common.local_rsync(
|
||||
|
Loading…
Reference in New Issue
Block a user