Gentoo Archives: gentoo-commits

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