Discussion:
[gentoo-portage-dev] [PATCH] repoman: populate implicit IUSE for empty profile (bug 660982)
Zac Medico
2018-07-15 23:02:03 UTC
Permalink
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
Brian Dolbec
2018-07-31 15:42:16 UTC
Permalink
On Sun, 15 Jul 2018 16:02:03 -0700
Post by 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
"""
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"])
- iuse_implicit_match = lambda flag: (True if
not self.settings.profile_path
- else
self.settings._iuse_effective_match(flag))
- iuse_implicit_match = lambda flag: (True if
not self.settings.profile_path
- else
self.settings._iuse_implicit_match(flag))
self.settings._iuse_implicit_match(flag) return iuse_implicit_match
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 +++
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
return item[2].sub_path
local_config=False,
_unmatched_removal=self.options.unmatched_removal,
env=self.env,
repositories=self.repo_settings.repoman_settings.repositories) +
+
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 = \
'''Ebuild level scans'''
return (True, [self.check])
+
+ """
+ Populate implicit IUSE for the empty profile, see
bug 660982.
+ """
+ dest = config.configdict['defaults']
+ for parent_dir, dirs, files in
+ src =
getconfig(os.path.join(parent_dir, 'make.defaults'))
+ continue
+ v_before = dest.get(k)
+ merged_values =
set(v_before.split())
+
merged_values.update(v.split())
+ v = '
'.join(sorted(merged_values))
+ dest[k] = v
+
+ config.regenerate()
+ config._init_iuse()
looks good
Zac Medico
2018-07-31 16:43:14 UTC
Permalink
Post by Brian Dolbec
On Sun, 15 Jul 2018 16:02:03 -0700
Post by 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
"""
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"])
- iuse_implicit_match = lambda flag: (True if
not self.settings.profile_path
- else
self.settings._iuse_effective_match(flag))
- iuse_implicit_match = lambda flag: (True if
not self.settings.profile_path
- else
self.settings._iuse_implicit_match(flag))
self.settings._iuse_implicit_match(flag) return iuse_implicit_match
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 +++
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
return item[2].sub_path
local_config=False,
_unmatched_removal=self.options.unmatched_removal,
env=self.env,
repositories=self.repo_settings.repoman_settings.repositories) +
+
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 = \
'''Ebuild level scans'''
return (True, [self.check])
+
+ """
+ Populate implicit IUSE for the empty profile, see
bug 660982.
+ """
+ dest = config.configdict['defaults']
+ for parent_dir, dirs, files in
+ src =
getconfig(os.path.join(parent_dir, 'make.defaults'))
+ continue
+ v_before = dest.get(k)
+ merged_values =
set(v_before.split())
+
merged_values.update(v.split())
+ v = '
'.join(sorted(merged_values))
+ dest[k] = v
+
+ config.regenerate()
+ config._init_iuse()
looks good
Thanks, merged:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=ef604f402a93234a4b6e3ef433678c8fa04c746b
--
Thanks,
Zac
Loading...