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