Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] repoman: populate implicit IUSE for empty profile (bug 660982)
Date: Tue, 31 Jul 2018 15:42:19
Message-Id: 20180731084216.01566b43@professor-x
In Reply to: [gentoo-portage-dev] [PATCH] repoman: populate implicit IUSE for empty profile (bug 660982) by Zac Medico
1 On Sun, 15 Jul 2018 16:02:03 -0700
2 Zac Medico <zmedico@g.o> wrote:
3
4 > For the empty profile that's used to check dependencies of
5 > ebuilds that have empty KEYWORDS, populate implicit IUSE
6 > from all of the make.defaults files found in the relevant
7 > repositories (this should take less than 1 second on most
8 > hardware). Since the IUSE.missing check cannot be performed
9 > without implicit IUSE settings, this makes the IUSE.missing
10 > check work for ebuilds with empty KEYWORDS.
11 >
12 > Bug: https://bugs.gentoo.org/660982
13 > ---
14 > pym/portage/dbapi/__init__.py | 10 +++-----
15 > repoman/pym/repoman/modules/scan/depend/profile.py | 30
16 > +++++++++++++++++++++- 2 files changed, 32 insertions(+), 8
17 > deletions(-)
18 >
19 > diff --git a/pym/portage/dbapi/__init__.py
20 > b/pym/portage/dbapi/__init__.py index 61d301839..6fca6090c 100644
21 > --- a/pym/portage/dbapi/__init__.py
22 > +++ b/pym/portage/dbapi/__init__.py
23 > @@ -219,17 +219,13 @@ class dbapi(object):
24 > def _repoman_iuse_implicit_cnstr(self, pkg, metadata):
25 > """
26 > In repoman's version of _iuse_implicit_cnstr,
27 > account for modifications
28 > - of the self.settings reference between calls, and
29 > treat all flags as
30 > - valid for the empty profile because it does not have
31 > any implicit IUSE
32 > - settings. See bug 660982.
33 > + of the self.settings reference between calls.
34 > """
35 > eapi_attrs = _get_eapi_attrs(metadata["EAPI"])
36 > if eapi_attrs.iuse_effective:
37 > - iuse_implicit_match = lambda flag: (True if
38 > not self.settings.profile_path
39 > - else
40 > self.settings._iuse_effective_match(flag))
41 > + iuse_implicit_match = lambda flag:
42 > self.settings._iuse_effective_match(flag) else:
43 > - iuse_implicit_match = lambda flag: (True if
44 > not self.settings.profile_path
45 > - else
46 > self.settings._iuse_implicit_match(flag))
47 > + iuse_implicit_match = lambda flag:
48 > self.settings._iuse_implicit_match(flag) return iuse_implicit_match
49 >
50 > def _iuse_implicit_cnstr(self, pkg, metadata):
51 > diff --git a/repoman/pym/repoman/modules/scan/depend/profile.py
52 > b/repoman/pym/repoman/modules/scan/depend/profile.py index
53 > 8e0a22f9c..233ed8e4b 100644 ---
54 > a/repoman/pym/repoman/modules/scan/depend/profile.py +++
55 > b/repoman/pym/repoman/modules/scan/depend/profile.py @@ -2,6 +2,7 @@
56 >
57 >
58 > import copy
59 > +import os
60 > from pprint import pformat
61 >
62 > from _emerge.Package import Package
63 > @@ -12,7 +13,8 @@ from repoman.modules.scan.scanbase import ScanBase
64 > from repoman.modules.scan.depend._depend_checks import _depend_checks
65 > from repoman.modules.scan.depend._gen_arches import _gen_arches
66 > from portage.dep import Atom
67 > -
68 > +from portage.package.ebuild.profile_iuse import iter_iuse_vars
69 > +from portage.util import getconfig
70 >
71 > def sort_key(item):
72 > return item[2].sub_path
73 > @@ -102,6 +104,10 @@ class ProfileDependsChecks(ScanBase):
74 > local_config=False,
75 > _unmatched_removal=self.options.unmatched_removal,
76 > env=self.env,
77 > repositories=self.repo_settings.repoman_settings.repositories) +
78 > + if not prof.abs_path:
79 > +
80 > self._populate_implicit_iuse(dep_settings) +
81 > dep_settings.categories =
82 > self.repo_settings.repoman_settings.categories if
83 > self.options.without_mask: dep_settings._mask_manager_obj = \
84 > @@ -257,3 +263,25 @@ class ProfileDependsChecks(ScanBase):
85 > def runInEbuilds(self):
86 > '''Ebuild level scans'''
87 > return (True, [self.check])
88 > +
89 > + @staticmethod
90 > + def _populate_implicit_iuse(config):
91 > + """
92 > + Populate implicit IUSE for the empty profile, see
93 > bug 660982.
94 > + """
95 > + dest = config.configdict['defaults']
96 > + for repo in config.repositories:
97 > + for parent_dir, dirs, files in
98 > os.walk(os.path.join(repo.location, 'profiles')):
99 > + src =
100 > getconfig(os.path.join(parent_dir, 'make.defaults'))
101 > + if not src:
102 > + continue
103 > + for k, v in iter_iuse_vars(src):
104 > + v_before = dest.get(k)
105 > + if v_before is not None:
106 > + merged_values =
107 > set(v_before.split())
108 > +
109 > merged_values.update(v.split())
110 > + v = '
111 > '.join(sorted(merged_values))
112 > + dest[k] = v
113 > +
114 > + config.regenerate()
115 > + config._init_iuse()
116 looks good

Replies