aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2018-01-28 06:03:44 -0800
committerZac Medico <zmedico@gentoo.org>2018-01-29 20:24:03 -0800
commit5dbddff5525c6ba6d20b0ab33eae6de9ab3081eb (patch)
tree9c4540de402d7d4036d3dcf6b2838c98e79a234e
parentdep_zapdeps: fix virtual/rust handling (bug 645416) (diff)
downloadportage-5dbddff5.tar.gz
portage-5dbddff5.tar.bz2
portage-5dbddff5.zip
emerge: add --changed-deps-report option (bug 645780)
The --dynamic-deps=n default causes confusion for users that are accustomed to dynamic deps, therefore add a --changed-deps-report option that is enabled by default for deep updates (if --usepkgonly is not enabled). The report is entirely suppressed in the following cases in which the packages with changed dependencies are entirely harmless to the user: * --changed-deps or --dynamic-deps is enabled * none of the packages with changed deps are in the graph These cases suppress noise for the unaffected user, even though some of the changed dependencies might be worthy of revision bumps. The --quiet option suppresses the NOTE section of the report, but the HINT section is still displayed since it might help users resolve problems that are solved by --changed-deps. Example output is as follows: !!! Detected ebuild dependency change(s) without revision bump: net-misc/openssh-7.5_p1-r3::gentoo sys-fs/udisks-2.7.5::gentoo NOTE: Refer to the following page for more information about dependency change(s) without revision bump: https://wiki.gentoo.org/wiki/Project:Portage/Changed_Deps In order to suppress reports about dependency changes, add --changed-deps-report=n to the EMERGE_DEFAULT_OPTS variable in '/etc/portage/make.conf'. HINT: In order to avoid problems involving changed dependencies, use the --changed-deps option to automatically trigger rebuilds when changed dependencies are detected. Refer to the emerge man page for more information about this option. Bug: https://bugs.gentoo.org/645780
-rw-r--r--man/emerge.111
-rw-r--r--pym/_emerge/create_depgraph_params.py7
-rw-r--r--pym/_emerge/depgraph.py99
-rw-r--r--pym/_emerge/main.py13
4 files changed, 127 insertions, 3 deletions
diff --git a/man/emerge.1 b/man/emerge.1
index 3c81b9c9f..189e6f879 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -465,6 +465,17 @@ option also implies the \fB\-\-selective\fR option. Behavior with
respect to changed build\-time dependencies is controlled by the
\fB\-\-with\-bdeps\fR option.
.TP
+.BR "\-\-changed\-deps\-report [ y | n ]"
+Tells emerge to report ebuilds for which the ebuild dependencies have
+changed since the installed instance was built. Behavior with respect to
+changed build\-time dependencies is controlled by the
+\fB\-\-with\-bdeps\fR option. If the \fB\-\-update\fR and \fB\-\-deep\fR
+options are enabled then this option is enabled automatically for a
+dependency calculation if the cost of report generation is relatively
+insignificant (any calculation exclusively involving binary packages is
+exempt). The \fIEMERGE_DEFAULT_OPTS\fR variable may be used to disable
+this by default.
+.TP
.BR \-\-changed\-use ", " \-U
Tells emerge to include installed packages where USE flags have
changed since installation. This option also implies the
diff --git a/pym/_emerge/create_depgraph_params.py b/pym/_emerge/create_depgraph_params.py
index cdea029ba..ecd65335c 100644
--- a/pym/_emerge/create_depgraph_params.py
+++ b/pym/_emerge/create_depgraph_params.py
@@ -28,6 +28,7 @@ def create_depgraph_params(myopts, myaction):
# failures, or cause packages to be rebuilt or replaced.
# with_test_deps: pull in test deps for packages matched by arguments
# changed_deps: rebuild installed packages with outdated deps
+ # changed_deps_report: report installed packages with outdated deps
# binpkg_changed_deps: reject binary packages with outdated deps
myparams = {"recurse" : True}
@@ -126,6 +127,12 @@ def create_depgraph_params(myopts, myaction):
if changed_deps is not None:
myparams['changed_deps'] = changed_deps
+ changed_deps_report = myopts.get('--changed-deps-report')
+ if (changed_deps_report != 'n' and
+ not (myaction == 'remove' or '--usepkgonly' in myopts) and
+ deep is True and '--update' in myopts):
+ myparams['changed_deps_report'] = True
+
if myopts.get("--selective") == "n":
# --selective=n can be used to remove selective
# behavior that may have been implied by some
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 27bec3b32..ac0afdf07 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -462,6 +462,7 @@ class _dynamic_depgraph_config(object):
self._highest_pkg_cache = {}
self._highest_pkg_cache_cp_map = {}
self._flatten_atoms_cache = {}
+ self._changed_deps_pkgs = {}
# Binary packages that have been rejected because their USE
# didn't match the user's config. It maps packages to a set
@@ -974,6 +975,86 @@ class depgraph(object):
return False
+ def _changed_deps_report(self):
+ """
+ Report ebuilds for which the ebuild dependencies have
+ changed since the installed instance was built. This is
+ completely silent in the following cases:
+
+ * --changed-deps or --dynamic-deps is enabled
+ * none of the packages with changed deps are in the graph
+ """
+ if (self._dynamic_config.myparams.get("changed_deps", "n") == "y" or
+ self._dynamic_config.myparams.get("dynamic_deps", "n") == "y"):
+ return
+
+ report_pkgs = []
+ for pkg, ebuild in self._dynamic_config._changed_deps_pkgs.items():
+ if pkg.repo != ebuild.repo:
+ continue
+ report_pkgs.append((pkg, ebuild))
+
+ if not report_pkgs:
+ return
+
+ # TODO: Detect and report various issues:
+ # - packages with unsatisfiable dependencies
+ # - packages involved directly in slot or blocker conflicts
+ # - direct parents of conflict packages
+ # - packages that prevent upgrade of dependencies to latest versions
+ graph = self._dynamic_config.digraph
+ in_graph = False
+ for pkg, ebuild in report_pkgs:
+ if pkg in graph:
+ in_graph = True
+ break
+
+ # Packages with changed deps are harmless if they're not in the
+ # graph, so it's safe to silently ignore them. This suppresses
+ # noise for the unaffected user, even though some of the changed
+ # dependencies might be worthy of revision bumps.
+ if not in_graph:
+ return
+
+ writemsg("\n%s\n\n" % colorize("WARN",
+ "!!! Detected ebuild dependency change(s) without revision bump:"),
+ noiselevel=-1)
+
+ for pkg, ebuild in report_pkgs:
+ writemsg(" %s::%s" % (pkg.cpv, pkg.repo), noiselevel=-1)
+ if pkg.root_config.settings["ROOT"] != "/":
+ writemsg(" for %s" % (pkg.root,), noiselevel=-1)
+ writemsg("\n", noiselevel=-1)
+
+ msg = []
+ if '--quiet' not in self._frozen_config.myopts:
+ msg.extend([
+ "",
+ "NOTE: Refer to the following page for more information about dependency",
+ " change(s) without revision bump:",
+ "",
+ " https://wiki.gentoo.org/wiki/Project:Portage/Changed_Deps",
+ "",
+ " In order to suppress reports about dependency changes, add",
+ " --changed-deps-report=n to the EMERGE_DEFAULT_OPTS variable in",
+ " '/etc/portage/make.conf'.",
+ ])
+
+ # Include this message for --quiet mode, since the user may be experiencing
+ # problems that are solvable by using --changed-deps.
+ msg.extend([
+ "",
+ "HINT: In order to avoid problems involving changed dependencies, use the",
+ " --changed-deps option to automatically trigger rebuilds when changed",
+ " dependencies are detected. Refer to the emerge man page for more",
+ " information about this option.",
+ ])
+
+ for line in msg:
+ if line:
+ line = colorize("INFORM", line)
+ writemsg(line + "\n", noiselevel=-1)
+
def _show_ignored_binaries(self):
"""
Show binaries that have been ignored because their USE didn't
@@ -2569,6 +2650,10 @@ class depgraph(object):
changed = built_deps != unbuilt_deps
+ if (changed and pkg.installed and
+ self._dynamic_config.myparams.get("changed_deps_report")):
+ self._dynamic_config._changed_deps_pkgs[pkg] = ebuild
+
return changed
def _create_graph(self, allow_unsatisfied=False):
@@ -6354,6 +6439,8 @@ class depgraph(object):
changed_deps = (
self._dynamic_config.myparams.get(
"changed_deps", "n") != "n")
+ changed_deps_report = self._dynamic_config.myparams.get(
+ "changed_deps_report")
binpkg_changed_deps = (
self._dynamic_config.myparams.get(
"binpkg_changed_deps", "n") != "n")
@@ -6395,9 +6482,13 @@ class depgraph(object):
continue
break
- if (((installed and changed_deps) or
- (not installed and binpkg_changed_deps)) and
- self._changed_deps(pkg)):
+ installed_changed_deps = False
+ if installed and (changed_deps or changed_deps_report):
+ installed_changed_deps = self._changed_deps(pkg)
+
+ if ((installed_changed_deps and changed_deps) or
+ (not installed and binpkg_changed_deps and
+ self._changed_deps(pkg))):
if not installed:
self._dynamic_config.\
ignored_binaries.setdefault(
@@ -8753,6 +8844,8 @@ class depgraph(object):
self._show_ignored_binaries()
+ self._changed_deps_report()
+
self._display_autounmask()
for depgraph_sets in self._dynamic_config.sets.values():
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 6a4bb87d0..fbc2ce01c 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -136,6 +136,7 @@ def insert_optional_args(args):
'--binpkg-changed-deps' : y_or_n,
'--buildpkg' : y_or_n,
'--changed-deps' : y_or_n,
+ '--changed-deps-report' : y_or_n,
'--complete-graph' : y_or_n,
'--deep' : valid_integers,
'--depclean-lib-check' : y_or_n,
@@ -408,6 +409,12 @@ def parse_opts(tmpcmdline, silent=False):
"choices" : true_y_or_n
},
+ "--changed-deps-report": {
+ "help" : ("report installed packages with "
+ "outdated dependencies"),
+ "choices" : true_y_or_n
+ },
+
"--config-root": {
"help":"specify the location for portage configuration files",
"action":"store"
@@ -833,6 +840,12 @@ def parse_opts(tmpcmdline, silent=False):
else:
myoptions.changed_deps = 'n'
+ if myoptions.changed_deps_report is not None:
+ if myoptions.changed_deps_report in true_y:
+ myoptions.changed_deps_report = 'y'
+ else:
+ myoptions.changed_deps_report = 'n'
+
if myoptions.changed_use is not False:
myoptions.reinstall = "changed-use"
myoptions.changed_use = False