1 |
From: "Sam James (sam_c)" <sam@×××××.info> |
2 |
|
3 |
Introduces new repos.conf/layout.conf variables: |
4 |
* maintainer-nag (yes/no) |
5 |
* maintainer-nag-url (URL to be given for volunteers to look at) |
6 |
|
7 |
Bug: https://bugs.gentoo.org/711466 |
8 |
Closes: https://github.com/gentoo/portage/pull/529 |
9 |
Signed-off-by: Sam James (sam_c) <sam@×××××.info> |
10 |
Signed-off-by: Zac Medico <zmedico@g.o> |
11 |
--- |
12 |
lib/_emerge/depgraph.py | 48 ++++++++++++++++++++++++++++++++ |
13 |
lib/portage/repository/config.py | 26 +++++++++++++++-- |
14 |
2 files changed, 72 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py |
17 |
index ec90e59df..216eec28e 100644 |
18 |
--- a/lib/_emerge/depgraph.py |
19 |
+++ b/lib/_emerge/depgraph.py |
20 |
@@ -53,6 +53,11 @@ from portage.util._eventloop.EventLoop import EventLoop |
21 |
from portage.util._eventloop.global_event_loop import global_event_loop |
22 |
from portage.versions import _pkg_str, catpkgsplit |
23 |
|
24 |
+try: |
25 |
+ from portage.xml.metadata import MetaDataXML |
26 |
+except Exception: |
27 |
+ MetaDataXML = None |
28 |
+ |
29 |
from _emerge.AtomArg import AtomArg |
30 |
from _emerge.Blocker import Blocker |
31 |
from _emerge.BlockerCache import BlockerCache |
32 |
@@ -9163,6 +9168,49 @@ class depgraph(object): |
33 |
show_mask_docs() |
34 |
writemsg("\n", noiselevel=-1) |
35 |
|
36 |
+ # Build a list of problematic packages |
37 |
+ maintainer_nag_packages = [] |
38 |
+ |
39 |
+ for pkg in self._dynamic_config.digraph: |
40 |
+ if not isinstance(pkg, Package): |
41 |
+ continue |
42 |
+ |
43 |
+ if not pkg.type_name == 'ebuild': |
44 |
+ continue |
45 |
+ |
46 |
+ maintainer_nag = pkg.root_config.settings.repositories[pkg.repo].maintainer_nag |
47 |
+ maintainer_nag_url = pkg.root_config.settings.repositories[pkg.repo].maintainer_nag_url |
48 |
+ |
49 |
+ if not maintainer_nag: |
50 |
+ continue |
51 |
+ |
52 |
+ path = os.path.dirname(pkg.root_config.trees['porttree'].dbapi.findname(pkg.cpv, myrepo=pkg.repo)) |
53 |
+ path = os.path.join(path, 'metadata.xml') |
54 |
+ |
55 |
+ if MetaDataXML is not None and os.path.isfile(path): |
56 |
+ try: |
57 |
+ metadata_xml = MetaDataXML(path, None) |
58 |
+ maintainer = metadata_xml.format_maintainer_string() |
59 |
+ except SyntaxError: |
60 |
+ continue |
61 |
+ |
62 |
+ if not maintainer: |
63 |
+ maintainer_nag_packages.append(pkg.cpv + "::" + pkg.repo) |
64 |
+ |
65 |
+ if maintainer_nag_packages: |
66 |
+ writemsg("\n" + colorize("WARN", "!!!") + \ |
67 |
+ " The following packages have no maintainer. They are at greater risk of bugs." + |
68 |
+ "\n!!! You can help to keep it in tree and fix bugs (inc. possible security issues)") |
69 |
+ |
70 |
+ if maintainer_nag_url: |
71 |
+ writemsg("\n!!! Please see: " + maintainer_nag_url) |
72 |
+ |
73 |
+ writemsg("\n") |
74 |
+ for pkg in maintainer_nag_packages: |
75 |
+ writemsg("- " + pkg) |
76 |
+ writemsg("\n") |
77 |
+ |
78 |
+ |
79 |
for pargs, kwargs in self._dynamic_config._unsatisfied_deps_for_display: |
80 |
self._show_unsatisfied_dep(*pargs, **kwargs) |
81 |
|
82 |
diff --git a/lib/portage/repository/config.py b/lib/portage/repository/config.py |
83 |
index 50ab18026..1309cef65 100644 |
84 |
--- a/lib/portage/repository/config.py |
85 |
+++ b/lib/portage/repository/config.py |
86 |
@@ -1,4 +1,4 @@ |
87 |
-# Copyright 2010-2019 Gentoo Authors |
88 |
+# Copyright 2010-2020 Gentoo Authors |
89 |
# Distributed under the terms of the GNU General Public License v2 |
90 |
|
91 |
from __future__ import unicode_literals |
92 |
@@ -96,6 +96,8 @@ class RepoConfig(object): |
93 |
'manifest_hashes', |
94 |
'manifest_required_hashes', |
95 |
'masters', |
96 |
+ 'maintainer_nag', |
97 |
+ 'maintainer_nag_url', |
98 |
'missing_repo_name', |
99 |
'module_specific_options', |
100 |
'name', |
101 |
@@ -306,6 +308,8 @@ class RepoConfig(object): |
102 |
self.disable_manifest = False |
103 |
self.manifest_hashes = None |
104 |
self.manifest_required_hashes = None |
105 |
+ self.maintainer_nag = repo_opts.get('maintainer-nag', 'no').lower() in ('true', 'yes') |
106 |
+ self.maintainer_nag_url = repo_opts.get('maintainer-nag-url') |
107 |
self.update_changelog = False |
108 |
self.cache_formats = None |
109 |
self.portage1_profiles = True |
110 |
@@ -338,13 +342,23 @@ class RepoConfig(object): |
111 |
self.name = layout_data['repo-name'] |
112 |
self.missing_repo_name = False |
113 |
|
114 |
+ # Override some repos.conf setting with layout.conf |
115 |
for value in ('allow-missing-manifest', |
116 |
'cache-formats', |
117 |
- 'create-manifest', 'disable-manifest', 'manifest-hashes', |
118 |
+ 'create-manifest', 'disable-manifest', 'manifest-hashes', 'maintainer-nag', 'maintainer-nag-url', |
119 |
'manifest-required-hashes', 'profile-formats', 'properties-allowed', 'restrict-allowed', |
120 |
'sign-commit', 'sign-manifest', 'thin-manifest', 'update-changelog'): |
121 |
setattr(self, value.lower().replace("-", "_"), layout_data[value]) |
122 |
|
123 |
+ # Allow repos.conf override of layout.conf for these |
124 |
+ for value in ('maintainer-nag', 'maintainer-nag-url'): |
125 |
+ setting = repo_opts.get(value) |
126 |
+ if setting: |
127 |
+ setattr(self, value.lower().replace("-", "_"), setting) |
128 |
+ |
129 |
+ self.maintainer_nag = (self.maintainer_nag.lower() in ('true', 'yes') |
130 |
+ if isinstance(self.maintainer_nag, basestring) else self.maintainer_nag) |
131 |
+ |
132 |
# If profile-formats specifies a default EAPI, then set |
133 |
# self.eapi to that, otherwise set it to "0" as specified |
134 |
# by PMS. |
135 |
@@ -600,6 +614,8 @@ class RepoConfigLoader(object): |
136 |
'clone_depth', |
137 |
'eclass_overrides', |
138 |
'force', |
139 |
+ 'maintainer_nag', |
140 |
+ 'maintainer_nag_url', |
141 |
'masters', |
142 |
'module_specific_options', |
143 |
'priority', |
144 |
@@ -1045,6 +1061,7 @@ class RepoConfigLoader(object): |
145 |
|
146 |
def config_string(self): |
147 |
bool_keys = ( |
148 |
+ "maintainer_nag", |
149 |
"strict_misc_digests", |
150 |
"sync_allow_hardlinks", |
151 |
"sync_rcu", |
152 |
@@ -1055,6 +1072,7 @@ class RepoConfigLoader(object): |
153 |
"format", |
154 |
"location", |
155 |
"main_repo", |
156 |
+ "maintainer_nag_url", |
157 |
"priority", |
158 |
"sync_depth", |
159 |
"sync_openpgp_keyserver", |
160 |
@@ -1170,6 +1188,10 @@ def parse_layout_conf(repo_location, repo_name=None): |
161 |
data['create-manifest'] = manifest_policy != 'false' |
162 |
data['disable-manifest'] = manifest_policy == 'false' |
163 |
|
164 |
+ data['maintainer-nag'] = layout_data.get('maintainer-nag', 'no').lower() \ |
165 |
+ == 'yes' |
166 |
+ data['maintainer-nag-url'] = layout_data.get('maintainer-nag-url', '') |
167 |
+ |
168 |
# for compatibility w/ PMS, fallback to pms; but also check if the |
169 |
# cache exists or not. |
170 |
cache_formats = layout_data.get('cache-formats', '').lower().split() |
171 |
-- |
172 |
2.25.3 |