mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-13 21:20:04 +08:00
Remove handling of negative deps in _deps2reqs
Fixes #1338 Signed-off-by: Chenxiong Qi <cqi@redhat.com>
This commit is contained in:
@@ -126,8 +126,7 @@ class MMDResolver(object):
|
||||
|
||||
# The req_pos will store solv.Dep expression for "positive" requirements.
|
||||
# That is the case of 'gtk': ['1', '2'].
|
||||
# The req_neg will store negative requirements like 'gtk': ['-1', '-2'].
|
||||
req_pos = req_neg = None
|
||||
req_pos = None
|
||||
|
||||
# For each stream in `streams` for this dependency, generate the
|
||||
# module(name:stream) solv.Dep and add REL_OR relations between them.
|
||||
@@ -145,12 +144,7 @@ class MMDResolver(object):
|
||||
stream_version_str = str(
|
||||
ModuleBuild.get_stream_version(stream_for_version, right_pad=False))
|
||||
if len(stream_version_str) < 5:
|
||||
if stream.startswith("-"):
|
||||
req_neg = rel_or_dep(
|
||||
req_neg, solv.REL_OR, stream_dep(name, stream[1:])
|
||||
)
|
||||
else:
|
||||
req_pos = rel_or_dep(req_pos, solv.REL_OR, stream_dep(name, stream))
|
||||
req_pos = rel_or_dep(req_pos, solv.REL_OR, stream_dep(name, stream))
|
||||
else:
|
||||
# The main reason why to use `exact_versions` is the case when
|
||||
# adding deps for the input module we want to resolve. This module
|
||||
@@ -179,33 +173,19 @@ class MMDResolver(object):
|
||||
version = ModuleBuild.get_stream_version(
|
||||
stream_for_version, right_pad=False
|
||||
)
|
||||
if stream.startswith("-"):
|
||||
req_neg = rel_or_dep(
|
||||
req_neg,
|
||||
solv.REL_OR,
|
||||
versioned_stream_dep(name, stream[1:], version, op),
|
||||
)
|
||||
else:
|
||||
req_pos = rel_or_dep(
|
||||
req_pos,
|
||||
solv.REL_OR,
|
||||
versioned_stream_dep(name, stream, version, op),
|
||||
)
|
||||
req_pos = rel_or_dep(
|
||||
req_pos,
|
||||
solv.REL_OR,
|
||||
versioned_stream_dep(name, stream, version, op),
|
||||
)
|
||||
else:
|
||||
if stream.startswith("-"):
|
||||
req_neg = rel_or_dep(req_neg, solv.REL_OR, stream_dep(name, stream[1:]))
|
||||
else:
|
||||
req_pos = rel_or_dep(req_pos, solv.REL_OR, stream_dep(name, stream))
|
||||
req_pos = rel_or_dep(req_pos, solv.REL_OR, stream_dep(name, stream))
|
||||
|
||||
# Generate the module(name) solv.Dep.
|
||||
req = pool.Dep("module(%s)" % name)
|
||||
|
||||
# Use the REL_WITH for positive requirements and REL_WITHOUT for negative
|
||||
# requirements.
|
||||
if req_pos is not None:
|
||||
req = req.Rel(solv.REL_WITH, req_pos)
|
||||
elif req_neg is not None:
|
||||
req = req.Rel(solv.REL_WITHOUT, req_neg)
|
||||
|
||||
# And in the end use AND between the last name:[streams] and the current one.
|
||||
require = rel_or_dep(require, solv.REL_AND, req)
|
||||
|
||||
@@ -91,9 +91,7 @@ class TestMMDResolver:
|
||||
([], "None"),
|
||||
([{"x": []}], "module(x)"),
|
||||
([{"x": ["1"]}], "(module(x) with module(x:1))"),
|
||||
([{"x": ["-1"]}], "(module(x) without module(x:1))"),
|
||||
([{"x": ["1", "2"]}], "(module(x) with (module(x:1) or module(x:2)))"),
|
||||
([{"x": ["-1", "2"]}], "(module(x) with module(x:2))"),
|
||||
([{"x": [], "y": []}], "(module(x) and module(y))"),
|
||||
([{"x": []}, {"y": []}], "(module(x) or module(y))"),
|
||||
),
|
||||
@@ -109,7 +107,6 @@ class TestMMDResolver:
|
||||
(
|
||||
({"platform": []}, [[["platform:f28:0:c0:x86_64"], ["platform:f29:0:c0:x86_64"]]]),
|
||||
({"platform": ["f28"]}, [[["platform:f28:0:c0:x86_64"]]]),
|
||||
({"platform": ["-f28"]}, [[["platform:f29:0:c0:x86_64"]]]),
|
||||
(
|
||||
{"gtk": [], "qt": []},
|
||||
[
|
||||
@@ -137,7 +134,7 @@ class TestMMDResolver:
|
||||
],
|
||||
),
|
||||
(
|
||||
[{"qt": [], "platform": ["f28"]}, {"gtk": [], "platform": ["-f28"]}],
|
||||
[{"qt": [], "platform": ["f28"]}, {"gtk": [], "platform": ["f29"]}],
|
||||
[
|
||||
[
|
||||
["qt:4:0:c8:x86_64", "platform:f28:0:c0:x86_64"],
|
||||
@@ -178,7 +175,7 @@ class TestMMDResolver:
|
||||
("qt:5:0:c9", {"platform": ["f29"]}),
|
||||
(
|
||||
"mess:1:0:c0",
|
||||
[{"gtk": ["3"], "platform": ["f28"]}, {"gtk": ["4"], "platform": ["-f28"]}],
|
||||
[{"gtk": ["3"], "platform": ["f28"]}, {"gtk": ["4"], "platform": ["f29"]}],
|
||||
),
|
||||
)
|
||||
for n, req in modules:
|
||||
|
||||
Reference in New Issue
Block a user