1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-07-07 09:50:07 +02:00

APK_ID_TRIPLET_REGEX only matches first line of aapt output

Stop expensive aapt parsing after the first line when looking with
APK_ID_TRIPLET_REGEX.  As is seen with the `aapt dump badging` output files
in tests/build-tools/, the first line is the only line that will ever match.

#557
This commit is contained in:
Hans-Christoph Steiner 2018-09-18 15:20:37 +02:00
parent f11b2e8d45
commit fa09337b4b

View File

@ -2120,10 +2120,9 @@ def get_apk_id_androguard(apkfile):
def get_apk_id_aapt(apkfile):
p = SdkToolsPopen(['aapt', 'dump', 'badging', apkfile], output=False)
for line in p.output.splitlines():
m = APK_ID_TRIPLET_REGEX.match(line)
if m:
return m.group(1), m.group(2), m.group(3)
m = APK_ID_TRIPLET_REGEX.match(p.output[0:p.output.index('\n')])
if m:
return m.group(1), m.group(2), m.group(3)
raise FDroidException(_("Reading packageName/versionCode/versionName failed, APK invalid: '{apkfilename}'")
.format(apkfilename=apkfile))