public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-portage-dev] [PATCH] repoman: populate implicit IUSE for empty profile (bug 660982)
@ 2018-07-15 23:02 99% Zac Medico
  0 siblings, 0 replies; 1+ results
From: Zac Medico @ 2018-07-15 23:02 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

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 | 30 +++++++++++++++++++++-
 2 files changed, 32 insertions(+), 8 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..233ed8e4b 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,7 +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):
 	return item[2].sub_path
@@ -102,6 +104,10 @@ 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)
+
 				dep_settings.categories = self.repo_settings.repoman_settings.categories
 				if self.options.without_mask:
 					dep_settings._mask_manager_obj = \
@@ -257,3 +263,25 @@ class ProfileDependsChecks(ScanBase):
 	def runInEbuilds(self):
 		'''Ebuild level scans'''
 		return (True, [self.check])
+
+	@staticmethod
+	def _populate_implicit_iuse(config):
+		"""
+		Populate implicit IUSE for the empty profile, see bug 660982.
+		"""
+		dest = config.configdict['defaults']
+		for repo in config.repositories:
+			for parent_dir, dirs, files in os.walk(os.path.join(repo.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()
-- 
2.13.6



^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2018-07-15 23:02 99% [gentoo-portage-dev] [PATCH] repoman: populate implicit IUSE for empty profile (bug 660982) Zac Medico

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