From fe026bb5888832ab883a3149d8119903222ebb85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 23 Jan 2017 09:55:26 +0100 Subject: [PATCH] Handle Requires(pre|post) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These requires are accessible from a separate attribute, but we want to handle them the same ways as regular Requires. Signed-off-by: Lubomír Sedlář --- pungi/gather_dnf.py | 10 ++++++++-- tests/test_gather.py | 4 ---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pungi/gather_dnf.py b/pungi/gather_dnf.py index 846efaa7..8aba2354 100644 --- a/pungi/gather_dnf.py +++ b/pungi/gather_dnf.py @@ -278,8 +278,14 @@ class Gather(GatherBase): assert pkg is not None result = set() - q = self.q_binary_packages.filter(provides=pkg.requires).apply() - for req in pkg.requires: + # DNF package has the _pre and _post attributes only if they are not + # empty. + requires = (pkg.requires + + getattr(pkg, 'requires_pre', []) + + getattr(pkg, 'requires_post', [])) + + q = self.q_binary_packages.filter(provides=requires).apply() + for req in requires: deps = self.finished_get_package_deps_reqs.setdefault(str(req), set()) if deps: result.update(deps) diff --git a/tests/test_gather.py b/tests/test_gather.py index b75ed647..6a71ea0e 100644 --- a/tests/test_gather.py +++ b/tests/test_gather.py @@ -1709,10 +1709,6 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): def test_bash_older(self): pass - @unittest.skip('Not implemented yet') - def test_requires_pre_post(self): - pass - @unittest.skip('Not implemented yet') def test_multilib_exclude_pattern_does_not_match_noarch(self): pass