chiark / gitweb /
Use pre-retrieved Binary when publishing
authorCiaran Gultnieks <ciaran@ciarang.com>
Sat, 31 Jan 2015 15:36:57 +0000 (15:36 +0000)
committerCiaran Gultnieks <ciaran@ciarang.com>
Sat, 31 Jan 2015 15:36:57 +0000 (15:36 +0000)
This allows this system to work when the machine that runs 'fdroid
publish' is offline.

fdroidserver/publish.py

index b5ea2a755b3ca687a1a7615c7e9652f545067493..777cf43b543216966b734e391c4a031f1332bb6e 100644 (file)
@@ -124,31 +124,9 @@ def main():
             # It's an app where we build from source, and verify the apk
             # contents against a developer's binary, and then publish their
             # version if everything checks out.
-
-            # Need the version name for the version code...
-            versionname = None
-            for build in app['builds']:
-                if build['vercode'] == vercode:
-                    versionname = build['version']
-                    break
-            if not versionname:
-                logging.error("...no defined build for version code {0}"
-                              .format(vercode))
-                continue
-
-            # Figure out where the developer's binary is supposed to come from...
-            url = app['Binaries']
-            url = url.replace('%v', versionname)
-            url = url.replace('%c', str(vercode))
-
-            # Grab the binary from where the developer publishes it...
-            logging.info("...retrieving " + url)
-            srcapk = os.path.join(tmp_dir, url.split('/')[-1])
-            p = FDroidPopen(['wget', '-nv', '--continue', url], cwd=tmp_dir)
-            if p.returncode != 0 or not os.path.exists(srcapk):
-                logging.error("...failed to retrieve " + url +
-                              " - publish skipped")
-                continue
+            # The binary should already have been retrieved during the build
+            # process.
+            srcapk = apkfile + ".binary"
 
             # Compare our unsigned one with the downloaded one...
             compare_result = common.compare_apks(srcapk, apkfile, tmp_dir)
@@ -157,8 +135,10 @@ def main():
                               + compare_result)
                 continue
 
-            # Success! So move the downloaded file to the repo...
+            # Success! So move the downloaded file to the repo, and remove
+            # our built version.
             shutil.move(srcapk, os.path.join(output_dir, apkfilename))
+            os.remove(apkfile)
 
         else: