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

fix aapt scraping of <uses-permission> with maxSdkVersion

3e0d1beb09 changed this logic a bit, and it
wasn't quite right.  Then changing the SDK Versions to integers everywhere
seemed to bring this out more.
This commit is contained in:
Hans-Christoph Steiner 2018-12-06 13:42:45 +01:00
parent 653d5fbd88
commit 51d961630b

View File

@ -60,7 +60,7 @@ APK_VERCODE_PAT = re.compile(".*versionCode='([0-9]*)'.*")
APK_VERNAME_PAT = re.compile(".*versionName='([^']*)'.*")
APK_LABEL_ICON_PAT = re.compile(r".*\s+label='(.*)'\s+icon='(.*?)'")
APK_SDK_VERSION_PAT = re.compile(".*'([0-9]*)'.*")
APK_PERMISSION_PAT = re.compile(r".*(name='(.*)')(.*maxSdkVersion='(.*)')?.*")
APK_PERMISSION_PAT = re.compile(r".*name='([^']*)'(?:.*maxSdkVersion='([^']*)')?.*")
APK_FEATURE_PAT = re.compile(".*name='([^']*)'.*")
screen_densities = ['65534', '640', '480', '320', '240', '160', '120']
@ -1176,23 +1176,18 @@ def scan_apk_aapt(apk, apkfile):
apk['nativecode'].append(arch[1:-1])
elif line.startswith('uses-permission:'):
perm_match = re.match(APK_PERMISSION_PAT, line).groups()
if perm_match[2]:
perm_match[2] = int(perm_match[2]) # maxSdkVersion is an int
permission = UsesPermission(
perm_match[1], # name
perm_match[2], # maxSdkVersion
perm_match[0], # name
None if perm_match[1] is None else int(perm_match[1]), # maxSdkVersion
)
apk['uses-permission'].append(permission)
elif line.startswith('uses-permission-sdk-23:'):
perm_match = re.match(APK_PERMISSION_PAT, line).groups()
if perm_match[2]:
perm_match[2] = int(perm_match[2]) # maxSdkVersion is an int
permission_sdk_23 = UsesPermissionSdk23(
perm_match[1], # name
perm_match[2], # maxSdkVersion
perm_match[0], # name
None if perm_match[1] is None else int(perm_match[1]), # maxSdkVersion
)
apk['uses-permission-sdk-23'].append(permission_sdk_23)
elif line.startswith('uses-feature:'):