mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-21 15:31:31 +00:00
Make clone_nuninst able to fully deep clone nuninst
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
bd0a96553c
commit
7bcbcb6282
@ -2161,7 +2161,7 @@ class Britney(object):
|
|||||||
# removed binaries. Otherwise, uninstallable binaries that were
|
# removed binaries. Otherwise, uninstallable binaries that were
|
||||||
# removed by the item would still be counted.
|
# removed by the item would still be counted.
|
||||||
|
|
||||||
nuninst_after = clone_nuninst(nuninst_now, packages_t, affected_architectures)
|
nuninst_after = clone_nuninst(nuninst_now, packages_s=packages_t, architectures=affected_architectures)
|
||||||
must_be_installable = self.constraints['keep-installable']
|
must_be_installable = self.constraints['keep-installable']
|
||||||
|
|
||||||
# check the affected packages on all the architectures
|
# check the affected packages on all the architectures
|
||||||
|
@ -537,18 +537,28 @@ def is_nuninst_asgood_generous(constraints, architectures, old, new, break_arche
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def clone_nuninst(nuninst, packages_s, architectures):
|
def clone_nuninst(nuninst, *, packages_s=None, architectures=None):
|
||||||
"""Selectively deep clone nuninst
|
"""Completely or Selectively deep clone nuninst
|
||||||
|
|
||||||
Given nuninst table, the package table for a given suite and
|
Given nuninst table, the package table for a given suite and
|
||||||
a list of architectures, this function will clone the nuninst
|
a list of architectures, this function will clone the nuninst
|
||||||
table. Only the listed architectures will be deep cloned -
|
table. Only the listed architectures will be deep cloned -
|
||||||
the rest will only be shallow cloned.
|
the rest will only be shallow cloned. When packages_s is given,
|
||||||
|
packages not listed in packages_s will be pruned from the clone
|
||||||
|
(if packages_s is omitted, the per architecture nuninst is cloned
|
||||||
|
as-is)
|
||||||
"""
|
"""
|
||||||
clone = nuninst.copy()
|
clone = nuninst.copy()
|
||||||
|
if architectures is None:
|
||||||
|
return clone
|
||||||
|
if packages_s is not None:
|
||||||
for arch in architectures:
|
for arch in architectures:
|
||||||
clone[arch] = set(x for x in nuninst[arch] if x in packages_s[arch])
|
clone[arch] = set(x for x in nuninst[arch] if x in packages_s[arch])
|
||||||
clone[arch + "+all"] = set(x for x in nuninst[arch + "+all"] if x in packages_s[arch])
|
clone[arch + "+all"] = set(x for x in nuninst[arch + "+all"] if x in packages_s[arch])
|
||||||
|
else:
|
||||||
|
for arch in architectures:
|
||||||
|
clone[arch] = set(nuninst[arch])
|
||||||
|
clone[arch + "+all"] = set(nuninst[arch + "+all"])
|
||||||
return clone
|
return clone
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user