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