mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 06:52:39 +03:00
More info into index - size, permissions, features, sdk version
This commit is contained in:
parent
23b99ba9cd
commit
1afa8cfc1c
1 changed files with 47 additions and 2 deletions
49
update.py
49
update.py
|
@ -34,6 +34,8 @@ execfile('config.py')
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
parser.add_option("-c", "--createmeta", action="store_true", default=False,
|
parser.add_option("-c", "--createmeta", action="store_true", default=False,
|
||||||
help="Create skeleton metadata files that are missing")
|
help="Create skeleton metadata files that are missing")
|
||||||
|
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||||
|
help="Spew out even more information than normal")
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,12 +55,16 @@ for apkfile in glob.glob(os.path.join('repo','*.apk')):
|
||||||
print "Processing " + apkfilename
|
print "Processing " + apkfilename
|
||||||
thisinfo = {}
|
thisinfo = {}
|
||||||
thisinfo['apkname'] = apkfilename
|
thisinfo['apkname'] = apkfilename
|
||||||
|
thisinfo['size'] = os.path.getsize(apkfile)
|
||||||
|
thisinfo['permissions'] = []
|
||||||
|
thisinfo['features'] = []
|
||||||
p = subprocess.Popen([aapt_path,'dump','badging',
|
p = subprocess.Popen([aapt_path,'dump','badging',
|
||||||
apkfile], stdout=subprocess.PIPE)
|
apkfile], stdout=subprocess.PIPE)
|
||||||
output = p.communicate()[0]
|
output = p.communicate()[0]
|
||||||
if p.returncode != 0:
|
if options.verbose:
|
||||||
print "Failed to get apk information"
|
|
||||||
print output
|
print output
|
||||||
|
if p.returncode != 0:
|
||||||
|
print "ERROR: Failed to get apk information"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
for line in output.splitlines():
|
for line in output.splitlines():
|
||||||
if line.startswith("package:"):
|
if line.startswith("package:"):
|
||||||
|
@ -73,6 +79,28 @@ for apkfile in glob.glob(os.path.join('repo','*.apk')):
|
||||||
thisinfo['name'] = re.match(pat, line).group(1)
|
thisinfo['name'] = re.match(pat, line).group(1)
|
||||||
pat = re.compile(".*icon='([^']*)'.*")
|
pat = re.compile(".*icon='([^']*)'.*")
|
||||||
thisinfo['iconsrc'] = re.match(pat, line).group(1)
|
thisinfo['iconsrc'] = re.match(pat, line).group(1)
|
||||||
|
if line.startswith("sdkVersion:"):
|
||||||
|
pat = re.compile(".*'([0-9]*)'.*")
|
||||||
|
thisinfo['sdkversion'] = re.match(pat, line).group(1)
|
||||||
|
if line.startswith("native-code:"):
|
||||||
|
pat = re.compile(".*'([^']*)'.*")
|
||||||
|
thisinfo['nativecode'] = re.match(pat, line).group(1)
|
||||||
|
if line.startswith("uses-permission:"):
|
||||||
|
pat = re.compile(".*'([^']*)'.*")
|
||||||
|
perm = re.match(pat, line).group(1)
|
||||||
|
if perm.startswith("android.permission."):
|
||||||
|
perm = perm[19:]
|
||||||
|
thisinfo['permissions'].append(perm)
|
||||||
|
if line.startswith("uses-feature:"):
|
||||||
|
pat = re.compile(".*'([^']*)'.*")
|
||||||
|
perm = re.match(pat, line).group(1)
|
||||||
|
if perm.startswith("android.feature."):
|
||||||
|
perm = perm[16:]
|
||||||
|
thisinfo['features'].append(perm)
|
||||||
|
|
||||||
|
if not thisinfo.has_key('sdkversion'):
|
||||||
|
print " WARNING: no SDK version information found"
|
||||||
|
thisinfo['sdkversion'] = 0
|
||||||
|
|
||||||
# Calculate the md5...
|
# Calculate the md5...
|
||||||
m = md5.new()
|
m = md5.new()
|
||||||
|
@ -242,6 +270,23 @@ for app in apps:
|
||||||
addElement('versioncode', apk['versioncode'], doc, apkel)
|
addElement('versioncode', apk['versioncode'], doc, apkel)
|
||||||
addElement('apkname', apk['apkname'], doc, apkel)
|
addElement('apkname', apk['apkname'], doc, apkel)
|
||||||
addElement('hash', apk['md5'], doc, apkel)
|
addElement('hash', apk['md5'], doc, apkel)
|
||||||
|
addElement('size', str(apk['size']), doc, apkel)
|
||||||
|
addElement('sdkver', str(apk['sdkversion']), doc, apkel)
|
||||||
|
perms = ""
|
||||||
|
for p in apk['permissions']:
|
||||||
|
if len(perms) > 0:
|
||||||
|
perms += ","
|
||||||
|
perms += p
|
||||||
|
if len(perms) > 0:
|
||||||
|
addElement('permissions', perms, doc, apkel)
|
||||||
|
features = ""
|
||||||
|
for f in apk['features']:
|
||||||
|
if len(features) > 0:
|
||||||
|
features += ","
|
||||||
|
features += f
|
||||||
|
if len(features) > 0:
|
||||||
|
addElement('features', features, doc, apkel)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
apps_disabled += 1
|
apps_disabled += 1
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue