mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-05 03:38:12 +08:00
Call _get_base_module_stream_overrides when the module is not the input module
This just simplifies the code. It doesn't change the functionality at all. The tests had to be changed because it assumed that the xmd.mbs.buildrequires section would be filled out for the input module which isn't true.
This commit is contained in:
@@ -306,8 +306,6 @@ class MMDResolver(object):
|
||||
for dep in mmd.get_dependencies()
|
||||
]
|
||||
|
||||
base_module_stream_overrides = self._get_base_module_stream_overrides(mmd)
|
||||
|
||||
# Each solvable object has name, version, architecture and list of
|
||||
# provides/requires/conflicts which defines its relations with other solvables.
|
||||
# You can imagine solvable as a single RPM.
|
||||
@@ -340,6 +338,7 @@ class MMDResolver(object):
|
||||
|
||||
self._add_base_module_provides(solvable, mmd)
|
||||
|
||||
base_module_stream_overrides = self._get_base_module_stream_overrides(mmd)
|
||||
# Fill in the "Requires" of this module, so we can track its dependencies
|
||||
# on other modules.
|
||||
requires = self._deps2reqs(
|
||||
@@ -403,7 +402,7 @@ class MMDResolver(object):
|
||||
solvable.evr = str(v)
|
||||
solvable.arch = "src"
|
||||
|
||||
requires = self._deps2reqs([normalized_deps[c]], base_module_stream_overrides)
|
||||
requires = self._deps2reqs([normalized_deps[c]])
|
||||
log.debug("Adding module %s with requires: %r", solvable.name, requires)
|
||||
solvable.add_deparray(solv.SOLVABLE_REQUIRES, requires)
|
||||
|
||||
|
||||
@@ -194,12 +194,11 @@ class TestMMDResolver:
|
||||
assert expanded == expected
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"buildrequires, xmd_buildrequires, expected",
|
||||
"buildrequires, expected",
|
||||
(
|
||||
# BR all platform streams -> build for all platform streams.
|
||||
(
|
||||
{"platform": []},
|
||||
{},
|
||||
[
|
||||
[
|
||||
["platform:el8.2.0.z:0:c0:x86_64"],
|
||||
@@ -212,7 +211,6 @@ class TestMMDResolver:
|
||||
# BR "el8" platform stream -> build for all el8 platform streams.
|
||||
(
|
||||
{"platform": ["el8"]},
|
||||
{},
|
||||
[
|
||||
[
|
||||
["platform:el8.2.0.z:0:c0:x86_64"],
|
||||
@@ -221,21 +219,19 @@ class TestMMDResolver:
|
||||
]
|
||||
],
|
||||
),
|
||||
# BR "el8.1.0" platfrom stream -> build just for el8.1.0.
|
||||
({"platform": ["el8"]}, ["platform:el8.1.0"], [[["platform:el8.1.0:0:c0:x86_64"]]]),
|
||||
# BR "el8.1.0" platform stream -> build just for el8.1.0.
|
||||
({"platform": ["el8.1.0"]}, [[["platform:el8.1.0:0:c0:x86_64"]]]),
|
||||
# BR platform:el8.1.0 and gtk:3, which is not built against el8.1.0,
|
||||
# but it is built only against el8.0.0 -> cherry-pick gtk:3 from el8.0.0
|
||||
# and build once against platform:el8.1.0.
|
||||
(
|
||||
{"platform": ["el8"], "gtk": ["3"]},
|
||||
["platform:el8.1.0"],
|
||||
{"platform": ["el8.1.0"], "gtk": ["3"]},
|
||||
[[["platform:el8.1.0:0:c0:x86_64", "gtk:3:0:c8:x86_64"]]],
|
||||
),
|
||||
# BR platform:el8.2.0 and gtk:3, this time gtk:3 build against el8.2.0 exists
|
||||
# -> use both platform and gtk from el8.2.0 and build once.
|
||||
(
|
||||
{"platform": ["el8"], "gtk": ["3"]},
|
||||
["platform:el8.2.0.z"],
|
||||
{"platform": ["el8.2.0.z"], "gtk": ["3"]},
|
||||
[[["platform:el8.2.0.z:0:c0:x86_64", "gtk:3:1:c8:x86_64"]]],
|
||||
),
|
||||
# BR platform:el8.2.0 and mess:1 which is built against platform:el8.1.0 and
|
||||
@@ -244,8 +240,7 @@ class TestMMDResolver:
|
||||
# -> cherry-pick mess:1 from el8.1.0 and
|
||||
# -> use gtk:3:1 from el8.2.0.
|
||||
(
|
||||
{"platform": ["el8"], "mess": ["1"]},
|
||||
["platform:el8.2.0.z"],
|
||||
{"platform": ["el8.2.0.z"], "mess": ["1"]},
|
||||
[[["platform:el8.2.0.z:0:c0:x86_64", "mess:1:0:c0:x86_64", "gtk:3:1:c8:x86_64"]]],
|
||||
),
|
||||
# BR platform:el8.1.0 and mess:1 which is built against platform:el8.1.0 and
|
||||
@@ -254,14 +249,13 @@ class TestMMDResolver:
|
||||
# -> Used mess:1 from el8.1.0 and
|
||||
# -> cherry-pick gtk:3:0 from el8.0.0.
|
||||
(
|
||||
{"platform": ["el8"], "mess": ["1"]},
|
||||
["platform:el8.1.0"],
|
||||
{"platform": ["el8.1.0"], "mess": ["1"]},
|
||||
[[["platform:el8.1.0:0:c0:x86_64", "mess:1:0:c0:x86_64", "gtk:3:0:c8:x86_64"]]],
|
||||
),
|
||||
# BR platform:el8.0.0 and mess:1 which is built against platform:el8.1.0 and
|
||||
# requires gtk:3 which is built against platform:el8.2.0 and platform:el8.0.0
|
||||
# -> No valid combination, because mess:1 is only available in el8.1.0 and later.
|
||||
({"platform": ["el8"], "mess": ["1"]}, ["platform:el8.0.0"], []),
|
||||
({"platform": ["el8.0.0"], "mess": ["1"]}, []),
|
||||
# This is undefined... it might build just once against latest platform or
|
||||
# against all the platforms... we don't know
|
||||
# ({"platform": ["el8"], "gtk": ["3"]}, {}, [
|
||||
@@ -269,7 +263,7 @@ class TestMMDResolver:
|
||||
# ]),
|
||||
),
|
||||
)
|
||||
def test_solve_virtual_streams(self, buildrequires, xmd_buildrequires, expected):
|
||||
def test_solve_virtual_streams(self, buildrequires, expected):
|
||||
modules = (
|
||||
# (nsvc, buildrequires, expanded_buildrequires, virtual_streams)
|
||||
("platform:el8.0.0:0:c0", {}, {}, ["el8"]),
|
||||
@@ -283,7 +277,7 @@ class TestMMDResolver:
|
||||
for n, req, xmd_br, virtual_streams in modules:
|
||||
self.mmd_resolver.add_modules(self._make_mmd(n, req, xmd_br, virtual_streams))
|
||||
|
||||
app = self._make_mmd("app:1:0", buildrequires, xmd_buildrequires)
|
||||
app = self._make_mmd("app:1:0", buildrequires)
|
||||
if not expected:
|
||||
with pytest.raises(RuntimeError):
|
||||
self.mmd_resolver.solve(app)
|
||||
|
||||
Reference in New Issue
Block a user