]> git.decadent.org.uk Git - dak.git/blobdiff - dak/process_accepted.py
allow p-a and p-u to take a directory to parse themselves
[dak.git] / dak / process_accepted.py
index dce0cdbe8f0c40d502cc5fe03e37bde5a7d4422b..07d611d5f0bac72c2d88f48de6f7288bc94c599b 100755 (executable)
@@ -162,9 +162,11 @@ def init():
                  ('h',"help","Dinstall::Options::Help"),
                  ('n',"no-action","Dinstall::Options::No-Action"),
                  ('p',"no-lock", "Dinstall::Options::No-Lock"),
-                 ('s',"no-mail", "Dinstall::Options::No-Mail")]
+                 ('s',"no-mail", "Dinstall::Options::No-Mail"),
+                 ('d',"directory", "Dinstall::Options::Directory")]
 
-    for i in ["automatic", "help", "no-action", "no-lock", "no-mail", "version"]:
+    for i in ["automatic", "help", "no-action", "no-lock", "no-mail",
+              "version", "directory"]:
         if not Cnf.has_key("Dinstall::Options::%s" % (i)):
             Cnf["Dinstall::Options::%s" % (i)] = ""
 
@@ -174,6 +176,21 @@ def init():
     if Options["Help"]:
         usage()
 
+    # If we have a directory flag, use it to find our files
+    if Cnf["Dinstall::Options::Directory"] != "":
+        # Note that we clobber the list of files we were given in this case
+        # so warn if the user has done both
+        if len(changes_files) > 0:
+            utils.warn("Directory provided so ignoring files given on command line")
+
+        dir = Cnf["Dinstall::Options::Directory"]
+        try:
+            # Much of the rest of p-a depends on being in the right place
+            os.chdir(dir)
+            changes_files = [x for x in os.listdir(dir) if x.endswith('.changes')]
+        except OSError, e:
+            utils.fubar("Failed to read list from directory %s (%s)" % (dir, e))
+
     Upload = queue.Upload(Cnf)
     projectB = Upload.projectB
 
@@ -372,6 +389,9 @@ def install ():
                 suite_id = database.get_suite_id(suite)
                 projectB.query("INSERT INTO bin_associations (suite, bin) VALUES (%d, currval('binaries_id_seq'))" % (suite_id))
 
+    orig_tar_id = Upload.pkg.orig_tar_id
+    orig_tar_location = Upload.pkg.orig_tar_location
+
     # If this is a sourceful diff only upload that is moving
     # cross-component we need to copy the .orig.tar.gz into the new
     # component too for the same reasons as above.