diff options
author | Brian Harring <ferringb@gmail.com> | 2022-12-21 17:45:29 -0800 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2022-12-22 09:11:40 +0200 |
commit | 0517f1315251e5693ef994b2e2ae20d5aef13c6c (patch) | |
tree | e172b8b31908861a59c33b7ed03e443e7522fde6 /tests | |
parent | pmerge: sort target processing to stabilize the graph. (diff) | |
download | pkgcore-0517f1315251e5693ef994b2e2ae20d5aef13c6c.tar.gz pkgcore-0517f1315251e5693ef994b2e2ae20d5aef13c6c.tar.bz2 pkgcore-0517f1315251e5693ef994b2e2ae20d5aef13c6c.zip |
Fix use default dep matching when working against IUSE defaults.
Tests are added to validate, but essentially an atom like `sys-libs/libxcrypt[abi_x86_32(-),abi_x86_64(-),system(-)]`
would fail to match IUSE='+system' due to the restriction using the unstripped
iuse for a set check.
With that fixed, the resolver- at least on my system- now actually can generate
solutions that are sane/correct.
Signed-off-by: Brian Harring <ferringb@gmail.com>
Closes: https://github.com/pkgcore/pkgcore/pull/381
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ebuild/test_atom.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/ebuild/test_atom.py b/tests/ebuild/test_atom.py index ceb4c4959..0893b817a 100644 --- a/tests/ebuild/test_atom.py +++ b/tests/ebuild/test_atom.py @@ -2,15 +2,16 @@ from functools import partial from pickle import dumps, loads import pytest +from snakeoil.compatibility import cmp from pkgcore.ebuild import atom, errors, restricts from pkgcore.ebuild.cpv import CPV from pkgcore.restrictions.boolean import AndRestriction from pkgcore.test.misc import FakePkg, FakeRepo -from snakeoil.compatibility import cmp from ..restrictions.utils import TestRestriction + def assert_equal_bidirectional(o1, o2): # logic bugs hidden behind short circuiting comparisons for metadata # is why we test the comparison *both* ways. @@ -547,3 +548,23 @@ class TestAtom(TestRestriction): def test_get_atom_without_use_deps(self, original, wanted): orig_atom = self.kls(original) assert str(orig_atom.get_atom_without_use_deps) == wanted + + @pytest.mark.parametrize(('dep', 'iuse', 'use', 'wanted', 'eapi'), ( + ("x(-)", {'x'}, {'x'}, True, '5'), + ("x(-)", {'x'}, (), False, '5'), + ("x(+)", (), (), True, '5'), + ("x(-)", (), (), False, '5'), + ("x(-),y(-)", (), (), False, '5'), + ("x(-),y(-)", {'x', 'y'}, ("x", "y"), True, '5'), + ("x(+),y(-)", (), (), False, '5'), + ("x(+),y(-)", {"y"}, (), False, '5'), + ("x(+),y(-)", {'y'}, {"y"}, True, '5'), + # verify that it's not sensitive to iuse defaults + ("x(-)", {"+x"}, {"x"}, True, '5'), + ("x(+)", {"-x"}, {"x"}, True, '5'), + )) + def test_use_dep_defaults(self, dep, iuse, use, wanted, eapi): + pkg = FakePkg("dev-util/diffball-1", eapi=eapi, iuse=frozenset(iuse), use=frozenset(use)) + a = self.kls(f'dev-util/diffball[{dep}]') + #import pdb;pdb.set_trace() + assert a.match(pkg) == wanted |