]> git.decadent.org.uk Git - dak.git/blobdiff - dak/generate_releases.py
dak/generate_releases.py: create worker pool before connection to database
[dak.git] / dak / generate_releases.py
index a57c5fc22143047628dd87dd1c1d440064899c6e..798726bb9ec887b2c9c6146415b0a4e06cc7de43 100755 (executable)
@@ -60,6 +60,7 @@ def usage (exit_code=0):
     print """Usage: dak generate-releases [OPTIONS]
 Generate the Release files
 
+  -a, --archive=ARCHIVE      process suites in ARCHIVE
   -s, --suite=SUITE(s)       process this suite
                              Default: All suites not marked 'untouchable'
   -f, --force                Allow processing of untouchable suites
@@ -97,7 +98,7 @@ def sign_release_dir(suite, dirname):
         # the array for consistency
         firstkey = True
 
-        for keyid in suite.signingkeys:
+        for keyid in suite.signingkeys or []:
             defkeyid = "--default-key %s" % keyid
 
             os.system("gpg %s %s %s --detach-sign <%s >>%s" %
@@ -155,6 +156,8 @@ class ReleaseWriter(object):
                 # TEMPORARY HACK HACK HACK until we change the way we store the suite names etc
                 if key == 'Suite' and getattr(suite, dbfield) == 'squeeze-updates':
                     out.write("Suite: stable-updates\n")
+                elif key == 'Suite' and getattr(suite, dbfield) == 'wheezy-updates':
+                    out.write("Suite: testing-updates\n")
                 else:
                     out.write("%s: %s\n" % (key, getattr(suite, dbfield)))
 
@@ -297,6 +300,7 @@ def main ():
             cnf["Generate-Releases::Options::%s" % (i)] = ""
 
     Arguments = [('h',"help","Generate-Releases::Options::Help"),
+                 ('a','archive','Generate-Releases::Options::Archive','HasArg'),
                  ('s',"suite","Generate-Releases::Options::Suite"),
                  ('f',"force","Generate-Releases::Options::Force"),
                  ('o','option','','ArbItem')]
@@ -308,6 +312,7 @@ def main ():
         usage()
 
     Logger = daklog.Logger('generate-releases')
+    pool = DakProcessPool()
 
     session = DBConn().session()
 
@@ -321,12 +326,13 @@ def main ():
                 print "cannot find suite %s" % s
                 Logger.log(['cannot find suite %s' % s])
     else:
-        suites = session.query(Suite).filter(Suite.untouchable == False).all()
+        query = session.query(Suite).filter(Suite.untouchable == False)
+        if 'Archive' in Options:
+            query = query.join(Suite.archive).filter(Archive.archive_name==Options['Archive'])
+        suites = query.all()
 
     broken=[]
 
-    pool = DakProcessPool()
-
     for s in suites:
         # Setup a multiprocessing Pool. As many workers as we have CPU cores.
         if s.untouchable and not Options["Force"]: