commit: 73b560804869e81d79995ae198aa1517bedaea54
Author: Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Sat Jan 21 07:50:39 2023 +0000
Commit: Brian Harring <ferringb <AT> gmail <DOT> com>
CommitDate: Sat Nov 22 18:54:44 2025 +0000
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=73b56080
fix(domain): add xfail tests for failing package.keywords parsing.
See ferringb/pkgcore#5 ; in tracing the involved code I have
a hard time believing the end result supports incrementalism fully,
but minimally it's not doing the standard collapsing all pkgcore
code does for incrementals like this.
Signed-off-by: Brian Harring <ferringb <AT> gmail.com>
tests/ebuild/test_domain.py | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/tests/ebuild/test_domain.py b/tests/ebuild/test_domain.py
index 329305b2..15e243b4 100644
--- a/tests/ebuild/test_domain.py
+++ b/tests/ebuild/test_domain.py
@@ -5,6 +5,7 @@ import pytest
from pkgcore.ebuild import domain as domain_mod
from pkgcore.ebuild import profiles
+from pkgcore.ebuild.atom import atom
from pkgcore.fs.livefs import iter_scan
from pkgcore.restrictions import packages
@@ -22,6 +23,8 @@ class TestDomain:
self.pmixin.mk_profile(self.profile_base, str(self.profile1))
self.pusedir = self.confdir / "package.use"
self.pusedir.mkdir()
+ self.pkeywordsdir = self.confdir / "package.accept_keywords"
+ self.pkeywordsdir.mkdir()
def mk_domain(self):
return domain_mod.domain(
@@ -132,3 +135,32 @@ class TestDomain:
assert () == self.mk_domain().pkg_use
assert "token x_$z is not a valid use flag" in caplog.text
caplog.clear()
+
+ @pytest.mark.xfail(
+ reason="pruning of tokens isn't yet implemented for package.keywords"
+ )
+ def test_package_keywords(self):
+ (self.pkeywordsdir / "a").write_text(
+ """
+ # control case.
+ dev-util/normal x86 ~amd64
+
+ # all stable means x86 is redundant
+ dev-util/stable x86 *
+
+ # all unstable (~*) implicitly includes stable, so drop the x64
+ dev-util/unstable ~* x64
+
+ # ** matches everything, including no keywords. the x is redundant
+ dev-util/always amd64 ** x
+ """
+ )
+ keys = self.mk_domain().pkg_accept_keywords
+ assert keys == (
+ (atom("dev-util/normal"), ("x86", "~amd64")),
+ (atom("dev-util/test-stable"), ("*",)),
+ (atom("dev-util/test-unstable"), ("~*")),
+ # The '**' needs validation pkgcore internally translates this
+ # into the correct restriction (AlwaysTrue)
+ (atom("dev-util/test-unstable"), ("**")),
+ )