mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-06 11:00:13 +02:00
choose best apk version vor index v0
This commit is contained in:
parent
6930edf889
commit
6fc968f7cd
@ -512,8 +512,8 @@ def publishednameinfo(filename):
|
||||
return result
|
||||
|
||||
|
||||
apk_release_filename = re.compile('(?P<appid>[a-z0-9_\.]+)_(?P<vercode>[0-9]+)\.apk')
|
||||
apk_release_filename_with_sigfp = re.compile('(?P<appid>[a-z0-9_\.]+)_(?P<vercode>[0-9]+)_(?P<sigfp>[0-9a-f]{7})\.apk')
|
||||
apk_release_filename = re.compile('(?P<appid>[a-zA-Z0-9_\.]+)_(?P<vercode>[0-9]+)\.apk')
|
||||
apk_release_filename_with_sigfp = re.compile('(?P<appid>[a-zA-Z0-9_\.]+)_(?P<vercode>[0-9]+)_(?P<sigfp>[0-9a-f]{7})\.apk')
|
||||
|
||||
|
||||
def apk_parse_release_filename(apkname):
|
||||
|
@ -354,6 +354,8 @@ def make_v0(apps, apks, repodir, repodict, requestsdict):
|
||||
root.appendChild(element)
|
||||
element.setAttribute('packageName', packageName)
|
||||
|
||||
fdroid_signed = load_sigkeys(repodir)
|
||||
|
||||
for appid, appdict in apps.items():
|
||||
app = metadata.App(appdict)
|
||||
|
||||
@ -362,12 +364,27 @@ def make_v0(apps, apks, repodir, repodict, requestsdict):
|
||||
|
||||
# Get a list of the apks for this app...
|
||||
apklist = []
|
||||
versionCodes = []
|
||||
apksbyversion = collections.defaultdict(lambda: [])
|
||||
for apk in apks:
|
||||
if apk['packageName'] == appid:
|
||||
if apk['versionCode'] not in versionCodes:
|
||||
apklist.append(apk)
|
||||
versionCodes.append(apk['versionCode'])
|
||||
if apk.get('versionCode') and apk.get('packageName') == appid:
|
||||
apksbyversion[apk['versionCode']].append(apk)
|
||||
for versionCode, apksforver in apksbyversion.items():
|
||||
fdroidsig = fdroid_signed.get(appid, {}).get('signer')
|
||||
fdroid_signed_apk = None
|
||||
name_match_apk = None
|
||||
for x in apksforver:
|
||||
if fdroidsig and x.get('signer', None) == fdroidsig:
|
||||
fdroid_signed_apk = x
|
||||
if common.apk_release_filename.match(x.get('apkName', '')):
|
||||
name_match_apk = x
|
||||
# choose which of the available versions is most
|
||||
# suiteable for index v0
|
||||
if fdroid_signed_apk:
|
||||
apklist.append(fdroid_signed_apk)
|
||||
elif name_match_apk:
|
||||
apklist.append(name_match_apk)
|
||||
else:
|
||||
apklist.append(apksforver[0])
|
||||
|
||||
if len(apklist) == 0:
|
||||
continue
|
||||
|
@ -901,7 +901,7 @@ def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False):
|
||||
logging.debug("Reading " + name_utf8 + " from cache")
|
||||
usecache = True
|
||||
else:
|
||||
logging.debug("Ignoring stale cache data for " + name)
|
||||
logging.debug("Ignoring stale cache data for " + name_utf8)
|
||||
|
||||
if not usecache:
|
||||
logging.debug(_("Processing {apkfilename}").format(apkfilename=name_utf8))
|
||||
|
Loading…
Reference in New Issue
Block a user