diff --git a/pungi/phases/gather/methods/method_hybrid.py b/pungi/phases/gather/methods/method_hybrid.py index e0f86ac5..2bab2972 100644 --- a/pungi/phases/gather/methods/method_hybrid.py +++ b/pungi/phases/gather/methods/method_hybrid.py @@ -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) diff --git a/pungi/wrappers/fus.py b/pungi/wrappers/fus.py index 2b151eb4..755c9447 100644 --- a/pungi/wrappers/fus.py +++ b/pungi/wrappers/fus.py @@ -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) diff --git a/tests/test_fus_wrapper.py b/tests/test_fus_wrapper.py index 9e2931de..81a754a0 100644 --- a/tests/test_fus_wrapper.py +++ b/tests/test_fus_wrapper.py @@ -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", ], diff --git a/tests/test_gather_method_hybrid.py b/tests/test_gather_method_hybrid.py index 47b6f67e..8ba39c92 100644 --- a/tests/test_gather_method_hybrid.py +++ b/tests/test_gather_method_hybrid.py @@ -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=[], ), ], )