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

Merge branch 'btlog-index-v2' into 'master'

binary transparency log improvements

See merge request fdroid/fdroidserver!1245
This commit is contained in:
Jochen Sprickerhof 2022-11-02 19:24:38 +00:00
commit 938b324e4d
2 changed files with 11 additions and 7 deletions

View File

@ -91,7 +91,7 @@ For more info on this idea:
cpdir = os.path.join(btrepo, repodir) cpdir = os.path.join(btrepo, repodir)
if not os.path.exists(cpdir): if not os.path.exists(cpdir):
os.mkdir(cpdir) os.mkdir(cpdir)
for f in ('index.xml', 'index-v1.json'): for f in ('index.xml', 'index-v1.json', 'index-v2.json', 'entry.json'):
repof = os.path.join(repodir, f) repof = os.path.join(repodir, f)
if not os.path.exists(repof): if not os.path.exists(repof):
continue continue
@ -107,7 +107,7 @@ For more info on this idea:
with open(dest, 'w') as fp: with open(dest, 'w') as fp:
json.dump(output, fp, indent=2) json.dump(output, fp, indent=2)
gitrepo.index.add([repof]) gitrepo.index.add([repof])
for f in ('index.jar', 'index-v1.jar'): for f in ('index.jar', 'index-v1.jar', 'entry.jar'):
repof = os.path.join(repodir, f) repof = os.path.join(repodir, f)
if not os.path.exists(repof): if not os.path.exists(repof):
continue continue

View File

@ -721,9 +721,9 @@ def v2_repo(repodict, repodir, archive):
repo["timestamp"] = repodict["timestamp"] repo["timestamp"] = repodict["timestamp"]
anti_features = load_locale("antiFeatures", repodir) antiFeatures = load_locale("antiFeatures", repodir)
if anti_features: if antiFeatures:
repo["antiFeatures"] = anti_features repo["antiFeatures"] = antiFeatures
categories = load_locale("categories", repodir) categories = load_locale("categories", repodir)
if categories: if categories:
@ -910,7 +910,7 @@ def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_
k = k[:1].lower() + k[1:] k = k[:1].lower() + k[1:]
d[k] = v d[k] = v
# establish sort order in localized dicts # establish sort order in lists, sets, and localized dicts
for app in output['apps']: for app in output['apps']:
localized = app.get('localized') localized = app.get('localized')
if 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()): for ikey, iname in sorted(lvalue.items()):
lordered[lkey][ikey] = iname lordered[lkey][ikey] = iname
app['localized'] = lordered app['localized'] = lordered
antiFeatures = app.get('AntiFeatures')
if antiFeatures:
app['AntiFeatures'] = sorted(set(antiFeatures))
output_packages = collections.OrderedDict() output_packages = collections.OrderedDict()
output['packages'] = output_packages 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]: if 'antiFeatures' in apklist[0]:
app.AntiFeatures.extend(apklist[0]['antiFeatures']) app.AntiFeatures.extend(apklist[0]['antiFeatures'])
if app.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... # Check for duplicates - they will make the client unhappy...
for i in range(len(apklist) - 1): for i in range(len(apklist) - 1):