aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2017-12-10 17:12:41 -0800
committerZac Medico <zmedico@gentoo.org>2017-12-10 18:31:45 -0800
commit2382082dcfce5e6c2be7c4dd6aed7c32e1d20616 (patch)
tree1ba52df17370a3821d758b3478e9ca4cc6016090 /pym/portage
parentPORTAGE_XATTR_EXCLUDE: add common user.* attributes (bug 640290) (diff)
downloadportage-2382082dcfce5e6c2be7c4dd6aed7c32e1d20616.tar.gz
portage-2382082dcfce5e6c2be7c4dd6aed7c32e1d20616.tar.bz2
portage-2382082dcfce5e6c2be7c4dd6aed7c32e1d20616.zip
Handle binary package IUSE_IMPLICIT divergence (bug 640318)
Since profile IUSE_IMPLICIT settings may diverge from those that a binary package was built with, consider members of built USE settings to be members of IUSE_EFFECTIVE. Only do this for EAPIs that support IUSE_EFFECTIVE, since built USE settings for earlier EAPIs may contain a large number of irrelevant flags. Note that the binary package may be remote, so it's only possible to rely on metadata that is available in the remote Packages file, and the IUSE_IMPLICIT header in the Packages file is vulnerable to mutation. Bug: https://bugs.gentoo.org/640318
Diffstat (limited to 'pym/portage')
-rw-r--r--pym/portage/dbapi/__init__.py5
-rw-r--r--pym/portage/package/ebuild/config.py6
-rw-r--r--pym/portage/tests/dbapi/test_fakedbapi.py20
3 files changed, 31 insertions, 0 deletions
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index 95053840d..2574b63df 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -5,6 +5,7 @@ from __future__ import unicode_literals
__all__ = ["dbapi"]
+import functools
import re
import portage
@@ -219,6 +220,10 @@ class dbapi(object):
eapi_attrs = _get_eapi_attrs(metadata["EAPI"])
if eapi_attrs.iuse_effective:
iuse_implicit_match = self.settings._iuse_effective_match
+ if not self._use_mutable:
+ iuse_implicit_match = functools.partial(
+ Package._built_iuse_effective_match,
+ iuse_implicit_match, frozenset(metadata["USE"].split()))
else:
iuse_implicit_match = self.settings._iuse_implicit_match
usealiases = self.settings._use_manager.getUseAliases(pkg)
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index cd2b009aa..d0225a311 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1693,6 +1693,12 @@ class config(object):
iuse_implicit_match = self._iuse_effective_match
portage_iuse = set(self._iuse_effective)
portage_iuse.update(explicit_iuse)
+ if built_use is not None:
+ # When the binary package was built, the profile may have
+ # had different IUSE_IMPLICIT settings, so any member of
+ # the built USE setting is considered to be a member of
+ # IUSE_EFFECTIVE (see bug 640318).
+ portage_iuse.update(built_use)
self.configdict["pkg"]["IUSE_EFFECTIVE"] = \
" ".join(sorted(portage_iuse))
else:
diff --git a/pym/portage/tests/dbapi/test_fakedbapi.py b/pym/portage/tests/dbapi/test_fakedbapi.py
index e4f5dd771..19ea9cd00 100644
--- a/pym/portage/tests/dbapi/test_fakedbapi.py
+++ b/pym/portage/tests/dbapi/test_fakedbapi.py
@@ -14,6 +14,20 @@ class TestFakedbapi(TestCase):
def testFakedbapi(self):
packages = (
+ ("app-misc/foo-1", {
+ "EAPI" : "2", # does not support IUSE_EFFECTIVE
+ "IUSE" : "",
+ "repository" : "gentoo",
+ "SLOT" : "1",
+ "USE" : "missing-iuse",
+ }),
+ ("app-misc/foo-2", {
+ "EAPI" : "5", # supports IUSE_EFFECTIVE
+ "IUSE" : "",
+ "repository" : "gentoo",
+ "SLOT" : "2",
+ "USE" : "missing-iuse",
+ }),
("sys-apps/portage-2.1.10", {
"EAPI" : "2",
"IUSE" : "ipc doc",
@@ -29,6 +43,12 @@ class TestFakedbapi(TestCase):
)
match_tests = (
+ # The missing-iuse match is only intended to work for binary
+ # packages with EAPIs that support IUSE_EFFECTIVE (bug 640318).
+ ("app-misc/foo[missing-iuse]", ["app-misc/foo-2"]),
+ ("app-misc/foo[-missing-iuse]", []),
+ ("app-misc/foo", ["app-misc/foo-1", "app-misc/foo-2"]),
+
("sys-apps/portage:0[ipc]", ["sys-apps/portage-2.1.10"]),
("sys-apps/portage:0[-ipc]", []),
("sys-apps/portage:0[doc]", []),