Make "Keep-installable" constraints overrule nuninst counters

If there is a regression in "present-and-installable" constraints (on
non-break architectures), then discard the item even if the nuninst
counters have improved.

Signed-off-by: Niels Thykier <niels@thykier.net>
master
Niels Thykier 8 years ago
parent f3e37faf7e
commit 7ccbfe2fdf

@ -506,6 +506,10 @@ class Britney(object):
no = 0
faux_version = sys.intern('1')
faux_section = sys.intern('faux')
keep_installable = []
constraints = {
'keep-installable': keep_installable
}
while step():
no += 1
@ -535,6 +539,7 @@ class Britney(object):
]
self.sources['testing'][pkg_name] = src_data
self.sources['unstable'][pkg_name] = src_data
keep_installable.append(pkg_name)
for arch in self.options.architectures:
deps = []
for pkg_spec in pkg_list:
@ -573,6 +578,8 @@ class Britney(object):
self.binaries['unstable'][arch][0][pkg_name] = bin_data
self.all_binaries[pkg_id] = bin_data
return constraints
def _build_installability_tester(self, archs):
"""Create the installability tester"""
@ -2258,6 +2265,7 @@ class Britney(object):
# removed by the item would still be counted.
nuninst_after = clone_nuninst(nuninst_now, packages_t, affected_architectures)
must_be_installable = self.constraints['keep-installable']
# check the affected packages on all the architectures
for arch in affected_architectures:
@ -2267,10 +2275,17 @@ class Britney(object):
check_archall, nuninst_after)
# if the uninstallability counter is worse than before, break the loop
if automatic_revert and len(nuninst_after[arch]) > len(nuninst_now[arch]):
if automatic_revert:
worse = False
if len(nuninst_after[arch]) > len(nuninst_now[arch]):
worse = True
else:
regression = nuninst_after[arch] - nuninst_now[arch]
if not regression.isdisjoint(must_be_installable):
worse = True
# ... except for a few special cases
if (item.architecture != 'source' and arch not in new_arches) or \
(arch not in break_arches):
if worse and ((item.architecture != 'source' and arch not in new_arches) or
(arch not in break_arches)):
is_accepted = False
break
@ -2446,7 +2461,8 @@ class Britney(object):
# do not allow any regressions on these architectures.
# This usually only happens with hints
break_arches = set()
better = is_nuninst_asgood_generous(self.options.architectures,
better = is_nuninst_asgood_generous(self.constraints,
self.options.architectures,
self.nuninst_orig,
nuninst_end,
break_arches)

@ -488,17 +488,21 @@ def old_libraries(sources, packages, fucked_arches=frozenset()):
return removals
def is_nuninst_asgood_generous(architectures, old, new, break_arches=frozenset()):
"""Compares the nuninst counters to see if they improved
def is_nuninst_asgood_generous(constraints, architectures, old, new, break_arches=frozenset()):
"""Compares the nuninst counters and constraints to see if they improved
Given a list of architecters, the previous and the current nuninst
Given a list of architectures, the previous and the current nuninst
counters, this function determines if the current nuninst counter
is better than the previous one. Optionally it also accepts a set
of "break_arches", the nuninst counter for any architecture listed
in this set are completely ignored.
If the nuninst counters are equal or better, then the constraints
are checked for regressions (ignoring break_arches).
Returns True if the new nuninst counter is better than the
previous. Returns False otherwise.
previous and there are no constraint regressions (ignoring Break-archs).
Returns False otherwise.
"""
diff = 0
@ -506,7 +510,16 @@ def is_nuninst_asgood_generous(architectures, old, new, break_arches=frozenset()
if arch in break_arches:
continue
diff = diff + (len(new[arch]) - len(old[arch]))
return diff <= 0
if diff > 0:
return False
must_be_installable = constraints['keep-installable']
for arch in architectures:
if arch in break_arches:
continue
regression = new[arch] - old[arch]
if not regression.isdisjoint(must_be_installable):
return False
return True
def clone_nuninst(nuninst, packages_s, architectures):

Loading…
Cancel
Save