]> err.no Git - dak/commitdiff
process-upload: make sure we clean up after ourself
authorFrank Lichtenheld <djpig@debian.org>
Fri, 30 Oct 2009 22:06:29 +0000 (22:06 +0000)
committerFrank Lichtenheld <djpig@debian.org>
Fri, 30 Oct 2009 22:06:29 +0000 (22:06 +0000)
Signed-off-by: Frank Lichtenheld <djpig@debian.org>
dak/process_upload.py
daklib/queue.py

index e3a19ac31609a3b866e09694e3d44660a6b05b7d..a78d146c1267da7fc7faaa90c23abf3d7aa15486 100755 (executable)
@@ -166,6 +166,7 @@ def usage (exit_code=0):
 
 def action(u):
     cnf = Config()
+    holding = Holding()
 
     # changes["distribution"] may not exist in corner cases
     # (e.g. unreadable changes files)
@@ -233,6 +234,11 @@ def action(u):
 
 ###############################################################################
 
+def cleanup():
+    h = Holding()
+    if not Options["No-Action"]:
+        h.clean()
+
 def process_it(changes_file):
     global Logger
 
@@ -302,12 +308,14 @@ def process_it(changes_file):
         action(u)
 
     except (SystemExit, KeyboardInterrupt):
+        cleanup()
         raise
 
     except:
         print "ERROR"
         traceback.print_exc(file=sys.stderr)
 
+    cleanup()
     # Restore previous WD
     os.chdir(u.prevdir)
 
index 2b86d4ccf3035551b86a7574ab3f8c4d162ae0dd..bb62aaeee273c506502fef112218ac61dfb3321a 100755 (executable)
@@ -2006,15 +2006,21 @@ distribution."""
     def remove(self, from_dir=None):
         """
         Used (for instance) in p-u to remove the package from unchecked
+
+        Also removes the package from holding area.
         """
         if from_dir is None:
-            os.chdir(self.pkg.directory)
-        else:
-            os.chdir(from_dir)
+            from_dir = self.pkg.directory
+        h = Holding()
 
         for f in self.pkg.files.keys():
-            os.unlink(f)
-        os.unlink(self.pkg.changes_file)
+            os.unlink(os.path.join(from_dir, f))
+            if os.path.exists(os.path.join(h.holding_dir, f)):
+                os.unlink(os.path.join(h.holding_dir, f))
+                          
+        os.unlink(os.path.join(from_dir, self.pkg.changes_file))
+        if os.path.exists(os.path.join(h.holding_dir, self.pkg.changes_file)):
+            os.unlink(os.path.join(h.holding_dir, self.pkg.changes_file))
 
     ###########################################################################
 
@@ -2022,9 +2028,11 @@ distribution."""
         """
         Move files to dest with certain perms/changesperms
         """
-        utils.move(self.pkg.changes_file, dest, perms=changesperms)
+        h = Holding()
+        utils.move(os.path.join(h.holding_dir, self.pkg.changes_file),
+                   dest, perms=changesperms)
         for f in self.pkg.files.keys():
-            utils.move(f, dest, perms=perms)
+            utils.move(os.path.join(h.holding_dir, f), dest, perms=perms)
 
     ###########################################################################