mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-05 18:50:09 +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:
parent
f11b2e8d45
commit
fa09337b4b
@ -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))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user