1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-04 22:40:12 +01:00

[checkupdates] move gradle var check to parser

3638acddc added a check if the version name string is actually a
unresolved gradle variable. This moves the check into the
common.parse_androidmanifests() as it is the only where the it could
happen. This also resolves the case where checkupdates returns
"Unknown".

Closes: #751
This commit is contained in:
Jochen Sprickerhof 2022-04-14 12:47:27 +02:00
parent ea567b0b5a
commit c19f46b706
2 changed files with 19 additions and 12 deletions

View File

@ -455,12 +455,6 @@ def checkupdates_app(app):
vercode = str(common.calculate_math_string(op))
logging.debug("Applied vercode operation: %s -> %s" % (oldvercode, vercode))
if version and any(version.startswith(s) for s in [
'${', # Gradle variable names
'@string/', # Strings we could not resolve
]):
version = "Unknown"
updating = False
if version is None:
raise FDroidException(_('no version information found'))

View File

@ -1703,6 +1703,18 @@ def parse_androidmanifests(paths, app):
max_vercode = None
max_package = None
def vnsearch(line):
matches = vnsearch_g(line)
if matches and not any(
matches.group(2).startswith(s)
for s in [
'${', # Gradle variable names
'@string/', # Strings we could not resolve
]
):
return matches.group(2)
return None
for path in paths:
# TODO: Remove this in Python3.6
path = str(path)
@ -1735,9 +1747,9 @@ def parse_androidmanifests(paths, app):
temp_app_id = matches.group(2)
if "versionName" in line and not temp_version_name:
matches = vnsearch_g(line)
matches = vnsearch(line)
if matches:
temp_version_name = matches.group(2)
temp_version_name = matches
if inside_flavour_group > 0:
if inside_required_flavour > 1:
@ -1755,9 +1767,10 @@ def parse_androidmanifests(paths, app):
if app_matches_packagename(app, temp_app_id):
package = temp_app_id
matches = vnsearch_g(line)
matches = vnsearch(line)
if matches:
version = matches.group(2)
version = matches
else:
# If build.gradle contains applicationNameSuffix add it to the end of version name
matches = vnssearch_g(line)
@ -1799,9 +1812,9 @@ def parse_androidmanifests(paths, app):
if app_matches_packagename(app, s):
package = s
if not version:
matches = vnsearch_g(line)
matches = vnsearch(line)
if matches:
version = matches.group(2)
version = matches
if not vercode:
matches = vcsearch_g(line)
if matches: