public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: man/, pym/_emerge/
Date: Tue, 30 Jan 2018 04:24:45 +0000 (UTC)	[thread overview]
Message-ID: <1517286243.5dbddff5525c6ba6d20b0ab33eae6de9ab3081eb.zmedico@gentoo> (raw)

commit:     5dbddff5525c6ba6d20b0ab33eae6de9ab3081eb
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 28 14:03:44 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jan 30 04:24:03 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5dbddff5

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

 man/emerge.1                          | 11 ++++
 pym/_emerge/create_depgraph_params.py |  7 +++
 pym/_emerge/depgraph.py               | 99 +++++++++++++++++++++++++++++++++--
 pym/_emerge/main.py                   | 13 +++++
 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


             reply	other threads:[~2018-01-30  4:24 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30  4:24 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-02-03  3:07 [gentoo-commits] proj/portage:master commit in: man/, pym/_emerge/ Zac Medico
2017-05-14 18:12 Zac Medico
2016-08-08 15:56 Zac Medico
2014-12-07 23:14 Zac Medico
2014-10-21 23:11 Zac Medico
2014-10-20  0:08 Zac Medico
2014-09-24 22:36 Brian Dolbec
2014-06-14 21:46 Alexander Berntsen
2014-06-14 21:46 Alexander Berntsen
2014-06-14 20:58 Alexander Berntsen
2013-07-18 20:25 Zac Medico
2013-07-18 20:23 Zac Medico
2013-02-23 19:17 Zac Medico
2012-12-29 22:35 Zac Medico
2012-12-08  9:25 Zac Medico
2012-11-29  7:53 Zac Medico
2012-10-08 20:30 Zac Medico
2011-12-14  4:47 Zac Medico
2011-10-16 18:58 Zac Medico
2011-10-10 18:05 Zac Medico
2011-09-21 14:00 Zac Medico
2011-09-19 16:03 Zac Medico
2011-09-19 14:15 Zac Medico
2011-09-18 20:16 Zac Medico
2011-07-19  8:38 Zac Medico
2011-06-04 23:32 Zac Medico
2011-06-03  5:40 Zac Medico
2011-05-17  4:31 Zac Medico
2011-05-15 19:20 Zac Medico
2011-05-11 19:04 Zac Medico
2011-04-28 16:16 Zac Medico
2011-04-27 22:07 Zac Medico
2011-04-27 22:03 Zac Medico
2011-04-27 22:00 Zac Medico
2011-03-24 18:18 Zac Medico
2011-03-14 17:52 Zac Medico
2011-02-13  0:24 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1517286243.5dbddff5525c6ba6d20b0ab33eae6de9ab3081eb.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox