chiark / gitweb /
update: skip packages without metadata in index V1
authorHans-Christoph Steiner <hans@eds.org>
Mon, 15 May 2017 18:11:41 +0000 (20:11 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Thu, 18 May 2017 14:13:17 +0000 (16:13 +0200)
If a package does not have a matching "app" metadata file, then it should
not be added to the index. index V0 already does this properly.

fdroidserver/index.py

index aae2e1b6588528a7e0b5f93e2f8bd89023a18df7..6eda4a530edc94046ac3aa395782945ab91d025e 100644 (file)
@@ -169,7 +169,7 @@ def make_v1(apps, packages, repodir, repodict, requestsdict):
 
     appslist = []
     output['apps'] = appslist
-    for appid, appdict in apps.items():
+    for packageName, appdict in apps.items():
         d = collections.OrderedDict()
         appslist.append(d)
         for k, v in sorted(appdict.items()):
@@ -190,7 +190,7 @@ def make_v1(apps, packages, repodir, repodict, requestsdict):
             elif k == 'CurrentVersion':  # TODO make SuggestedVersionName the canonical name
                 k = 'suggestedVersionName'
             elif k == 'AutoName':
-                if 'Name' not in apps[appid]:
+                if 'Name' not in apps[packageName]:
                     d['name'] = v
                 continue
             else:
@@ -201,6 +201,9 @@ def make_v1(apps, packages, repodir, repodict, requestsdict):
     output['packages'] = output_packages
     for package in packages:
         packageName = package['packageName']
+        if packageName not in apps:
+            logging.info('Ignoring package without metadata: ' + package['apkName'])
+            continue
         if packageName in output_packages:
             packagelist = output_packages[packageName]
         else: