hybrid: Honor filter_packages
JIRA: COMPOSE-3011 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
111af836ea
commit
4f712259d7
@ -149,6 +149,7 @@ class GatherMethodHybrid(pungi.phases.gather.method.GatherMethodBase):
|
||||
groups=[],
|
||||
multilib_whitelist=[],
|
||||
multilib_blacklist=[],
|
||||
filter_packages=[],
|
||||
**kwargs
|
||||
):
|
||||
self.arch = arch
|
||||
@ -172,7 +173,13 @@ class GatherMethodHybrid(pungi.phases.gather.method.GatherMethodBase):
|
||||
expand_groups(self.compose, arch, variant, groups, set_pkg_arch=False)
|
||||
)
|
||||
|
||||
nvrs, out_modules = self.run_solver(variant, arch, packages, platform)
|
||||
# Filters are received as tuples (name, arch), we should convert it to
|
||||
# strings.
|
||||
filter_packages = [_fmt_pkg(*p) for p in filter_packages]
|
||||
|
||||
nvrs, out_modules = self.run_solver(
|
||||
variant, arch, packages, platform, filter_packages
|
||||
)
|
||||
filter_modules(variant, arch, out_modules)
|
||||
return expand_packages(
|
||||
self._get_pkg_map(arch),
|
||||
@ -182,7 +189,7 @@ class GatherMethodHybrid(pungi.phases.gather.method.GatherMethodBase):
|
||||
)
|
||||
# maybe check invalid sigkeys
|
||||
|
||||
def run_solver(self, variant, arch, packages, platform):
|
||||
def run_solver(self, variant, arch, packages, platform, filter_packages):
|
||||
repos = [self.compose.paths.work.arch_repo(arch=arch)]
|
||||
|
||||
modules = []
|
||||
@ -206,6 +213,7 @@ class GatherMethodHybrid(pungi.phases.gather.method.GatherMethodBase):
|
||||
input_packages,
|
||||
modules,
|
||||
platform=platform,
|
||||
filter_packages=filter_packages,
|
||||
)
|
||||
logfile = self.compose.paths.log.log_file(
|
||||
arch, "hybrid-depsolver-%s-iter-%d" % (variant, step)
|
||||
|
@ -32,7 +32,7 @@ def get_cmd(
|
||||
packages,
|
||||
modules,
|
||||
platform=None,
|
||||
filter_packages=None, # TODO not supported yet
|
||||
filter_packages=None,
|
||||
):
|
||||
cmd = ["fus", "--verbose", "--arch", arch]
|
||||
|
||||
@ -46,6 +46,9 @@ def get_cmd(
|
||||
if platform:
|
||||
cmd.append("--platform=%s" % platform)
|
||||
|
||||
for pkg in sorted(filter_packages or []):
|
||||
cmd.append("--exclude=%s" % pkg)
|
||||
|
||||
for module in modules:
|
||||
cmd.append("module(%s)" % module)
|
||||
|
||||
|
@ -29,6 +29,7 @@ class TestGetCmd(unittest.TestCase):
|
||||
["pkg"],
|
||||
["mod:1.0"],
|
||||
platform="f29",
|
||||
filter_packages=["foo", "bar"],
|
||||
)
|
||||
self.assertEqual(
|
||||
cmd,
|
||||
@ -42,6 +43,8 @@ class TestGetCmd(unittest.TestCase):
|
||||
"--repo=repo-0,repo,/tmp/first",
|
||||
"--repo=repo-1,repo,/tmp/second",
|
||||
"--platform=f29",
|
||||
"--exclude=bar",
|
||||
"--exclude=foo",
|
||||
"module(mod:1.0)",
|
||||
"pkg",
|
||||
],
|
||||
|
@ -54,7 +54,7 @@ class TestMethodHybrid(helpers.PungiTestCase):
|
||||
self.assertEqual(cmr.call_args_list, [mock.call(compose, variant, arch)])
|
||||
self.assertEqual(
|
||||
m.run_solver.call_args_list,
|
||||
[mock.call(variant, arch, set(["pkg", "foo", "bar"]), cmr.return_value)],
|
||||
[mock.call(variant, arch, set(["pkg", "foo", "bar"]), cmr.return_value, [])],
|
||||
)
|
||||
self.assertEqual(
|
||||
ep.call_args_list,
|
||||
@ -333,6 +333,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
"x86_64",
|
||||
[],
|
||||
platform="pl",
|
||||
filter_packages=["foo"],
|
||||
)
|
||||
|
||||
self.assertEqual(res, po.return_value)
|
||||
@ -355,6 +356,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
[],
|
||||
["mod:master"],
|
||||
platform="pl",
|
||||
filter_packages=["foo"],
|
||||
)
|
||||
],
|
||||
)
|
||||
@ -382,6 +384,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
"x86_64",
|
||||
[],
|
||||
platform="pl",
|
||||
filter_packages=["foo"],
|
||||
)
|
||||
|
||||
self.assertEqual(res, po.return_value)
|
||||
@ -404,6 +407,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
[],
|
||||
["mod:master", "mod-devel:master"],
|
||||
platform="pl",
|
||||
filter_packages=["foo"],
|
||||
)
|
||||
],
|
||||
)
|
||||
@ -415,6 +419,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
"x86_64",
|
||||
[("pkg", None)],
|
||||
platform=None,
|
||||
filter_packages=[],
|
||||
)
|
||||
|
||||
self.assertEqual(res, po.return_value)
|
||||
@ -429,7 +434,17 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
)
|
||||
self.assertEqual(
|
||||
gc.call_args_list,
|
||||
[mock.call("x86_64", [self._repo("repo")], [], ["pkg"], [], platform=None)],
|
||||
[
|
||||
mock.call(
|
||||
"x86_64",
|
||||
[self._repo("repo")],
|
||||
[],
|
||||
["pkg"],
|
||||
[],
|
||||
platform=None,
|
||||
filter_packages=[],
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
def test_with_langpacks(self, run, gc, po):
|
||||
@ -442,6 +457,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
"x86_64",
|
||||
[("pkg", None)],
|
||||
platform=None,
|
||||
filter_packages=["foo"],
|
||||
)
|
||||
|
||||
self.assertEqual(res, (final, []))
|
||||
@ -463,7 +479,13 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
gc.call_args_list,
|
||||
[
|
||||
mock.call(
|
||||
"x86_64", [self._repo("repo")], [], ["pkg"], [], platform=None
|
||||
"x86_64",
|
||||
[self._repo("repo")],
|
||||
[],
|
||||
["pkg"],
|
||||
[],
|
||||
platform=None,
|
||||
filter_packages=["foo"],
|
||||
),
|
||||
mock.call(
|
||||
"x86_64",
|
||||
@ -472,6 +494,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
["pkg", "pkg-en"],
|
||||
[],
|
||||
platform=None,
|
||||
filter_packages=["foo"],
|
||||
),
|
||||
],
|
||||
)
|
||||
@ -509,6 +532,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
"x86_64",
|
||||
[("pkg-devel", None), ("foo", None)],
|
||||
platform=None,
|
||||
filter_packages=[],
|
||||
)
|
||||
|
||||
self.assertEqual(res, (final, []))
|
||||
@ -536,6 +560,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
["pkg-devel", "foo"],
|
||||
[],
|
||||
platform=None,
|
||||
filter_packages=[],
|
||||
),
|
||||
mock.call(
|
||||
"x86_64",
|
||||
@ -544,6 +569,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
["pkg-devel", "foo", "pkg-devel.i686"],
|
||||
[],
|
||||
platform=None,
|
||||
filter_packages=[],
|
||||
),
|
||||
],
|
||||
)
|
||||
@ -607,6 +633,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
"x86_64",
|
||||
[("pkg-devel", None), ("foo", None)],
|
||||
platform=None,
|
||||
filter_packages=[],
|
||||
)
|
||||
|
||||
self.assertEqual(res, (final, []))
|
||||
@ -634,6 +661,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
["pkg-devel", "foo"],
|
||||
[],
|
||||
platform=None,
|
||||
filter_packages=[],
|
||||
),
|
||||
mock.call(
|
||||
"x86_64",
|
||||
@ -642,6 +670,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
||||
["pkg-devel", "foo", "foo.i686"],
|
||||
[],
|
||||
platform=None,
|
||||
filter_packages=[],
|
||||
),
|
||||
],
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user