Revert "Revert "Merge branch 'random-fixes' into 'master'""

This reverts commit f6f2fb0b89.

Only one of the included commit should have been reverted.
This commit is contained in:
Marcus Hoffmann 2019-01-10 14:48:29 +01:00
parent f6f2fb0b89
commit e1c547cfdf
6 changed files with 51 additions and 8 deletions

View file

@ -165,6 +165,8 @@ regex_checks = {
'Description': https_enforcings + http_url_shorteners + [
(re.compile(r'\s*[*#][^ .]'),
_("Invalid bulleted list")),
(re.compile(r'https://f-droid.org/[a-z][a-z](_[A-Za-z]{2,4})?/'),
_("Locale included in f-droid.org URL")),
(re.compile(r'^\s'),
_("Unnecessary leading space")),
(re.compile(r'.*\s$'),
@ -525,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
@ -579,6 +610,7 @@ def main():
check_files_dir,
check_format,
check_license_tag,
check_current_version_code,
]
for check_func in app_check_funcs: