commit:     e691f07bf0572fad7686a54d628c1a29aec4ebe4
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 12 09:48:32 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Jul 14 23:31:34 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e691f07b

dbapi: fix repoman implicit IUSE (bug 660982)

Account for repoman modifications of the portdbapi self.settings
reference, and treat all flags as valid for the empty profile
because it does not have any implicit IUSE settings.

Bug: https://bugs.gentoo.org/660982
Reviewed-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/_emerge/Package.py        |  5 ++++-
 pym/portage/dbapi/__init__.py | 16 ++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index a7ce00bc9..5f34f3d27 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -93,7 +93,10 @@ class Package(Task):
                # sync metadata with validated repo (may be UNKNOWN_REPO)
                self._metadata['repository'] = self.cpv.repo
 
-               implicit_match = db._iuse_implicit_cnstr(self.cpv, 
self._metadata)
+               if self.root_config.settings.local_config:
+                       implicit_match = db._iuse_implicit_cnstr(self.cpv, 
self._metadata)
+               else:
+                       implicit_match = 
db._repoman_iuse_implicit_cnstr(self.cpv, self._metadata)
                usealiases = 
self.root_config.settings._use_manager.getUseAliases(self)
                self.iuse = self._iuse(self, self._metadata["IUSE"].split(),
                        implicit_match, usealiases, self.eapi)

diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index d320cc75f..61d301839 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -216,6 +216,22 @@ class dbapi(object):
 
                        yield cpv
 
+       def _repoman_iuse_implicit_cnstr(self, pkg, metadata):
+               """
+               In repoman's version of _iuse_implicit_cnstr, account for 
modifications
+               of the self.settings reference between calls, and treat all 
flags as
+               valid for the empty profile because it does not have any 
implicit IUSE
+               settings. See bug 660982.
+               """
+               eapi_attrs = _get_eapi_attrs(metadata["EAPI"])
+               if eapi_attrs.iuse_effective:
+                       iuse_implicit_match = lambda flag: (True if not 
self.settings.profile_path
+                               else self.settings._iuse_effective_match(flag))
+               else:
+                       iuse_implicit_match = lambda flag: (True if not 
self.settings.profile_path
+                               else self.settings._iuse_implicit_match(flag))
+               return iuse_implicit_match
+
        def _iuse_implicit_cnstr(self, pkg, metadata):
                """
                Construct a callable that checks if a given USE flag should

Reply via email to