Gentoo Archives: gentoo-portage-dev

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

Attachments

File name MIME type
signature.asc application/pgp-signature