aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gmail.com>2022-12-25 15:23:15 -0800
committerArthur Zamarin <arthurzam@gentoo.org>2022-12-26 19:27:24 +0200
commit6bcdbd769bfa8ebf78e31887e4fd54eaf1c47032 (patch)
treeb0050d9295434ca76d3fbe173de68663fcfe0fa8 /tests
parentForce stable sorting of /etc/portage/* files loading. (diff)
downloadpkgcore-6bcdbd769bfa8ebf78e31887e4fd54eaf1c47032.tar.gz
pkgcore-6bcdbd769bfa8ebf78e31887e4fd54eaf1c47032.tar.bz2
pkgcore-6bcdbd769bfa8ebf78e31887e4fd54eaf1c47032.zip
Add USE_EXPAND expansion awareness for /etc/portage/package.use/* files.
Specifically, if you have: `*/* PYTHON_TARGETS: -python2_7 python3_9` Pkgcore was treating `PYTHON_TARGETS:` as a use flag. That's obviously wrong, and the parsing should be tightened there. Closes: https://github.com/pkgcore/pkgcore/issues/384 Signed-off-by: Brian Harring <ferringb@gmail.com> Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/ebuild/test_domain.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ebuild/test_domain.py b/tests/ebuild/test_domain.py
index 6629cfb9..87c3d489 100644
--- a/tests/ebuild/test_domain.py
+++ b/tests/ebuild/test_domain.py
@@ -1,3 +1,4 @@
+import textwrap
from unittest import mock
import pytest
@@ -54,3 +55,30 @@ class TestDomain:
(packages.AlwaysTrue, ((), ("X",))),
(packages.AlwaysTrue, (("X",), ("Y",))),
) == self.mk_domain().pkg_use
+
+ def test_use_expand_syntax(self):
+ puse = self.confdir / "package.use"
+ puse.mkdir()
+ open(puse / "a", "w").write(
+ textwrap.dedent(
+ """
+ */* x_y1
+ # unrelated is there to verify that it's unaffected by the USE_EXPAND
+ */* unrelated X: -y1 y2
+ """
+ )
+ )
+
+ assert (
+ (packages.AlwaysTrue, ((), ("x_y1",))),
+ (
+ packages.AlwaysTrue,
+ (
+ ("x_y1",),
+ (
+ "unrelated",
+ "x_y2",
+ ),
+ ),
+ ),
+ ) == self.mk_domain().pkg_use