From aa47e93f36208364c25a1a2ed7622d6c20dc773d Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 21 Jan 2019 22:46:34 +0100 Subject: [PATCH] Revert "Revert "lint: check if CurrentVersion is older than oldest build entry"" This reverts commit a5ec1703c9bcf9389513e3b8eee4b2f68bde742d. fdroid/fdroiddata@42bb872b46026d425d1f7bf6c1fba826811f0c45 --- fdroidserver/lint.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/fdroidserver/lint.py b/fdroidserver/lint.py index e2c61b26..465954cc 100644 --- a/fdroidserver/lint.py +++ b/fdroidserver/lint.py @@ -527,6 +527,35 @@ def check_for_unsupported_metadata_files(basedir=""): return return_value +def check_current_version_code(app): + """Check that the CurrentVersionCode is currently available""" + + archive_policy = app.get('ArchivePolicy') + if archive_policy and archive_policy.split()[0] == "0": + return + cv = app.get('CurrentVersionCode') + if cv is not None and int(cv) == 0: + return + + builds = app.get('builds') + active_builds = 0 + min_versionCode = None + if builds: + for build in builds: + vc = int(build['versionCode']) + if min_versionCode is None or min_versionCode > vc: + min_versionCode = vc + if not build.get('disable'): + active_builds += 1 + if cv == build['versionCode']: + break + if active_builds == 0: + return # all builds are disabled + if cv is not None and int(cv) < min_versionCode: + yield(_('CurrentVersionCode {cv} is less than oldest build entry {versionCode}') + .format(cv=cv, versionCode=min_versionCode)) + + def main(): global config, options @@ -581,6 +610,7 @@ def main(): check_files_dir, check_format, check_license_tag, + check_current_version_code, ] for check_func in app_check_funcs: