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: lib/portage/tests/resolver/, lib/_emerge/
Date: Sat, 14 Mar 2020 20:57:11 +0000 (UTC)	[thread overview]
Message-ID: <1584218135.3e7d37b7cec0978363fc99b089bd69caefe1b826.zmedico@gentoo> (raw)

commit:     3e7d37b7cec0978363fc99b089bd69caefe1b826
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 14 19:59:22 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Mar 14 20:35:35 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=3e7d37b7

depgraph: respect --deep=<depth> with --update (bug 712298)

Fix the _wrapped_select_pkg_highest_available_imp method to select an
installed package when appropriate for the current --deep=<depth>
setting, even with --update enabled. This prevents violation of the
current --deep=<depth> setting in cases where an installed package
which satisfies a dependency is masked for any reason.

Bug: https://bugs.gentoo.org/712298
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/_emerge/depgraph.py                  |  8 ++++++--
 lib/portage/tests/resolver/test_depth.py | 18 ++++++++++++++++--
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index a8ccd270d..6d1f62178 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import division, print_function, unicode_literals
@@ -6371,7 +6371,11 @@ class depgraph(object):
 					cpv = pkg.cpv
 					reinstall_for_flags = None
 
-					if not pkg.installed or \
+					if pkg.installed and parent is not None and not self._want_update_pkg(parent, pkg):
+						# Ensure that --deep=<depth> is respected even when the
+						# installed package is masked and --update is enabled.
+						pass
+					elif not pkg.installed or \
 						(matched_packages and not avoid_update):
 						# Only enforce visibility on installed packages
 						# if there is at least one other visible package

diff --git a/lib/portage/tests/resolver/test_depth.py b/lib/portage/tests/resolver/test_depth.py
index cb1e2dd5d..ea7c803bb 100644
--- a/lib/portage/tests/resolver/test_depth.py
+++ b/lib/portage/tests/resolver/test_depth.py
@@ -1,4 +1,4 @@
-# Copyright 2011 Gentoo Foundation
+# Copyright 2011-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 from portage.tests import TestCase
@@ -9,6 +9,17 @@ class ResolverDepthTestCase(TestCase):
 
 	def testResolverDepth(self):
 
+		profile = {
+			"package.mask":
+				(
+					# Mask an installed package (for which an update is
+					# available) in order to test for bug 712298, where
+					# --update caused --deep=<depth> to be violated for
+					# such a package.
+					"<dev-libs/B-2",
+				),
+		}
+
 		ebuilds = {
 			"dev-libs/A-1": {"RDEPEND" : "dev-libs/B"},
 			"dev-libs/A-2": {"RDEPEND" : "dev-libs/B"},
@@ -65,6 +76,9 @@ class ResolverDepthTestCase(TestCase):
 		world = ["dev-libs/A"]
 
 		test_cases = (
+			# Test for bug 712298, where --update caused --deep=<depth>
+			# to be violated for dependencies that were masked. In this
+			# case, the installed dev-libs/B-1 dependency is masked.
 			ResolverPlaygroundTestCase(
 				["dev-libs/A"],
 				options = {"--update": True, "--deep": 0},
@@ -243,7 +257,7 @@ class ResolverDepthTestCase(TestCase):
 			)
 
 		playground = ResolverPlayground(ebuilds=ebuilds, installed=installed,
-			world=world)
+			profile=profile, world=world)
 		try:
 			for test_case in test_cases:
 				playground.run_TestCase(test_case)


             reply	other threads:[~2020-03-14 20:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-14 20:57 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-01-08  8:58 [gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/ Zac Medico
2023-12-26 21:05 Zac Medico
2023-11-29 19:55 Zac Medico
2023-11-25  6:30 Zac Medico
2021-01-11  7:27 Zac Medico
2020-12-02  8:32 Zac Medico
2020-08-31  6:22 Zac Medico
2020-04-12  1:52 Zac Medico
2020-02-15  0:58 Zac Medico
2019-12-26 23:00 Zac Medico
2019-12-06  4:06 Zac Medico
2019-11-26 20:35 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=1584218135.3e7d37b7cec0978363fc99b089bd69caefe1b826.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