Compare commits

...

4 Commits

Author SHA1 Message Date
Michael Pöhn 24f4d99068 Merge branch 'ios-metadata' into 'master'
draft: support iOS fastlane metadata

See merge request fdroid/fdroidserver!1426
2024-02-02 17:27:17 +00:00
Hans-Christoph Steiner ee764ff92e Merge branch 'scanner' into 'master'
scanner: refresh data without scanning

See merge request fdroid/fdroidserver!1437
2024-01-29 15:26:28 +00:00
linsui 2f313a0bd6 scanner: refresh data without scaning 2024-01-29 23:13:13 +08:00
Michael Pöhn e21e7425c5
🗨 iOS text metadata support
This change adds basic i18n support for parsing iOS fastlane metadata.
Currently supported:
 * name
 * subtitle (summary)
 * description
2024-01-23 06:09:45 +01:00
2 changed files with 34 additions and 0 deletions

View File

@ -825,6 +825,8 @@ def main():
if not appids: if not appids:
if options.exit_code and probcount > 0: if options.exit_code and probcount > 0:
sys.exit(ExitCode.NONFREE_CODE) sys.exit(ExitCode.NONFREE_CODE)
if options.refresh_scanner:
_get_tool()
return return
# Read all app and srclib metadata # Read all app and srclib metadata

View File

@ -34,6 +34,7 @@ import json
import time import time
import yaml import yaml
import copy import copy
import pathlib
import defusedxml.ElementTree as ElementTree import defusedxml.ElementTree as ElementTree
from datetime import datetime, timezone from datetime import datetime, timezone
from argparse import ArgumentParser from argparse import ArgumentParser
@ -1208,6 +1209,36 @@ def insert_localized_app_metadata(apps):
logging.warning(_('Unsupported graphics file found: {path}').format(path=f)) logging.warning(_('Unsupported graphics file found: {path}').format(path=f))
LANG_CODE = re.compile(r'^[a-z]{2}([-_][A-Z][a-zA-Z]{1,3})?$')
FASTLANE_IOS_MAP = {
"name.txt": 'name',
"subtitle.txt": 'summary',
"description.txt": 'description',
}
def insert_localized_ios_app_metadata(apps_with_packages):
for package_name, app in apps_with_packages.items():
if not any(pathlib.Path('repo').glob(f'{package_name}*.ipa')):
# couldn't find any IPA files for this package_name
# so we don't have to look for fastlane data
continue
fastlane_dir = pathlib.Path('build', package_name, 'fastlane')
for lang_dir in (fastlane_dir / 'metadata').iterdir():
lang_code = lang_dir.name
m = LANG_CODE.match(lang_code)
if m:
for metadata_file in (lang_dir).iterdir():
key = FASTLANE_IOS_MAP.get(metadata_file.name)
if key:
_set_localized_text_entry(app, lang_code, key, metadata_file)
def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False): def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False):
"""Scan a repo for all files with an extension except APK/OBB/IPA. """Scan a repo for all files with an extension except APK/OBB/IPA.
@ -2238,6 +2269,7 @@ def prepare_apps(apps, apks, repodir):
translate_per_build_anti_features(apps_with_packages, apks) translate_per_build_anti_features(apps_with_packages, apks)
if repodir == 'repo': if repodir == 'repo':
insert_localized_app_metadata(apps_with_packages) insert_localized_app_metadata(apps_with_packages)
insert_localized_ios_app_metadata(apps_with_packages)
insert_missing_app_names_from_apks(apps_with_packages, apks) insert_missing_app_names_from_apks(apps_with_packages, apks)
return apps_with_packages return apps_with_packages