Gentoo Archives: gentoo-portage-dev

From: Alec Warner <antarus@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] emerge: add --changed-deps-report option (bug 645780)
Date: Sun, 28 Jan 2018 17:35:31
Message-Id: CAAr7Pr_+hwsZKSy4=p8qp=Y1dxxc=EJsc8psvaTMHTHcGXWxhw@mail.gmail.com
In Reply to: [gentoo-portage-dev] [PATCH] emerge: add --changed-deps-report option (bug 645780) by Zac Medico
1 On Sun, Jan 28, 2018 at 9:51 AM, Zac Medico <zmedico@g.o> wrote:
2
3 > The --dynamic-deps=n default causes confusion for users that are
4 > accustomed to dynamic deps, therefore add a --changed-deps-report
5 > option that is enabled by default (if --usepkgonly is not enabled).
6 >
7 > The --quiet option will suppress the report if none of the packages
8 > having changed dependencies are in the dependency graph, since they
9 > are harmless in that case. If any of these packages *are* in the
10 > dependency graph, then --quiet suppresses the big NOTE section of
11 > the report, but the HINT section is still displayed since it might
12 > help users resolve problems that are solved by --changed-deps.
13 >
14 > Example output is as follows:
15 >
16 > !!! Detected ebuild dependency change(s) without revision bump:
17 >
18 > net-misc/openssh-7.5_p1-r3::gentoo
19 > sys-fs/udisks-2.7.5::gentoo
20 >
21 > NOTE: For the ebuild(s) listed above, a new revision may be warranted if
22 > there
23 > has been a dependency change with significant consequences. Refer to
24 > the
25 > following page of the Gentoo Development Guide for examples of
26 > circumstances that may qualify:
27 >
28 > https://devmanual.gentoo.org/general-concepts/ebuild-revisions/
29 >
30 > If circumstances qualify, please report a bug which specifies the
31 > current
32 > version of the ebuild listed above. Changes to ebuilds from the
33 > 'gentoo'
34 > repository (ending with '::gentoo') can be browsed in GitWeb:
35 >
36 > https://gitweb.gentoo.org/repo/gentoo.git/
37 >
38 > Use Gentoo's Bugzilla to report bugs only for the 'gentoo'
39 > repository:
40 >
41 > https://bugs.gentoo.org/
42 >
43 > In order to suppress reports about dependency changes, add
44 > --changed-deps-report=n to the EMERGE_DEFAULT_OPTS variable in
45 > '/etc/portage/make.conf'.
46 >
47 > HINT: In order to avoid problems involving changed dependencies, use the
48 > --changed-deps option to automatically trigger rebuilds when changed
49 > dependencies are detected. Refer to the emerge man page for more
50 > information about this option.
51 >
52 > Bug: https://bugs.gentoo.org/645780
53
54
55 I can't really support sending this large report to users.
56
57 1) Its fairly common practice today.
58 2) All users will get the report.
59 3) A subset of them will file bugs about the report.
60 4) Devs make a decision about revbumping vs not; there doesn't seem to be a
61 way for devs to say "no this change is intentional, stop nagging users."
62
63 Ultimately I'm unsure what we are trying to accomplish here. Do we think
64 Devs are doing 4 on accident?
65 If so, why can't we give them tools to find it ahead of time (repoman et.
66 al.) or tools to find it post-commit (tinderbox or similar; but these are
67 single-sourced reports.)
68
69 I also feel like we are pushing action onto users here. If we agree with
70 the premise that this is a bug (and devs should always bump) then we don't
71 need users to take any action;
72 we could build automation that sends these 'reports'. Its not like the user
73 is going to add anything interesting to the report. Making them do it by
74 hand just introduces transcription errors in filing. We just need to get
75 their permission to file the reports automatically when portage finds them.
76
77 -A
78
79
80 >
81 > ---
82 > man/emerge.1 | 10 ++++
83 > pym/_emerge/create_depgraph_params.py | 5 ++
84 > pym/_emerge/depgraph.py | 103 ++++++++++++++++++++++++++++++
85 > +++-
86 > pym/_emerge/main.py | 13 +++++
87 > 4 files changed, 128 insertions(+), 3 deletions(-)
88 >
89 > diff --git a/man/emerge.1 b/man/emerge.1
90 > index 3c81b9c9f..9de1b7f74 100644
91 > --- a/man/emerge.1
92 > +++ b/man/emerge.1
93 > @@ -465,6 +465,16 @@ option also implies the \fB\-\-selective\fR option.
94 > Behavior with
95 > respect to changed build\-time dependencies is controlled by the
96 > \fB\-\-with\-bdeps\fR option.
97 > .TP
98 > +.BR "\-\-changed\-deps\-report [ y | n ]"
99 > +Tells emerge to report ebuilds for which the ebuild dependencies have
100 > +changed since the installed instance was built. Behavior with respect to
101 > +changed build\-time dependencies is controlled by the
102 > +\fB\-\-with\-bdeps\fR option. This option is enabled automatically for
103 > +a dependency calculation if the cost of report generation is relatively
104 > +insignificant (any calculation exclusively involving binary packages is
105 > +exempt). The \fIEMERGE_DEFAULT_OPTS\fR variable may be used to disable
106 > +this option by default.
107 > +.TP
108 > .BR \-\-changed\-use ", " \-U
109 > Tells emerge to include installed packages where USE flags have
110 > changed since installation. This option also implies the
111 > diff --git a/pym/_emerge/create_depgraph_params.py
112 > b/pym/_emerge/create_depgraph_params.py
113 > index cdea029ba..7d01610bb 100644
114 > --- a/pym/_emerge/create_depgraph_params.py
115 > +++ b/pym/_emerge/create_depgraph_params.py
116 > @@ -126,6 +126,11 @@ def create_depgraph_params(myopts, myaction):
117 > if changed_deps is not None:
118 > myparams['changed_deps'] = changed_deps
119 >
120 > + changed_deps_report = myopts.get('--changed-deps-report')
121 > + if (changed_deps_report != 'n' and not
122 > + (myaction == 'remove' or '--usepkgonly' in myopts)):
123 > + myparams['changed_deps_report'] = True
124 > +
125 > if myopts.get("--selective") == "n":
126 > # --selective=n can be used to remove selective
127 > # behavior that may have been implied by some
128 > diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
129 > index 27bec3b32..8fd45f3a1 100644
130 > --- a/pym/_emerge/depgraph.py
131 > +++ b/pym/_emerge/depgraph.py
132 > @@ -462,6 +462,7 @@ class _dynamic_depgraph_config(object):
133 > self._highest_pkg_cache = {}
134 > self._highest_pkg_cache_cp_map = {}
135 > self._flatten_atoms_cache = {}
136 > + self._changed_deps_pkgs = {}
137 >
138 > # Binary packages that have been rejected because their USE
139 > # didn't match the user's config. It maps packages to a set
140 > @@ -974,6 +975,90 @@ class depgraph(object):
141 >
142 > return False
143 >
144 > + def _changed_deps_report(self):
145 > + """
146 > + Report ebuilds for which the ebuild dependencies have
147 > + changed since the installed instance was built.
148 > + """
149 > + quiet = '--quiet' in self._frozen_config.myopts
150 > +
151 > + report_pkgs = []
152 > + for pkg, ebuild in self._dynamic_config._changed_
153 > deps_pkgs.items():
154 > + if pkg.repo != ebuild.repo:
155 > + continue
156 > + report_pkgs.append((pkg, ebuild))
157 > +
158 > + if not report_pkgs:
159 > + return
160 > +
161 > + # TODO: Detect and report various issues:
162 > + # - packages with unsatisfiable dependencies
163 > + # - packages involved directly in slot or blocker conflicts
164 > + # - direct parents of conflict packages
165 > + # - packages that prevent upgrade of dependencies to
166 > latest versions
167 > + graph = self._dynamic_config.digraph
168 > + in_graph = False
169 > + for pkg, ebuild in report_pkgs:
170 > + if pkg in graph:
171 > + in_graph = True
172 > +
173 > + # Packages with changed deps are harmless if they're not
174 > in the
175 > + # graph, so it's safe to silently ignore them for --quiet
176 > mode.
177 > + if quiet and not in_graph:
178 > + return
179 > +
180 > + writemsg("\n%s\n\n" % colorize("WARN",
181 > + "!!! Detected ebuild dependency change(s) without
182 > revision bump:"),
183 > + noiselevel=-1)
184 > +
185 > + for pkg, ebuild in report_pkgs:
186 > + writemsg(" %s::%s" % (pkg.cpv, pkg.repo),
187 > noiselevel=-1)
188 > + if pkg.root_config.settings["ROOT"] != "/":
189 > + writemsg(" for %s" % (pkg.root,),
190 > noiselevel=-1)
191 > + writemsg("\n", noiselevel=-1)
192 > +
193 > + msg = []
194 > + if not quiet:
195 > + msg.extend([
196 > + "",
197 > + "NOTE: For the ebuild(s) listed above, a
198 > new revision may be warranted if there",
199 > + " has been a dependency change with
200 > significant consequences. Refer to the",
201 > + " following page of the Gentoo
202 > Development Guide for examples of",
203 > + " circumstances that may qualify:",
204 > + "",
205 > + " https://devmanual.gentoo.org/
206 > general-concepts/ebuild-revisions/",
207 > + "",
208 > + " If circumstances qualify, please
209 > report a bug which specifies the current",
210 > + " version of the ebuild listed above.
211 > Changes to ebuilds from the 'gentoo'",
212 > + " repository (ending with '::gentoo')
213 > can be browsed in GitWeb:",
214 > + "",
215 > + " https://gitweb.gentoo.org/
216 > repo/gentoo.git/",
217 > + "",
218 > + " Use Gentoo's Bugzilla to report
219 > bugs only for the 'gentoo' repository:",
220 > + "",
221 > + " https://bugs.gentoo.org/",
222 > + "",
223 > + " In order to suppress reports about
224 > dependency changes, add",
225 > + " --changed-deps-report=n to the
226 > EMERGE_DEFAULT_OPTS variable in",
227 > + " '/etc/portage/make.conf'.",
228 > + ])
229 > +
230 > + # Include this message for --quiet mode, since the user
231 > may be experiencing
232 > + # subtle problems that are solvable by using
233 > --changed-deps.
234 > + if self._dynamic_config.myparams.get("changed_deps", "n")
235 > == "n":
236 > + msg.extend([
237 > + "",
238 > + "HINT: In order to avoid problems
239 > involving changed dependencies, use the",
240 > + " --changed-deps option to
241 > automatically trigger rebuilds when changed",
242 > + " dependencies are detected. Refer to
243 > the emerge man page for more",
244 > + " information about this option.",
245 > + ])
246 > +
247 > + for line in msg:
248 > + if line:
249 > + line = colorize("INFORM", line)
250 > + writemsg(line + "\n", noiselevel=-1)
251 > +
252 > def _show_ignored_binaries(self):
253 > """
254 > Show binaries that have been ignored because their USE
255 > didn't
256 > @@ -2569,6 +2654,10 @@ class depgraph(object):
257 >
258 > changed = built_deps != unbuilt_deps
259 >
260 > + if (changed and pkg.installed and
261 > + self._dynamic_config.myparams.
262 > get("changed_deps_report")):
263 > + self._dynamic_config._changed_deps_pkgs[pkg]
264 > = ebuild
265 > +
266 > return changed
267 >
268 > def _create_graph(self, allow_unsatisfied=False):
269 > @@ -6354,6 +6443,8 @@ class depgraph(object):
270 > changed_deps = (
271 >
272 > self._dynamic_config.myparams.get(
273 > "changed_deps", "n") !=
274 > "n")
275 > + changed_deps_report =
276 > self._dynamic_config.myparams.get(
277 > + "changed_deps_report")
278 > binpkg_changed_deps = (
279 >
280 > self._dynamic_config.myparams.get(
281 > "binpkg_changed_deps",
282 > "n") != "n")
283 > @@ -6395,9 +6486,13 @@ class depgraph(object):
284 >
285 > continue
286 > break
287 >
288 > - if (((installed and
289 > changed_deps) or
290 > - (not installed and
291 > binpkg_changed_deps)) and
292 > -
293 > self._changed_deps(pkg)):
294 > + installed_changed_deps =
295 > False
296 > + if installed and
297 > (changed_deps or changed_deps_report):
298 > +
299 > installed_changed_deps = self._changed_deps(pkg)
300 > +
301 > + if
302 > ((installed_changed_deps and changed_deps) or
303 > + (not installed and
304 > binpkg_changed_deps and
305 > +
306 > self._changed_deps(pkg))):
307 > if not installed:
308 >
309 > self._dynamic_config.\
310 >
311 > ignored_binaries.setdefault(
312 > @@ -8753,6 +8848,8 @@ class depgraph(object):
313 >
314 > self._show_ignored_binaries()
315 >
316 > + self._changed_deps_report()
317 > +
318 > self._display_autounmask()
319 >
320 > for depgraph_sets in self._dynamic_config.sets.values():
321 > diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
322 > index 6a4bb87d0..fbc2ce01c 100644
323 > --- a/pym/_emerge/main.py
324 > +++ b/pym/_emerge/main.py
325 > @@ -136,6 +136,7 @@ def insert_optional_args(args):
326 > '--binpkg-changed-deps' : y_or_n,
327 > '--buildpkg' : y_or_n,
328 > '--changed-deps' : y_or_n,
329 > + '--changed-deps-report' : y_or_n,
330 > '--complete-graph' : y_or_n,
331 > '--deep' : valid_integers,
332 > '--depclean-lib-check' : y_or_n,
333 > @@ -408,6 +409,12 @@ def parse_opts(tmpcmdline, silent=False):
334 > "choices" : true_y_or_n
335 > },
336 >
337 > + "--changed-deps-report": {
338 > + "help" : ("report installed packages with "
339 > + "outdated dependencies"),
340 > + "choices" : true_y_or_n
341 > + },
342 > +
343 > "--config-root": {
344 > "help":"specify the location for portage
345 > configuration files",
346 > "action":"store"
347 > @@ -833,6 +840,12 @@ def parse_opts(tmpcmdline, silent=False):
348 > else:
349 > myoptions.changed_deps = 'n'
350 >
351 > + if myoptions.changed_deps_report is not None:
352 > + if myoptions.changed_deps_report in true_y:
353 > + myoptions.changed_deps_report = 'y'
354 > + else:
355 > + myoptions.changed_deps_report = 'n'
356 > +
357 > if myoptions.changed_use is not False:
358 > myoptions.reinstall = "changed-use"
359 > myoptions.changed_use = False
360 > --
361 > 2.13.6
362 >
363 >
364 >

Replies