chiark / gitweb /
Generate gpg signatures for apks in archive repo also
authorCiaran Gultnieks <ciaran@ciarang.com>
Mon, 30 Jun 2014 21:49:54 +0000 (22:49 +0100)
committerCiaran Gultnieks <ciaran@ciarang.com>
Mon, 30 Jun 2014 21:49:54 +0000 (22:49 +0100)
fdroidserver/gpgsign.py

index 46727f2c56823b670d9eee5dde548f3e2bd9e09f..fa874cb805500de201b09379c81f944aecc6b195 100644 (file)
@@ -44,28 +44,32 @@ def main():
 
     config = common.read_config(options)
 
-    output_dir = 'repo'
-    if not os.path.isdir(output_dir):
-        logging.error("Missing output directory")
-        sys.exit(1)
-
-    # Process any apks that are waiting to be signed...
-    for apkfile in sorted(glob.glob(os.path.join(output_dir, '*.apk'))):
-
-        apkfilename = os.path.basename(apkfile)
-        sigfilename = apkfilename + ".asc"
-        sigpath = os.path.join(output_dir, sigfilename)
-
-        if not os.path.exists(sigpath):
-            p = FDroidPopen(['gpg', '-a',
-                             '--output', sigpath,
-                             '--detach-sig',
-                             os.path.join(output_dir, apkfilename)])
-            if p.returncode != 0:
-                logging.error("Signing failed.")
-                sys.exit(1)
-
-            logging.info('Signed ' + apkfilename)
+    repodirs = ['repo']
+    if config['archive_older'] != 0:
+        repodirs.append('archive')
+
+    for output_dir in repodirs:
+        if not os.path.isdir(output_dir):
+            logging.error("Missing output directory '" + output_dir + "'")
+            sys.exit(1)
+
+        # Process any apks that are waiting to be signed...
+        for apkfile in sorted(glob.glob(os.path.join(output_dir, '*.apk'))):
+
+            apkfilename = os.path.basename(apkfile)
+            sigfilename = apkfilename + ".asc"
+            sigpath = os.path.join(output_dir, sigfilename)
+
+            if not os.path.exists(sigpath):
+                p = FDroidPopen(['gpg', '-a',
+                                 '--output', sigpath,
+                                 '--detach-sig',
+                                 os.path.join(output_dir, apkfilename)])
+                if p.returncode != 0:
+                    logging.error("Signing failed.")
+                    sys.exit(1)
+
+                logging.info('Signed ' + apkfilename)
 
 
 if __name__ == "__main__":