From 65f327aa7456cf6016e715302e4e509f456b1049 Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Mon, 6 Jul 2020 16:34:33 +0100 Subject: [PATCH] suiteloader: Handle NBS If we have this situation - Binary in target taken over by new source - Not cleaned up yet - New source updated in source suite We can have *three* copies of a source package visible to britney at once. Handle this case by recording the source package a pkgid was seen in before. --- britney2/inputs/suiteloader.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/britney2/inputs/suiteloader.py b/britney2/inputs/suiteloader.py index f65e996..c609f99 100644 --- a/britney2/inputs/suiteloader.py +++ b/britney2/inputs/suiteloader.py @@ -294,6 +294,8 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader): if packages is None: packages = {} + added_old_binaries = {} + all_binaries = self._all_binaries tag_file = apt_pkg.TagFile(filename) @@ -319,7 +321,15 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader): continue old_pkg_id = old_pkg_data.pkg_id old_src_binaries = srcdist[old_pkg_data.source].binaries - old_src_binaries.remove(old_pkg_id) + + prev_src = added_old_binaries.get(old_pkg_id, old_pkg_data.source) + ps = srcdist[prev_src] + ps.binaries.remove(old_pkg_id) + try: + del added_old_binaries[old_pkg_id] + except KeyError: + pass + # This may seem weird at first glance, but the current code rely # on this behaviour to avoid issues like #709460. Admittedly it # is a special case, but Britney will attempt to remove the @@ -328,6 +338,7 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader): # and the version, so it is not particularly resilient. if pkg_id not in old_src_binaries: old_src_binaries.add(pkg_id) + added_old_binaries[pkg_id] = old_pkg_data.source # Merge Pre-Depends with Depends and Conflicts with # Breaks. Britney is not interested in the "finer