[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Patch] britney.py: Fix a regression in nuninst counting for hints



Hi,

Find attached patch that fixes a minor regression introduced in commit
a46dd88 by yours truly.  I intend to merge into master in a couple of
days if no one beats me to it.  I have added a new test case
(regression-a46dd88) for the particular patch.

The regression causes certain (unlikely) hints (easy or hint-hints) to
fail, where Britney2 prior to commit a46dd88 would have accepted them.
I consider these to be unlikely because:

 * They must involve an uninstallability trade[1] during the "init" run
   (i.e. the "non-recurse" run)
   - The "recurse run" is unaffected by this bug.
 * They must be removing uninstallable packages and use said removal to
   complete the uninstallability trade.
   - Only removals of uninstallable packages could cause this.
   - *NB*: The binary had to disappear from testing.  If it was simply
     upgraded, it would not trigger the bug.



The regression was caused by Britney failing to remove packages from
"nuninst", when they were removed from testing.  For hints removing an
uninstallable package without using uninstallability trading, Britney
simply presents a slightly inflated nuninst counter until the end of the
run.

~Niels

[1] "uninstallability trade" being trading one uninstallability package
for another.
>From 97fcba644c250e84e6a0ea2164a0e886d946ada9 Mon Sep 17 00:00:00 2001
From: Niels Thykier <niels@thykier.net>
Date: Wed, 6 Aug 2014 23:15:39 +0200
Subject: [PATCH] britney.py: Fix a regression in nuninst counting for hints

In the rare case that a hint removed an uninstallable binary, the
binary could still be included in the nuninst counter.

Regression introduced in a46dd88.

Signed-off-by: Niels Thykier <niels@thykier.net>
---
 britney.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/britney.py b/britney.py
index da0f158..6c0a26d 100755
--- a/britney.py
+++ b/britney.py
@@ -2147,8 +2147,7 @@ class Britney(object):
         nobreakall_arches = self.options.nobreakall_arches.split()
         binaries_t = self.binaries['testing']
         check_packages = partial(self._check_packages, binaries_t)
-        # Deep copy nuninst (in case the hint is undone)
-        nuninst = {k:v.copy() for k,v in self.nuninst_orig.iteritems()}
+        nuninst = {}
 
 
         for item in hinted_packages:
@@ -2165,6 +2164,16 @@ class Britney(object):
             if lundo is not None:
                 lundo.append((undo,item))
 
+        # deep copy nuninst (in case the hint is undone)
+        # NB: We do this *after* updating testing and we have to filter out
+        # removed binaries.  Otherwise, uninstallable binaries that were
+        # removed by the hint would still be counted.
+        for arch in self.options.architectures:
+            nuninst_arch = self.nuninst_orig[arch]
+            nuninst_arch_all = self.nuninst_orig[arch + '+all']
+            nuninst[arch] = set(x for x in nuninst_arch if x in binaries_t[arch])
+            nuninst[arch + '+all'] = set(x for x in nuninst_arch_all if x in binaries_t[arch])
+
         for arch in self.options.architectures:
             if arch not in nobreakall_arches:
                 skip_archall = True
-- 
2.1.0.rc1


Reply to: