]> git.decadent.org.uk Git - dak.git/commitdiff
allow p-a and p-u to take a directory to parse themselves
authorMark Hymers <mhy@debian.org>
Sat, 21 Feb 2009 20:48:21 +0000 (20:48 +0000)
committerMark Hymers <mhy@debian.org>
Sat, 21 Feb 2009 20:48:30 +0000 (20:48 +0000)
This prevents any possible issues with maximum command line
lengths when using shell globbing.

Signed-off-by: Mark Hymers <mhy@debian.org>
config/debian/cron.unchecked
config/debian/dinstall
dak/process_accepted.py
dak/process_unchecked.py

index 41b664016126c642d12d7bb159d038e9f99f5516..a2eb6d3893187ceb1233f84a31de3b4eb5596294 100755 (executable)
@@ -31,7 +31,7 @@ if lockfile -r3 $LOCKFILE; then
 
     if [ ! -z "$changes" ]; then
        echo "$timestamp": "$changes"  >> $report
-       dak process-unchecked -a $changes >> $report
+       dak process-unchecked -a -d /srv/ftp.debian.org/queue/unchecked >> $report
        echo "--" >> $report
 
        # sync with debbugs
index d38503cedbd8f7870b620051360640b6792e00f6..a4244e37a80e760c5e28f0ff7d5435d1748c70d7 100755 (executable)
@@ -169,7 +169,7 @@ function accepted() {
     log "Processing queue/accepted"
     cd "$accepted"
     rm -f REPORT
-    dak process-accepted -pa *.changes > REPORT
+    dak process-accepted -pa -d /srv/ftp.debian.org/queue/accepted > REPORT
     cat REPORT | mail -s "Install for $(date +"%D - %R")" ftpmaster@ftp-master.debian.org
     chgrp debadmin REPORT
     chmod 664 REPORT
index d626db96a3cdfca02d6cb5186c6dc61c7473b3be..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
 
index 288563af9a85df0b65aa83ccd75df5a92bc9dd57..e04572604648a4bb226e00d2bee70c3f122d38af 100755 (executable)
@@ -78,10 +78,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",
-              "override-distribution", "version"]:
+              "override-distribution", "version", "directory"]:
         Cnf["Dinstall::Options::%s" % (i)] = ""
 
     changes_files = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv)
@@ -90,6 +91,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-u 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)
 
     changes = Upload.pkg.changes