public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/modules/scan/depend/, pym/portage/dbapi/
@ 2018-07-16  6:17 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2018-07-16  6:17 UTC (permalink / raw
  To: gentoo-commits

commit:     ef604f402a93234a4b6e3ef433678c8fa04c746b
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 15 22:51:48 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jul 16 06:13:02 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ef604f40

repoman: populate implicit IUSE for empty profile (bug 660982)

For the empty profile that's used to check dependencies of
ebuilds that have empty KEYWORDS, populate implicit IUSE
from all of the make.defaults files found in the relevant
repositories (this should take less than 1 second on most
hardware). Since the IUSE.missing check cannot be performed
without implicit IUSE settings, this makes the IUSE.missing
check work for ebuilds with empty KEYWORDS.

Bug: https://bugs.gentoo.org/660982

 pym/portage/dbapi/__init__.py                      | 10 ++----
 repoman/pym/repoman/modules/scan/depend/profile.py | 36 ++++++++++++++++++++++
 2 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index 61d301839..6fca6090c 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -219,17 +219,13 @@ class dbapi(object):
 	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.
+		of the self.settings reference between calls.
 		"""
 		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))
+			iuse_implicit_match = lambda flag: 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))
+			iuse_implicit_match = lambda flag: self.settings._iuse_implicit_match(flag)
 		return iuse_implicit_match
 
 	def _iuse_implicit_cnstr(self, pkg, metadata):

diff --git a/repoman/pym/repoman/modules/scan/depend/profile.py b/repoman/pym/repoman/modules/scan/depend/profile.py
index 8e0a22f9c..d980f4eca 100644
--- a/repoman/pym/repoman/modules/scan/depend/profile.py
+++ b/repoman/pym/repoman/modules/scan/depend/profile.py
@@ -2,6 +2,7 @@
 
 
 import copy
+import os
 from pprint import pformat
 
 from _emerge.Package import Package
@@ -12,6 +13,8 @@ from repoman.modules.scan.scanbase import ScanBase
 from repoman.modules.scan.depend._depend_checks import _depend_checks
 from repoman.modules.scan.depend._gen_arches import _gen_arches
 from portage.dep import Atom
+from portage.package.ebuild.profile_iuse import iter_iuse_vars
+from portage.util import getconfig
 
 
 def sort_key(item):
@@ -102,6 +105,11 @@ class ProfileDependsChecks(ScanBase):
 					local_config=False,
 					_unmatched_removal=self.options.unmatched_removal,
 					env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+
+				if not prof.abs_path:
+					self._populate_implicit_iuse(dep_settings,
+						self.repo_settings.repo_config.eclass_db.porttrees)
+
 				dep_settings.categories = self.repo_settings.repoman_settings.categories
 				if self.options.without_mask:
 					dep_settings._mask_manager_obj = \
@@ -257,3 +265,31 @@ class ProfileDependsChecks(ScanBase):
 	def runInEbuilds(self):
 		'''Ebuild level scans'''
 		return (True, [self.check])
+
+	@staticmethod
+	def _populate_implicit_iuse(config, repo_locations):
+		"""
+		Populate implicit IUSE for the empty profile, see bug 660982.
+
+		@param config: config instance for the empty profile
+		@type config: portage.config
+		@param repo_locations: locations of repositories containing relevant
+			implicit IUSE settings
+		@type repo_locations: list
+		"""
+		dest = config.configdict['defaults']
+		for location in repo_locations:
+			for parent_dir, dirs, files in os.walk(os.path.join(location, 'profiles')):
+				src = getconfig(os.path.join(parent_dir, 'make.defaults'))
+				if not src:
+					continue
+				for k, v in iter_iuse_vars(src):
+					v_before = dest.get(k)
+					if v_before is not None:
+						merged_values = set(v_before.split())
+						merged_values.update(v.split())
+						v = ' '.join(sorted(merged_values))
+					dest[k] = v
+
+		config.regenerate()
+		config._init_iuse()


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-16  6:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-16  6:17 [gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/modules/scan/depend/, pym/portage/dbapi/ Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox