Fix projects_depsolve_with_size version globbing
Use a common _depsolve function for projects_depsolve and projects_depsolve_with_size so that it always uses the correct version glob support when depsolving blueprints and templates. Resolves: rhbz#1628114
This commit is contained in:
parent
f8f49159ad
commit
6fd0e71530
@ -208,8 +208,8 @@ def filterVersionGlob(pkgs, version):
|
||||
# yum implements __cmd__ using verCMP so this will return the highest matching version
|
||||
return max(matches)
|
||||
|
||||
def projects_depsolve(yb, projects, groups):
|
||||
"""Return the dependencies for a list of projects
|
||||
def _depsolve(yb, projects, groups):
|
||||
"""Find the dependencies for a list of projects and groups
|
||||
|
||||
:param yb: yum base object
|
||||
:type yb: YumBase
|
||||
@ -217,11 +217,10 @@ def projects_depsolve(yb, projects, groups):
|
||||
:type projects: List of tuples
|
||||
:param groups: The groups to include in dependency solving
|
||||
:type groups: List of str
|
||||
:returns: NEVRA's of the project and its dependencies
|
||||
:rtype: list of dicts
|
||||
:returns: A list of errors that were encountered while depsolving the packages
|
||||
:rtype: list of strings
|
||||
:raises: ProjectsError if there was a problem installing something
|
||||
"""
|
||||
try:
|
||||
# This resets the transaction
|
||||
yb.closeRpmDB()
|
||||
install_errors = []
|
||||
@ -248,6 +247,24 @@ def projects_depsolve(yb, projects, groups):
|
||||
except (YumBaseError, RuntimeError) as e:
|
||||
install_errors.append((pattern, str(e)))
|
||||
|
||||
return install_errors
|
||||
|
||||
def projects_depsolve(yb, projects, groups):
|
||||
"""Return the dependencies for a list of projects
|
||||
|
||||
:param yb: yum base object
|
||||
:type yb: YumBase
|
||||
:param projects: The projects and version globs to find the dependencies for
|
||||
:type projects: List of tuples
|
||||
:param groups: The groups to include in dependency solving
|
||||
:type groups: List of str
|
||||
:returns: NEVRA's of the project and its dependencies
|
||||
:rtype: list of dicts
|
||||
:raises: ProjectsError if there was a problem installing something
|
||||
"""
|
||||
try:
|
||||
install_errors = _depsolve(yb, projects, groups)
|
||||
|
||||
# Were there problems installing these packages?
|
||||
if install_errors:
|
||||
raise ProjectsError("The following package(s) had problems: %s" % ",".join(["%s (%s)" % (pattern, err) for pattern, err in install_errors]))
|
||||
@ -297,20 +314,7 @@ def projects_depsolve_with_size(yb, projects, groups, with_core=True):
|
||||
:raises: ProjectsError if there was a problem installing something
|
||||
"""
|
||||
try:
|
||||
# This resets the transaction
|
||||
yb.closeRpmDB()
|
||||
install_errors = []
|
||||
for name in groups:
|
||||
yb.selectGroup(name, ["mandatory", "default"])
|
||||
|
||||
for name, version in projects:
|
||||
if not version:
|
||||
version = "*"
|
||||
pattern = "%s-%s" % (name, version)
|
||||
try:
|
||||
yb.install(pattern=pattern)
|
||||
except YumBaseError as e:
|
||||
install_errors.append((pattern, str(e)))
|
||||
install_errors = _depsolve(yb, projects, groups)
|
||||
|
||||
# Were there problems installing these packages?
|
||||
if install_errors:
|
||||
|
Loading…
Reference in New Issue
Block a user