From: Joerg Jaspert Date: Sat, 2 Jan 2016 13:34:47 +0000 (+0100) Subject: Merge remote-tracking branch 'DktrKranz/fixes' X-Git-Url: https://git.decadent.org.uk/gitweb/?p=dak.git;a=commitdiff_plain;h=09f7332ebb3ffd99a8758160c62eeb4f969d24b1;hp=813801add25896afc4bd9839f5d1fe0c05eea465 Merge remote-tracking branch 'DktrKranz/fixes' * DktrKranz/fixes: Removal dep check only considers latest sources (Closes: #792578) Allow closing bugs if more than one source version is available. Signed-off-by: Joerg Jaspert --- diff --git a/daklib/rm.py b/daklib/rm.py index e6940d53..db1d907f 100644 --- a/daklib/rm.py +++ b/daklib/rm.py @@ -524,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: @@ -541,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() diff --git a/daklib/utils.py b/daklib/utils.py index cdec3a77..9d45cdc8 100644 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -1256,7 +1256,7 @@ def check_reverse_depends(removals, suite, arches=None, session=None, cruft=Fals FROM source s JOIN source_metadata sm ON s.id = sm.src_id WHERE s.id in - (SELECT source FROM src_associations + (SELECT src FROM newest_src_association WHERE suite = :suite_id) AND sm.key_id in :metakey_ids GROUP BY s.id, s.source'''