]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/queue.py
NEW
[dak.git] / daklib / queue.py
index 29d2260b5485dc6507798502ee1f20ab4966683a..ceb4a797863b626565febb7a9553293f131232b8 100755 (executable)
@@ -212,8 +212,7 @@ class Upload:
         self.accept_count = 0
         self.accept_bytes = 0L
         self.reject_message = ""
-        self.pkg = Pkg(changes = {}, dsc = {}, dsc_files = {}, files = {},
-                       legacy_source_untouchable = {})
+        self.pkg = Pkg(changes = {}, dsc = {}, dsc_files = {}, files = {})
 
         # Initialize the substitution template mapping global
         Subst = self.Subst = {}
@@ -233,7 +232,6 @@ class Upload:
         self.pkg.dsc.clear()
         self.pkg.files.clear()
         self.pkg.dsc_files.clear()
-        self.pkg.legacy_source_untouchable.clear()
         self.pkg.orig_tar_id = None
         self.pkg.orig_tar_location = ""
         self.pkg.orig_tar_gz = None
@@ -252,7 +250,6 @@ class Upload:
         self.pkg.dsc.update(p.load())
         self.pkg.files.update(p.load())
         self.pkg.dsc_files.update(p.load())
-        self.pkg.legacy_source_untouchable.update(p.load())
 
         self.pkg.orig_tar_id = p.load()
         self.pkg.orig_tar_location = p.load()
@@ -279,7 +276,6 @@ class Upload:
         dsc = self.pkg.dsc
         files = self.pkg.files
         dsc_files = self.pkg.dsc_files
-        legacy_source_untouchable = self.pkg.legacy_source_untouchable
         orig_tar_id = self.pkg.orig_tar_id
         orig_tar_location = self.pkg.orig_tar_location
 
@@ -351,7 +347,7 @@ class Upload:
                     d_dsc_files[file_entry][i] = dsc_files[file_entry][i]
 
         for i in [ d_changes, d_dsc, d_files, d_dsc_files,
-                   legacy_source_untouchable, orig_tar_id, orig_tar_location ]:
+                   orig_tar_id, orig_tar_location ]:
             p.dump(i)
         dump_file.close()
 
@@ -556,7 +552,7 @@ distribution."""
 
     ###########################################################################
 
-    def accept (self, summary, short_summary):
+    def accept (self, summary, short_summary, targetdir=None):
         """
         Accept an upload.
 
@@ -581,16 +577,19 @@ distribution."""
         changes_file = self.pkg.changes_file
         dsc = self.pkg.dsc
 
+        if targetdir is None:
+            targetdir = Cnf["Dir::Queue::Accepted"]
+
         print "Accepting."
         self.Logger.log(["Accepting changes",changes_file])
 
-        self.dump_vars(Cnf["Dir::Queue::Accepted"])
+        self.dump_vars(targetdir)
 
         # Move all the files into the accepted directory
-        utils.move(changes_file, Cnf["Dir::Queue::Accepted"])
+        utils.move(changes_file, targetdir)
         file_keys = files.keys()
         for file_entry in file_keys:
-            utils.move(file_entry, Cnf["Dir::Queue::Accepted"])
+            utils.move(file_entry, targetdir)
             self.accept_bytes += float(files[file_entry]["size"])
         self.accept_count += 1
 
@@ -639,6 +638,18 @@ distribution."""
             os.rename(temp_filename, filename)
             os.chmod(filename, 0644)
 
+        # Its is Cnf["Dir::Queue::Accepted"] here, not targetdir!
+        # <Ganneff> we do call queue_build too
+        # <mhy> well yes, we'd have had to if we were inserting into accepted
+        # <Ganneff> now. thats database only.
+        # <mhy> urgh, that's going to get messy
+        # <Ganneff> so i make the p-n call to it *also* using accepted/
+        # <mhy> but then the packages will be in the queue_build table without the files being there
+        # <Ganneff> as the buildd queue is only regenerated whenever unchecked runs
+        # <mhy> ah, good point
+        # <Ganneff> so it will work out, as unchecked move it over
+        # <mhy> that's all completely sick
+        # <Ganneff> yes
         self.queue_build("accepted", Cnf["Dir::Queue::Accepted"])
 
     ###########################################################################
@@ -807,7 +818,7 @@ distribution."""
 
     ###########################################################################
 
-    def do_reject (self, manual = 0, reject_message = ""):
+    def do_reject (self, manual = 0, reject_message = "", note = ""):
         """
         Reject an upload. If called without a reject message or C{manual} is
         true, spawn an editor so the user can write one.
@@ -825,6 +836,11 @@ distribution."""
         # editor so the user can add one in...
         if manual and not reject_message:
             (fd, temp_filename) = utils.temp_filename()
+            temp_file = os.fdopen(fd, 'w')
+            if len(note) > 0:
+                for line in note:
+                    temp_file.write(line)
+            temp_file.close()
             editor = os.environ.get("EDITOR","vi")
             answer = 'E'
             while answer == 'E':
@@ -1181,7 +1197,6 @@ SELECT s.version, su.suite_name FROM source s, src_associations sa, suite su
         self.reject_message = ""
         files = self.pkg.files
         dsc_files = self.pkg.dsc_files
-        legacy_source_untouchable = self.pkg.legacy_source_untouchable
         self.pkg.orig_tar_gz = None
 
         # Try and find all files mentioned in the .dsc.  This has
@@ -1253,8 +1268,6 @@ SELECT s.version, su.suite_name FROM source s, src_associations sa, suite su
                             actual_size = os.stat(old_file)[stat.ST_SIZE]
                             if actual_md5 == dsc_files[dsc_file]["md5sum"] and actual_size == int(dsc_files[dsc_file]["size"]):
                                 x = i
-                            else:
-                                legacy_source_untouchable[i[3]] = ""
 
                     old_file = x[0] + x[1]
                     old_file_fh = utils.open_file(old_file)
@@ -1268,10 +1281,7 @@ SELECT s.version, su.suite_name FROM source s, src_associations sa, suite su
                     # See install() in process-accepted...
                     self.pkg.orig_tar_id = x[3]
                     self.pkg.orig_tar_gz = old_file
-                    if suite_type == "legacy" or suite_type == "legacy-mixed":
-                        self.pkg.orig_tar_location = "legacy"
-                    else:
-                        self.pkg.orig_tar_location = x[4]
+                    self.pkg.orig_tar_location = x[4]
                 else:
                     # Not there? Check the queue directories...