1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-10 17:30:11 +01:00

unify lists of index files

This commit is contained in:
Hans-Christoph Steiner 2024-06-07 12:35:40 +02:00
parent 518c381a09
commit ad250309ab
2 changed files with 29 additions and 35 deletions

View File

@ -4414,27 +4414,39 @@ def get_per_app_repos():
return repos
# list of index files that are never gpg-signed
NO_GPG_INDEX_FILES = [
"entry.jar",
"index-v1.jar",
"index.css",
"index.html",
"index.jar",
"index.png",
"index.xml",
]
# list of index files that are signed by gpgsign.py to make a .asc file
GPG_INDEX_FILES = [
"altstore-index.json",
"entry.json",
"index-v1.json",
"index-v2.json",
]
INDEX_FILES = sorted(
NO_GPG_INDEX_FILES + GPG_INDEX_FILES + [i + '.asc' for i in GPG_INDEX_FILES]
)
def is_repo_file(filename, for_gpg_signing=False):
"""Whether the file in a repo is a build product to be delivered to users."""
if isinstance(filename, str):
filename = filename.encode('utf-8', errors="surrogateescape")
ignore_files = [
b'entry.jar',
b'index-v1.jar',
b'index.css',
b'index.html',
b'index.jar',
b'index.png',
b'index.xml',
b'index_unsigned.jar',
]
ignore_files = [i.encode() for i in NO_GPG_INDEX_FILES]
ignore_files.append(b'index_unsigned.jar')
if not for_gpg_signing:
ignore_files += [
b'altstore-index.json',
b'entry.json',
b'index-v1.json',
b'index-v2.json',
]
ignore_files += [i.encode() for i in GPG_INDEX_FILES]
return (
os.path.isfile(filename)

View File

@ -52,24 +52,6 @@ USER_S3CFG = 's3cfg'
USER_RCLONE_CONF = None
REMOTE_HOSTNAME_REGEX = re.compile(r'\W*\w+\W+(\w+).*')
INDEX_FILES = [
"altstore-index.json",
"altstore-index.json.asc",
"entry.jar",
"entry.json",
"entry.json.asc",
"index-v1.jar",
"index-v1.json",
"index-v1.json.asc",
"index-v2.json",
"index-v2.json.asc",
"index.css",
"index.html",
"index.jar",
"index.png",
"index.xml",
]
def _get_index_file_paths(base_dir):
"""Return the list of files to be synced last, since they finalize the deploy.
@ -79,7 +61,7 @@ def _get_index_file_paths(base_dir):
last. That ensures that the package files are available when the
client learns about them from the new index files.
"""
return [os.path.join(base_dir, filename) for filename in INDEX_FILES]
return [os.path.join(base_dir, filename) for filename in common.INDEX_FILES]
def _get_index_excludes(base_dir):