]> git.decadent.org.uk Git - dak.git/commitdiff
force_reject fixup
authorJoerg Jaspert <joerg@debian.org>
Mon, 21 Dec 2009 21:48:35 +0000 (22:48 +0100)
committerJoerg Jaspert <joerg@debian.org>
Mon, 21 Dec 2009 21:48:35 +0000 (22:48 +0100)
no longer try to rampage through a morgue/ directory, it has no
business there. Instead just claim the next name in the reject/ subdir
of queue/

Signed-off-by: Joerg Jaspert <joerg@debian.org>
daklib/queue.py

index a13c0416d4a5f278437d6fd9abb9e66b4464ea03..d3119c06262854874e7a745ff65b868428ca205d 100755 (executable)
@@ -2078,17 +2078,17 @@ distribution."""
             try:
                 dest_fd = os.open(dest_file, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0644)
             except OSError, e:
             try:
                 dest_fd = os.open(dest_file, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0644)
             except OSError, e:
-                # File exists?  Let's try and move it to the morgue
+                # File exists?  Let's find a new name by adding a number
                 if e.errno == errno.EEXIST:
                 if e.errno == errno.EEXIST:
-                    morgue_file = os.path.join(cnf["Dir::Morgue"], cnf["Dir::MorgueReject"], file_entry)
                     try:
                     try:
-                        morgue_file = utils.find_next_free(morgue_file)
+                        dest_file = utils.find_next_free(morgue_file, 255)
                     except NoFreeFilenameError:
                         # Something's either gone badly Pete Tong, or
                         # someone is trying to exploit us.
                     except NoFreeFilenameError:
                         # Something's either gone badly Pete Tong, or
                         # someone is trying to exploit us.
-                        utils.warn("**WARNING** failed to move %s from the reject directory to the morgue." % (file_entry))
+                        utils.warn("**WARNING** failed to find a free filename for %s in %s." % (file_entry, cnf["Fir::Queue::Reject"]))
                         return
                         return
-                    utils.move(dest_file, morgue_file, perms=0660)
+
+                    # Make sure we really got it
                     try:
                         dest_fd = os.open(dest_file, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644)
                     except OSError, e:
                     try:
                         dest_fd = os.open(dest_file, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644)
                     except OSError, e: