1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-02 09:10:11 +02:00

index: Anti-Features should always be a sorted set

There are diffs in the index caused by unstable order:
* 184cdd9c65 (572d84bb16becb794e10614840972554f333c66e_169259_169353)
* 184cdd9c65 (24c372740761176e67461dbc9136a799b15cfdbf_204154_204185)
This commit is contained in:
Hans-Christoph Steiner 2022-11-01 09:53:09 +01:00
parent cd0c049b03
commit 886712026d

View File

@ -910,7 +910,7 @@ def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_
k = k[:1].lower() + k[1:]
d[k] = v
# establish sort order in localized dicts
# establish sort order in lists, sets, and localized dicts
for app in output['apps']:
localized = app.get('localized')
if localized:
@ -920,6 +920,9 @@ def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_
for ikey, iname in sorted(lvalue.items()):
lordered[lkey][ikey] = iname
app['localized'] = lordered
antiFeatures = app.get('AntiFeatures')
if antiFeatures:
app['AntiFeatures'] = sorted(set(antiFeatures))
output_packages = collections.OrderedDict()
output['packages'] = output_packages
@ -1192,7 +1195,8 @@ def make_v0(apps, apks, repodir, repodict, requestsdict, fdroid_signing_key_fing
if 'antiFeatures' in apklist[0]:
app.AntiFeatures.extend(apklist[0]['antiFeatures'])
if app.AntiFeatures:
addElementNonEmpty('antifeatures', ','.join(app.AntiFeatures), doc, apel)
afout = sorted(set(app.AntiFeatures))
addElementNonEmpty('antifeatures', ','.join(afout), doc, apel)
# Check for duplicates - they will make the client unhappy...
for i in range(len(apklist) - 1):