1 |
The --dynamic-deps=n default causes confusion for users that are |
2 |
accustomed to dynamic deps, therefore add a --changed-deps-report |
3 |
option that is enabled by default (if --usepkgonly is not enabled). |
4 |
|
5 |
The --quiet option will suppress the report if none of the packages |
6 |
having changed dependencies are in the dependency graph, since they |
7 |
are harmless in that case. If any of these packages *are* in the |
8 |
dependency graph, then --quiet suppresses the big NOTE section of |
9 |
the report, but the HINT section is still displayed since it might |
10 |
help users resolve problems that are solved by --changed-deps. |
11 |
|
12 |
Example output is as follows: |
13 |
|
14 |
!!! Detected ebuild dependency change(s) without revision bump: |
15 |
|
16 |
net-misc/openssh-7.5_p1-r3::gentoo |
17 |
sys-fs/udisks-2.7.5::gentoo |
18 |
|
19 |
NOTE: For the ebuild(s) listed above, a new revision may be warranted if there |
20 |
has been a dependency change with significant consequences. Refer to the |
21 |
following page of the Gentoo Development Guide for examples of |
22 |
circumstances that may qualify: |
23 |
|
24 |
https://devmanual.gentoo.org/general-concepts/ebuild-revisions/ |
25 |
|
26 |
If circumstances qualify, please report a bug which specifies the current |
27 |
version of the ebuild listed above. Changes to ebuilds from the 'gentoo' |
28 |
repository (ending with '::gentoo') can be browsed in GitWeb: |
29 |
|
30 |
https://gitweb.gentoo.org/repo/gentoo.git/ |
31 |
|
32 |
Use Gentoo's Bugzilla to report bugs only for the 'gentoo' repository: |
33 |
|
34 |
https://bugs.gentoo.org/ |
35 |
|
36 |
In order to suppress reports about dependency changes, add |
37 |
--changed-deps-report=n to the EMERGE_DEFAULT_OPTS variable in |
38 |
'/etc/portage/make.conf'. |
39 |
|
40 |
HINT: In order to avoid problems involving changed dependencies, use the |
41 |
--changed-deps option to automatically trigger rebuilds when changed |
42 |
dependencies are detected. Refer to the emerge man page for more |
43 |
information about this option. |
44 |
|
45 |
Bug: https://bugs.gentoo.org/645780 |
46 |
--- |
47 |
man/emerge.1 | 10 ++++ |
48 |
pym/_emerge/create_depgraph_params.py | 5 ++ |
49 |
pym/_emerge/depgraph.py | 103 +++++++++++++++++++++++++++++++++- |
50 |
pym/_emerge/main.py | 13 +++++ |
51 |
4 files changed, 128 insertions(+), 3 deletions(-) |
52 |
|
53 |
diff --git a/man/emerge.1 b/man/emerge.1 |
54 |
index 3c81b9c9f..9de1b7f74 100644 |
55 |
--- a/man/emerge.1 |
56 |
+++ b/man/emerge.1 |
57 |
@@ -465,6 +465,16 @@ option also implies the \fB\-\-selective\fR option. Behavior with |
58 |
respect to changed build\-time dependencies is controlled by the |
59 |
\fB\-\-with\-bdeps\fR option. |
60 |
.TP |
61 |
+.BR "\-\-changed\-deps\-report [ y | n ]" |
62 |
+Tells emerge to report ebuilds for which the ebuild dependencies have |
63 |
+changed since the installed instance was built. Behavior with respect to |
64 |
+changed build\-time dependencies is controlled by the |
65 |
+\fB\-\-with\-bdeps\fR option. This option is enabled automatically for |
66 |
+a dependency calculation if the cost of report generation is relatively |
67 |
+insignificant (any calculation exclusively involving binary packages is |
68 |
+exempt). The \fIEMERGE_DEFAULT_OPTS\fR variable may be used to disable |
69 |
+this option by default. |
70 |
+.TP |
71 |
.BR \-\-changed\-use ", " \-U |
72 |
Tells emerge to include installed packages where USE flags have |
73 |
changed since installation. This option also implies the |
74 |
diff --git a/pym/_emerge/create_depgraph_params.py b/pym/_emerge/create_depgraph_params.py |
75 |
index cdea029ba..7d01610bb 100644 |
76 |
--- a/pym/_emerge/create_depgraph_params.py |
77 |
+++ b/pym/_emerge/create_depgraph_params.py |
78 |
@@ -126,6 +126,11 @@ def create_depgraph_params(myopts, myaction): |
79 |
if changed_deps is not None: |
80 |
myparams['changed_deps'] = changed_deps |
81 |
|
82 |
+ changed_deps_report = myopts.get('--changed-deps-report') |
83 |
+ if (changed_deps_report != 'n' and not |
84 |
+ (myaction == 'remove' or '--usepkgonly' in myopts)): |
85 |
+ myparams['changed_deps_report'] = True |
86 |
+ |
87 |
if myopts.get("--selective") == "n": |
88 |
# --selective=n can be used to remove selective |
89 |
# behavior that may have been implied by some |
90 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
91 |
index 27bec3b32..8fd45f3a1 100644 |
92 |
--- a/pym/_emerge/depgraph.py |
93 |
+++ b/pym/_emerge/depgraph.py |
94 |
@@ -462,6 +462,7 @@ class _dynamic_depgraph_config(object): |
95 |
self._highest_pkg_cache = {} |
96 |
self._highest_pkg_cache_cp_map = {} |
97 |
self._flatten_atoms_cache = {} |
98 |
+ self._changed_deps_pkgs = {} |
99 |
|
100 |
# Binary packages that have been rejected because their USE |
101 |
# didn't match the user's config. It maps packages to a set |
102 |
@@ -974,6 +975,90 @@ class depgraph(object): |
103 |
|
104 |
return False |
105 |
|
106 |
+ def _changed_deps_report(self): |
107 |
+ """ |
108 |
+ Report ebuilds for which the ebuild dependencies have |
109 |
+ changed since the installed instance was built. |
110 |
+ """ |
111 |
+ quiet = '--quiet' in self._frozen_config.myopts |
112 |
+ |
113 |
+ report_pkgs = [] |
114 |
+ for pkg, ebuild in self._dynamic_config._changed_deps_pkgs.items(): |
115 |
+ if pkg.repo != ebuild.repo: |
116 |
+ continue |
117 |
+ report_pkgs.append((pkg, ebuild)) |
118 |
+ |
119 |
+ if not report_pkgs: |
120 |
+ return |
121 |
+ |
122 |
+ # TODO: Detect and report various issues: |
123 |
+ # - packages with unsatisfiable dependencies |
124 |
+ # - packages involved directly in slot or blocker conflicts |
125 |
+ # - direct parents of conflict packages |
126 |
+ # - packages that prevent upgrade of dependencies to latest versions |
127 |
+ graph = self._dynamic_config.digraph |
128 |
+ in_graph = False |
129 |
+ for pkg, ebuild in report_pkgs: |
130 |
+ if pkg in graph: |
131 |
+ in_graph = True |
132 |
+ |
133 |
+ # Packages with changed deps are harmless if they're not in the |
134 |
+ # graph, so it's safe to silently ignore them for --quiet mode. |
135 |
+ if quiet and not in_graph: |
136 |
+ return |
137 |
+ |
138 |
+ writemsg("\n%s\n\n" % colorize("WARN", |
139 |
+ "!!! Detected ebuild dependency change(s) without revision bump:"), |
140 |
+ noiselevel=-1) |
141 |
+ |
142 |
+ for pkg, ebuild in report_pkgs: |
143 |
+ writemsg(" %s::%s" % (pkg.cpv, pkg.repo), noiselevel=-1) |
144 |
+ if pkg.root_config.settings["ROOT"] != "/": |
145 |
+ writemsg(" for %s" % (pkg.root,), noiselevel=-1) |
146 |
+ writemsg("\n", noiselevel=-1) |
147 |
+ |
148 |
+ msg = [] |
149 |
+ if not quiet: |
150 |
+ msg.extend([ |
151 |
+ "", |
152 |
+ "NOTE: For the ebuild(s) listed above, a new revision may be warranted if there", |
153 |
+ " has been a dependency change with significant consequences. Refer to the", |
154 |
+ " following page of the Gentoo Development Guide for examples of", |
155 |
+ " circumstances that may qualify:", |
156 |
+ "", |
157 |
+ " https://devmanual.gentoo.org/general-concepts/ebuild-revisions/", |
158 |
+ "", |
159 |
+ " If circumstances qualify, please report a bug which specifies the current", |
160 |
+ " version of the ebuild listed above. Changes to ebuilds from the 'gentoo'", |
161 |
+ " repository (ending with '::gentoo') can be browsed in GitWeb:", |
162 |
+ "", |
163 |
+ " https://gitweb.gentoo.org/repo/gentoo.git/", |
164 |
+ "", |
165 |
+ " Use Gentoo's Bugzilla to report bugs only for the 'gentoo' repository:", |
166 |
+ "", |
167 |
+ " https://bugs.gentoo.org/", |
168 |
+ "", |
169 |
+ " In order to suppress reports about dependency changes, add", |
170 |
+ " --changed-deps-report=n to the EMERGE_DEFAULT_OPTS variable in", |
171 |
+ " '/etc/portage/make.conf'.", |
172 |
+ ]) |
173 |
+ |
174 |
+ # Include this message for --quiet mode, since the user may be experiencing |
175 |
+ # subtle problems that are solvable by using --changed-deps. |
176 |
+ if self._dynamic_config.myparams.get("changed_deps", "n") == "n": |
177 |
+ msg.extend([ |
178 |
+ "", |
179 |
+ "HINT: In order to avoid problems involving changed dependencies, use the", |
180 |
+ " --changed-deps option to automatically trigger rebuilds when changed", |
181 |
+ " dependencies are detected. Refer to the emerge man page for more", |
182 |
+ " information about this option.", |
183 |
+ ]) |
184 |
+ |
185 |
+ for line in msg: |
186 |
+ if line: |
187 |
+ line = colorize("INFORM", line) |
188 |
+ writemsg(line + "\n", noiselevel=-1) |
189 |
+ |
190 |
def _show_ignored_binaries(self): |
191 |
""" |
192 |
Show binaries that have been ignored because their USE didn't |
193 |
@@ -2569,6 +2654,10 @@ class depgraph(object): |
194 |
|
195 |
changed = built_deps != unbuilt_deps |
196 |
|
197 |
+ if (changed and pkg.installed and |
198 |
+ self._dynamic_config.myparams.get("changed_deps_report")): |
199 |
+ self._dynamic_config._changed_deps_pkgs[pkg] = ebuild |
200 |
+ |
201 |
return changed |
202 |
|
203 |
def _create_graph(self, allow_unsatisfied=False): |
204 |
@@ -6354,6 +6443,8 @@ class depgraph(object): |
205 |
changed_deps = ( |
206 |
self._dynamic_config.myparams.get( |
207 |
"changed_deps", "n") != "n") |
208 |
+ changed_deps_report = self._dynamic_config.myparams.get( |
209 |
+ "changed_deps_report") |
210 |
binpkg_changed_deps = ( |
211 |
self._dynamic_config.myparams.get( |
212 |
"binpkg_changed_deps", "n") != "n") |
213 |
@@ -6395,9 +6486,13 @@ class depgraph(object): |
214 |
continue |
215 |
break |
216 |
|
217 |
- if (((installed and changed_deps) or |
218 |
- (not installed and binpkg_changed_deps)) and |
219 |
- self._changed_deps(pkg)): |
220 |
+ installed_changed_deps = False |
221 |
+ if installed and (changed_deps or changed_deps_report): |
222 |
+ installed_changed_deps = self._changed_deps(pkg) |
223 |
+ |
224 |
+ if ((installed_changed_deps and changed_deps) or |
225 |
+ (not installed and binpkg_changed_deps and |
226 |
+ self._changed_deps(pkg))): |
227 |
if not installed: |
228 |
self._dynamic_config.\ |
229 |
ignored_binaries.setdefault( |
230 |
@@ -8753,6 +8848,8 @@ class depgraph(object): |
231 |
|
232 |
self._show_ignored_binaries() |
233 |
|
234 |
+ self._changed_deps_report() |
235 |
+ |
236 |
self._display_autounmask() |
237 |
|
238 |
for depgraph_sets in self._dynamic_config.sets.values(): |
239 |
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py |
240 |
index 6a4bb87d0..fbc2ce01c 100644 |
241 |
--- a/pym/_emerge/main.py |
242 |
+++ b/pym/_emerge/main.py |
243 |
@@ -136,6 +136,7 @@ def insert_optional_args(args): |
244 |
'--binpkg-changed-deps' : y_or_n, |
245 |
'--buildpkg' : y_or_n, |
246 |
'--changed-deps' : y_or_n, |
247 |
+ '--changed-deps-report' : y_or_n, |
248 |
'--complete-graph' : y_or_n, |
249 |
'--deep' : valid_integers, |
250 |
'--depclean-lib-check' : y_or_n, |
251 |
@@ -408,6 +409,12 @@ def parse_opts(tmpcmdline, silent=False): |
252 |
"choices" : true_y_or_n |
253 |
}, |
254 |
|
255 |
+ "--changed-deps-report": { |
256 |
+ "help" : ("report installed packages with " |
257 |
+ "outdated dependencies"), |
258 |
+ "choices" : true_y_or_n |
259 |
+ }, |
260 |
+ |
261 |
"--config-root": { |
262 |
"help":"specify the location for portage configuration files", |
263 |
"action":"store" |
264 |
@@ -833,6 +840,12 @@ def parse_opts(tmpcmdline, silent=False): |
265 |
else: |
266 |
myoptions.changed_deps = 'n' |
267 |
|
268 |
+ if myoptions.changed_deps_report is not None: |
269 |
+ if myoptions.changed_deps_report in true_y: |
270 |
+ myoptions.changed_deps_report = 'y' |
271 |
+ else: |
272 |
+ myoptions.changed_deps_report = 'n' |
273 |
+ |
274 |
if myoptions.changed_use is not False: |
275 |
myoptions.reinstall = "changed-use" |
276 |
myoptions.changed_use = False |
277 |
-- |
278 |
2.13.6 |