diff --git a/examples/fdroid_clean_repos.py b/examples/fdroid_clean_repos.py index aaedf98a..cf6259a7 100644 --- a/examples/fdroid_clean_repos.py +++ b/examples/fdroid_clean_repos.py @@ -24,9 +24,9 @@ def main(): ) metadata.add_metadata_arguments(parser) options = common.parse_args(parser) - pkgs = common.read_pkg_args(options.appid, True) - allapps = metadata.read_metadata(pkgs) - apps = common.read_app_args(options.appid, allapps, True) + apps = common.read_app_args( + options.appid, allow_version_codes=True, sort_by_time=True + ) common.read_config() for appid, app in apps.items(): diff --git a/examples/fdroid_fetchsrclibs.py b/examples/fdroid_fetchsrclibs.py index 299e802b..e4a105e2 100644 --- a/examples/fdroid_fetchsrclibs.py +++ b/examples/fdroid_fetchsrclibs.py @@ -19,9 +19,7 @@ def main(): parser.add_argument("appid", nargs='*', help=_("applicationId with optional versionCode in the form APPID[:VERCODE]")) metadata.add_metadata_arguments(parser) options = common.parse_args(parser) - pkgs = common.read_pkg_args(options.appid, True) - allapps = metadata.read_metadata(pkgs) - apps = common.read_app_args(options.appid, allapps, True) + apps = common.read_app_args(options.appid, allow_version_codes=True, sort_by_time=True) common.read_config() srclib_dir = os.path.join('build', 'srclib') os.makedirs(srclib_dir, exist_ok=True) diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 42a58282..4cae5d26 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -1117,10 +1117,7 @@ def main(): srclib_dir = os.path.join(build_dir, 'srclib') extlib_dir = os.path.join(build_dir, 'extlib') - # Read all app and srclib metadata - pkgs = common.read_pkg_args(options.appid, True) - allapps = metadata.read_metadata(pkgs, sort_by_time=True) - apps = common.read_app_args(options.appid, allapps, True) + apps = common.read_app_args(options.appid, allow_version_codes=True, sort_by_time=True) for appid, app in list(apps.items()): if (app.get('Disabled') and not options.force) or not app.get('RepoType') or not app.get('Builds', []): diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 7f2293f3..0aa95d68 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -730,10 +730,7 @@ def main(): logging.error(_('Build metadata git repo has uncommited changes!')) sys.exit(1) - # Get all apps... - allapps = metadata.read_metadata() - - apps = common.read_app_args(options.appid, allapps, False) + apps = common.read_app_args(options.appid) processed = [] failed = dict() diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 2c671cbc..fe00e7a9 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -939,7 +939,7 @@ def get_metadata_files(vercodes): return metadatafiles -def read_app_args(appid_versionCode_pairs, allapps, allow_version_codes=False): +def read_app_args(appid_versionCode_pairs, allow_version_codes=False, sort_by_time=False): """Build a list of App instances for processing. On top of what read_pkg_args does, this returns the whole app @@ -950,6 +950,7 @@ def read_app_args(appid_versionCode_pairs, allapps, allow_version_codes=False): """ vercodes = read_pkg_args(appid_versionCode_pairs, allow_version_codes) + allapps = fdroidserver.metadata.read_metadata(appid_versionCode_pairs, sort_by_time) if not vercodes: return allapps diff --git a/fdroidserver/lint.py b/fdroidserver/lint.py index 11697371..8f1f8d71 100644 --- a/fdroidserver/lint.py +++ b/fdroidserver/lint.py @@ -878,9 +878,7 @@ def main(): def lint_metadata(options): - # Get all apps... - allapps = metadata.read_metadata(options.appid) - apps = common.read_app_args(options.appid, allapps, False) + apps = common.read_app_args(options.appid) anywarns = check_for_unsupported_metadata_files() diff --git a/fdroidserver/rewritemeta.py b/fdroidserver/rewritemeta.py index 7f003ac3..9f3316b4 100644 --- a/fdroidserver/rewritemeta.py +++ b/fdroidserver/rewritemeta.py @@ -81,9 +81,7 @@ def main(): config = common.read_config() - # Get all apps... - allapps = metadata.read_metadata(options.appid) - apps = common.read_app_args(options.appid, allapps, False) + apps = common.read_app_args(options.appid) for appid, app in apps.items(): path = Path(app.metadatapath) diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index 88ce3236..fc6c823c 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -1144,10 +1144,7 @@ def main(): _get_tool() return - # Read all app and srclib metadata - - allapps = metadata.read_metadata() - apps = common.read_app_args(appids, allapps, True) + apps = common.read_app_args(appids, allow_version_codes=True) build_dir = 'build' if not os.path.isdir(build_dir): diff --git a/tests/scanner.TestCase b/tests/scanner.TestCase index dbb27fd7..ce606d35 100755 --- a/tests/scanner.TestCase +++ b/tests/scanner.TestCase @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -import collections import glob import inspect import logging @@ -855,7 +854,7 @@ class Test_main(unittest.TestCase): self.exit_func.assert_not_called() self.read_app_args_func.assert_called_once_with( - ['com.example.app'], collections.OrderedDict(), True + ['com.example.app'], allow_version_codes=True ) self.scan_binary_func.assert_not_called()