Support introspection typelibs, improve default tie breaking.
This commit is contained in:
parent
5f511b2b80
commit
ce3e477c4c
5 changed files with 31 additions and 5 deletions
|
@ -53,6 +53,7 @@ from buildlog_consultant.common import (
|
|||
MissingVagueDependency,
|
||||
DhAddonLoadFailure,
|
||||
MissingMavenArtifacts,
|
||||
MissingIntrospectionTypelib,
|
||||
GnomeCommonMissing,
|
||||
MissingGnomeCommonDependency,
|
||||
UnknownCertificateAuthority,
|
||||
|
@ -99,6 +100,7 @@ from .requirements import (
|
|||
X11Requirement,
|
||||
LibtoolRequirement,
|
||||
VagueDependencyRequirement,
|
||||
IntrospectionTypelibRequirement,
|
||||
)
|
||||
from .resolver import UnsatisfiedRequirements
|
||||
|
||||
|
@ -112,6 +114,8 @@ def problem_to_upstream_requirement(problem): # noqa: C901
|
|||
return PkgConfigRequirement(problem.module, problem.minimum_version)
|
||||
elif isinstance(problem, MissingCHeader):
|
||||
return CHeaderRequirement(problem.header)
|
||||
elif isinstance(problem, MissingIntrospectionTypelib):
|
||||
return IntrospectionTypelibRequirement(problem.library)
|
||||
elif isinstance(problem, MissingJavaScriptRuntime):
|
||||
return JavaScriptRuntimeRequirement()
|
||||
elif isinstance(problem, MissingRubyGem):
|
||||
|
|
|
@ -65,9 +65,9 @@ class BuildDependencyTieBreaker(object):
|
|||
return None
|
||||
top = max(by_count.items(), key=lambda k: k[1])
|
||||
logging.info(
|
||||
"Breaking tie between %r to %r based on build-depends count",
|
||||
[repr(r) for r in reqs],
|
||||
top[0],
|
||||
"Breaking tie between [%s] to %s based on build-depends count",
|
||||
', '.join([repr(r.pkg_relation_str()) for r in reqs]),
|
||||
repr(top[0].pkg_relation_str()),
|
||||
)
|
||||
return top[0]
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ class AptFileFileSearcher(FileSearcher):
|
|||
@classmethod
|
||||
def has_cache(cls, session: Session) -> bool:
|
||||
if not os.path.exists(session.external_path(cls.CACHE_IS_EMPTY_PATH)):
|
||||
return True
|
||||
return False
|
||||
try:
|
||||
session.check_call([cls.CACHE_IS_EMPTY_PATH])
|
||||
except subprocess.CalledProcessError as e:
|
||||
|
|
|
@ -587,6 +587,11 @@ class LibtoolRequirement(Requirement):
|
|||
super(LibtoolRequirement, self).__init__("libtool")
|
||||
|
||||
|
||||
class IntrospectionTypelibRequirement(Requirement):
|
||||
def __init__(self, library):
|
||||
self.library = library
|
||||
|
||||
|
||||
class PythonModuleRequirement(Requirement):
|
||||
|
||||
module: str
|
||||
|
|
|
@ -68,6 +68,7 @@ from ..requirements import (
|
|||
CertificateAuthorityRequirement,
|
||||
LibtoolRequirement,
|
||||
VagueDependencyRequirement,
|
||||
IntrospectionTypelibRequirement,
|
||||
)
|
||||
|
||||
|
||||
|
@ -620,6 +621,12 @@ def resolve_ca_req(apt_mgr, req):
|
|||
return [AptRequirement.simple("ca-certificates")]
|
||||
|
||||
|
||||
def resolve_introspection_typelib_req(apt_mgr, req):
|
||||
return find_reqs_simple(
|
||||
apt_mgr, ['/usr/lib/.*/girepository-.*/%s-.*\.typelib' % re.escape(req.library)],
|
||||
regex=True)
|
||||
|
||||
|
||||
def resolve_apt_req(apt_mgr, req):
|
||||
# TODO(jelmer): This should be checking whether versions match as well.
|
||||
for package_name in req.package_names():
|
||||
|
@ -668,6 +675,7 @@ APT_REQUIREMENT_RESOLVERS = [
|
|||
(PythonPackageRequirement, resolve_python_package_req),
|
||||
(CertificateAuthorityRequirement, resolve_ca_req),
|
||||
(CargoCrateRequirement, resolve_cargo_crate_req),
|
||||
(IntrospectionTypelibRequirement, resolve_introspection_typelib_req),
|
||||
]
|
||||
|
||||
|
||||
|
@ -683,11 +691,20 @@ def resolve_requirement_apt(apt_mgr, req: Requirement) -> List[AptRequirement]:
|
|||
raise NotImplementedError(type(req))
|
||||
|
||||
|
||||
def default_tie_breakers(session):
|
||||
from ..debian.udd import popcon_tie_breaker
|
||||
from ..debian.build_deps import BuildDependencyTieBreaker
|
||||
return [
|
||||
BuildDependencyTieBreaker.from_session(session),
|
||||
popcon_tie_breaker,
|
||||
]
|
||||
|
||||
|
||||
class AptResolver(Resolver):
|
||||
def __init__(self, apt, tie_breakers=None):
|
||||
self.apt = apt
|
||||
if tie_breakers is None:
|
||||
tie_breakers = []
|
||||
tie_breakers = default_tie_breakers(apt.session)
|
||||
self.tie_breakers = tie_breakers
|
||||
|
||||
def __str__(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue