]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/rm.py
Merge remote-tracking branch 'dktrkranz/fixes'
[dak.git] / daklib / rm.py
index 3a0a8f43542929a1e50c5945c7fc084119db2fa4..e6940d53de99fce1268c2588842ddc04cdcb346d 100644 (file)
@@ -41,6 +41,7 @@
 
 import commands
 import apt_pkg
+import fcntl
 from re import sub
 from collections import defaultdict
 from regexes import re_build_dep_arch
@@ -371,7 +372,7 @@ def remove(session, reason, suites, removals,
     if date is None:
         date = commands.getoutput("date -R")
 
-    if partial:
+    if partial and components:
 
         component_ids_list = []
         for componentname in components:
@@ -423,6 +424,9 @@ def remove(session, reason, suites, removals,
     log_filename = cnf["Rm::LogFile"]
     log822_filename = cnf["Rm::LogFile822"]
     with utils.open_file(log_filename, "a") as logfile, utils.open_file(log822_filename, "a") as logfile822:
+        fcntl.lockf(logfile, fcntl.LOCK_EX)
+        fcntl.lockf(logfile822, fcntl.LOCK_EX)
+
         logfile.write("=========================================================================\n")
         logfile.write("[Date: %s] [ftpmaster: %s]\n" % (date, whoami))
         logfile.write("Removed the following packages from %s:\n\n%s" % (suites_list, summary))
@@ -461,7 +465,7 @@ def remove(session, reason, suites, removals,
                     session.execute("DELETE FROM bin_associations WHERE bin = :packageid AND suite = :suiteid",
                                     {'packageid': package_id, 'suiteid': suite_id})
                 # Delete from the override file
-                if partial:
+                if not partial:
                     if architecture == "source":
                         type_id = dsc_type_id
                     else: