move index sorting to index module

This is a historic detail of the index format, so move it there.
For wiki update and status json there's really no reason why this should
be done in alphabetic app name order. Use the default sort order by
appid.
This commit is contained in:
Marcus Hoffmann 2020-06-03 22:27:09 +02:00
parent 8c71637d43
commit e66683720b
2 changed files with 13 additions and 16 deletions

View file

@ -44,13 +44,12 @@ from fdroidserver.common import FDroidPopen, FDroidPopenBytes, load_stats_fdroid
from fdroidserver.exception import FDroidException, VerificationException, MetaDataException
def make(apps, sortedids, apks, repodir, archive):
def make(apps, apks, repodir, archive):
"""Generate the repo index files.
This requires properly initialized options and config objects.
:param apps: fully populated apps list
:param sortedids: app package IDs, sorted
:param apks: full populated apks list
:param repodir: the repo directory
:param archive: True if this is the archive repo, False if it's the
@ -101,6 +100,9 @@ def make(apps, sortedids, apks, repodir, archive):
if mirrors:
repodict['mirrors'] = mirrors
# Historically the index has been sorted by App Name, so we enforce this ordering here
sortedids = sorted(apps, key=lambda appid: apps[appid].Name.upper())
appsWithPackages = collections.OrderedDict()
for packageName in sortedids:
app = apps[packageName]