X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Frm.py;h=db1d907fe03ad893de0d0a482d701fe207fa651e;hb=b25cecbb775a122845e02506657509480834901f;hp=3a0a8f43542929a1e50c5945c7fc084119db2fa4;hpb=73ed1d296cb8843fbceb90c7f17f79070e461fbe;p=dak.git diff --git a/daklib/rm.py b/daklib/rm.py index 3a0a8f43..db1d907f 100644 --- a/daklib/rm.py +++ b/daklib/rm.py @@ -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: @@ -520,16 +524,26 @@ def remove(session, reason, suites, removals, # close associated bug reports if close_related_bugs: + latest_version = '' Subst_close_other = Subst_common bcc = [] wnpp = utils.parse_wnpp_bug_file() versions = list(set([re_bin_only_nmu.sub('', v) for v in versions])) - if len(versions) == 1: - Subst_close_other["__VERSION__"] = versions[0] + if len(set(s.split("_", 1)[0] for s in sources)) == 1: + source_pkg = source.split("_", 1)[0] + else: + logfile.write("=========================================================================\n") + logfile822.write("\n") + raise ValueError("Closing bugs for multiple source packages is not supported. Please do it yourself.") + for version in versions: + if apt_pkg.version_compare(version, latest_version) > 0: + latest_version = version + if latest_version != '': + Subst_close_other["__VERSION__"] = latest_version else: logfile.write("=========================================================================\n") logfile822.write("\n") - raise ValueError("Closing bugs with multiple package versions is not supported. Do it yourself.") + raise ValueError("No versions can be found. Close bugs yourself.") if bcc: Subst_close_other["__BCC__"] = "Bcc: " + ", ".join(bcc) else: @@ -537,12 +551,6 @@ def remove(session, reason, suites, removals, # at this point, I just assume, that the first closed bug gives # some useful information on why the package got removed Subst_close_other["__BUG_NUMBER__"] = done_bugs[0] - if len(sources) == 1: - source_pkg = source.split("_", 1)[0] - else: - logfile.write("=========================================================================\n") - logfile822.write("\n") - raise ValueError("Closing bugs for multiple source packages is not supported. Please do it yourself.") Subst_close_other["__BUG_NUMBER_ALSO__"] = "" Subst_close_other["__SOURCE__"] = source_pkg merged_bugs = set()