|
|
|
@ -737,16 +737,23 @@ def read_sources_file(filename, sources=None, intern=sys.intern):
|
|
|
|
|
return sources
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_dependency_solvers(block, binaries_s_a, provides_s_a, *, empty_set=frozenset()):
|
|
|
|
|
def get_dependency_solvers(block, binaries_s_a, provides_s_a, *, build_depends=False, empty_set=frozenset()):
|
|
|
|
|
"""Find the packages which satisfy a dependency block
|
|
|
|
|
|
|
|
|
|
This method returns the list of packages which satisfy a dependency
|
|
|
|
|
block (as returned by apt_pkg.parse_depends) in a package table
|
|
|
|
|
for a given suite and architecture (a la self.binaries[suite][arch])
|
|
|
|
|
|
|
|
|
|
:param block: The dependency block as parsed by apt_pkg.parse_depends
|
|
|
|
|
It can also handle build-dependency relations if the named parameter
|
|
|
|
|
"build_depends" is set to True. In this case, block should be based
|
|
|
|
|
on the return value from apt_pkg.parse_src_depends.
|
|
|
|
|
|
|
|
|
|
:param block: The dependency block as parsed by apt_pkg.parse_depends (or apt_pkg.parse_src_depends
|
|
|
|
|
if the "build_depends" is True)
|
|
|
|
|
:param binaries_s_a: A dict mapping package names to the relevant BinaryPackage
|
|
|
|
|
:param provides_s_a: A dict mapping package names to their providers (as generated by parse_provides)
|
|
|
|
|
:param build_depends: If True, treat the "block" parameter as a build-dependency relation rather than
|
|
|
|
|
a regular dependency relation.
|
|
|
|
|
:param empty_set: Internal implementation detail / optimisation
|
|
|
|
|
:return a list of package names solving the relation
|
|
|
|
|
"""
|
|
|
|
@ -765,8 +772,18 @@ def get_dependency_solvers(block, binaries_s_a, provides_s_a, *, empty_set=froze
|
|
|
|
|
# check the versioned dependency and architecture qualifier
|
|
|
|
|
# (if present)
|
|
|
|
|
if (op == '' and version == '') or apt_pkg.check_dep(package.version, op, version):
|
|
|
|
|
if archqual is None or (archqual == 'any' and package.multi_arch == 'allowed'):
|
|
|
|
|
if archqual is None:
|
|
|
|
|
packages.append(name)
|
|
|
|
|
elif build_depends:
|
|
|
|
|
# Multi-arch handling for build-dependencies
|
|
|
|
|
# - :native is ok iff the target is arch:any
|
|
|
|
|
if archqual == 'native' and package.architecture != 'all':
|
|
|
|
|
packages.append(name)
|
|
|
|
|
else:
|
|
|
|
|
# Multi-arch handling for regular dependencies
|
|
|
|
|
# - :any is ok iff the target has "M-A: allowed"
|
|
|
|
|
if archqual == 'any' and package.multi_arch == 'allowed':
|
|
|
|
|
packages.append(name)
|
|
|
|
|
|
|
|
|
|
# look for the package in the virtual packages list and loop on them
|
|
|
|
|
for prov, prov_version in provides_s_a.get(name, empty_set):
|
|
|
|
|