Let the BinaryPackageUniverse track essential packages

Signed-off-by: Niels Thykier <niels@thykier.net>
ubuntu/rebased
Niels Thykier 6 years ago
parent 07a407e810
commit 8867ef0cf9
No known key found for this signature in database
GPG Key ID: A65B78DBE67C7AAC

@ -308,12 +308,11 @@ class InstallabilityTesterBuilder(object):
relations, eqv_table = self._build_eqv_packages_table(package_table, reverse_package_table)
universe = BinaryPackageUniverse(relations)
universe = BinaryPackageUniverse(relations, intern_set(self._essentials))
solver = InstallabilityTester(universe,
self._testing,
self._broken,
self._essentials,
eqv_table)
return universe, solver

@ -22,7 +22,7 @@ from britney2.utils import iter_except
class InstallabilityTester(object):
def __init__(self, universe, testing, broken, essentials, eqv_table):
def __init__(self, universe, testing, broken, eqv_table):
"""Create a new installability tester
universe is a BinaryPackageUniverse
@ -33,8 +33,6 @@ class InstallabilityTester(object):
broken is a (mutable) set of package ids that are known to
be uninstallable.
essentials is a set of packages with "Essential: yes".
Package id: (pkg_name, pkg_version, pkg_arch)
- NB: arch:all packages are "re-mapped" to given architecture.
(simplifies caches and dependency checking)
@ -43,7 +41,6 @@ class InstallabilityTester(object):
self._universe = universe
self._testing = testing
self._broken = broken
self._essentials = essentials
self._eqv_table = eqv_table
self._stats = InstallabilityStats()
logger_name = ".".join((self.__class__.__module__, self.__class__.__name__))
@ -136,7 +133,7 @@ class InstallabilityTester(object):
# Re-add broken packages as some of them may now be installable
self._testing |= self._cache_broken
self._cache_broken = set()
if pkg_id in self._essentials and pkg_id.architecture in self._cache_ess:
if pkg_id in self._universe.essential_packages and pkg_id.architecture in self._cache_ess:
# Adds new essential => "pseudo-essential" set needs to be
# recomputed
del self._cache_ess[pkg_id.architecture]
@ -519,7 +516,7 @@ class InstallabilityTester(object):
universe = self._universe
stats = self._stats
ess_base = [x for x in self._essentials if x.architecture == arch and x in testing]
ess_base = [x for x in self._universe.essential_packages if x.architecture == arch and x in testing]
start = set(ess_base)
ess_never = set()
ess_choices = set()

@ -38,8 +38,9 @@ class BinaryPackageUniverse(object):
in that suite?".
"""
def __init__(self, relations):
def __init__(self, relations, essential_packages):
self._relations = relations
self._essential_packages = essential_packages
def dependencies_of(self, pkg_id):
"""Returns the set of dependencies of a given package
@ -109,6 +110,15 @@ class BinaryPackageUniverse(object):
"""
return self._relations[pkg_id]
@property
def essential_packages(self):
"""A frozenset of all "Essential: yes" binaries in the universe
:return A frozenset of BinaryPackageIds of all binaries that are
marked as essential.
"""
return self._essential_packages
def __contains__(self, pkg_id):
return pkg_id in self._relations

Loading…
Cancel
Save