]> git.decadent.org.uk Git - dak.git/commitdiff
Merge branch 'merge'
authorJoerg Jaspert <joerg@debian.org>
Sat, 21 Feb 2009 21:05:35 +0000 (22:05 +0100)
committerJoerg Jaspert <joerg@debian.org>
Sat, 21 Feb 2009 21:05:35 +0000 (22:05 +0100)
* merge:
  docstring
  move logic into a function
  more tidy ups for paths/variables
  use variables for paths
  allow p-a and p-u to take a directory to parse themselves

config/debian/cron.unchecked
config/debian/dinstall
dak/process_accepted.py
dak/process_unchecked.py
daklib/utils.py

index 41b664016126c642d12d7bb159d038e9f99f5516..5e7a035dcfeeafb0592bab7bbddd6e6b9e1dc645 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 "$unchecked" >> $report
        echo "--" >> $report
 
        # sync with debbugs
index 94787d5c2b302e6e4bf76597db3308add3dd0a90..4544d0a0daeb256e3ba38a5f2867560cf9c731d3 100755 (executable)
@@ -167,9 +167,8 @@ function i18n1() {
 # Process the accepted queue
 function accepted() {
     log "Processing queue/accepted"
-    cd "$accepted"
-    rm -f REPORT
-    dak process-accepted -pa *.changes > REPORT
+    rm -f "$accepted/REPORT"
+    dak process-accepted -pa -d "$accepted" > "$accepted/REPORT"
     cat REPORT | mail -s "Install for $(date +"%D - %R")" ftpmaster@ftp-master.debian.org
     chgrp debadmin REPORT
     chmod 664 REPORT
index d626db96a3cdfca02d6cb5186c6dc61c7473b3be..e53a969f48c1f35a88d292c3cb94d3ce86b3d855 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,15 @@ 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")
+
+        changes_files = utils.get_changes_files(Cnf["Dinstall::Options::Directory"])
+
     Upload = queue.Upload(Cnf)
     projectB = Upload.projectB
 
index 288563af9a85df0b65aa83ccd75df5a92bc9dd57..c2adb6393529d0ab6dc264f84d5b2933b79316d0 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,15 @@ 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")
+
+        changes_files = utils.get_changes_files(Cnf["Dinstall::Options::Directory"])
+
     Upload = queue.Upload(Cnf)
 
     changes = Upload.pkg.changes
index e0bdfe8412dca1f5f062ac249f16eb8714b04cec..fd790b5930df56d0e49804a13178db33f7bca090 100755 (executable)
@@ -1498,6 +1498,25 @@ def is_email_alias(email):
 
 ################################################################################
 
+def get_changes_files(dir):
+    """
+    Takes a directory and lists all .changes files in it (as well as chdir'ing
+    to the directory; this is due to broken behaviour on the part of p-u/p-a
+    when you're not in the right place)
+
+    Returns a list of filenames
+    """
+    try:
+        # Much of the rest of p-u/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:
+        fubar("Failed to read list from directory %s (%s)" % (dir, e))
+
+    return changes_files
+
+################################################################################
+
 apt_pkg.init()
 
 Cnf = apt_pkg.newConfiguration()