chiark / gitweb /
update: skip APKs that cannot be parsed instead of exiting
authorHans-Christoph Steiner <hans@eds.org>
Mon, 2 Jun 2014 20:18:12 +0000 (16:18 -0400)
committerHans-Christoph Steiner <hans@eds.org>
Thu, 5 Jun 2014 02:01:25 +0000 (22:01 -0400)
Some APKs can be corrupt or some system APKs do not have all the normal
info.  Instead of quitting, `fdroid update` skips the non-parsable APKs and
optionally deletes them if --delete-unknown is specified.

fdroidserver/update.py

index d7e93fcf1f886cc52b3e973050dee397a9efb947..839a84f8c61772e17843508d1c5ff14ba66bf9c7 100644 (file)
@@ -379,8 +379,15 @@ def scan_apks(apps, apkcache, repodir, knownapks):
                                           config['build_tools'], 'aapt'),
                              'dump', 'badging', apkfile])
             if p.returncode != 0:
-                logging.critical("Failed to get apk information")
-                sys.exit(1)
+                if options.delete_unknown:
+                    if os.path.exists(apkfile):
+                        logging.error("Failed to get apk information, deleting " + apkfile)
+                        os.remove(apkfile)
+                    else:
+                        logging.error("Could not find {0} to remove it".format(apkfile))
+                else:
+                    logging.error("Failed to get apk information, skipping " + apkfile)
+                continue
             for line in p.stdout.splitlines():
                 if line.startswith("package:"):
                     try: