chiark / gitweb /
ignore cache on key name change, instead of crashing
authorHans-Christoph Steiner <hans@eds.org>
Mon, 3 Apr 2017 14:52:17 +0000 (16:52 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Mon, 3 Apr 2017 18:20:25 +0000 (20:20 +0200)
In 6c2cf2ccdd7130a034e50f9bea481351d475a272, the names of some essential
data bits changed.  If those names are not in the tmp/apkcache, then
`fdroid update` shouldn't crash but instead just ignore that cache entry.
tmp/apkcache should be deleted since the metadata version was bumped, but
I guess that does not always happen.

fdroidserver/update.py

index f8bf731f7d33ff4128e837a1751bebf52d83d1dc..6412029b249ba21abc409339ca5e76ed7fcb6425 100644 (file)
@@ -682,7 +682,7 @@ def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False):
                     repo_file['added'] = a
                 else:
                     repo_file['added'] = datetime(*a[:6])
-            if repo_file['hash'] == shasum:
+            if repo_file.get('hash') == shasum:
                 logging.debug("Reading " + name + " from cache")
                 usecache = True
             else:
@@ -759,7 +759,7 @@ def scan_apk(apkcache, apkfilename, repodir, knownapks, use_date_from_apk):
     usecache = False
     if apkfilename in apkcache:
         apk = apkcache[apkfilename]
-        if apk['hash'] == shasum:
+        if apk.get('hash') == shasum:
             logging.debug("Reading " + apkfilename + " from cache")
             usecache = True
         else: