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: pym/portage/tests/resolver/, pym/_emerge/
Date: Sun, 16 Nov 2014 09:04:04 +0000 (UTC)	[thread overview]
Message-ID: <1416128333.390f90c2bee92ee5c845cdd765824b48ed6718ad.zmedico@gentoo> (raw)

commit:     390f90c2bee92ee5c845cdd765824b48ed6718ad
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 16 04:32:43 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Nov 16 08:58:53 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=390f90c2

_slot_operator_update_probe: fix bug #528610

This fixes a case inside _slot_operator_update_probe where it would
select an inappropriate replacement_parent of a lower version than
desired. The problem is solved by rejecting replacement_parent if its
version is lower than the existing parent, and a downgrade is not
desired.

X-Gentoo-Bug: 528610
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=528610
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

---
 pym/_emerge/depgraph.py                            |  8 +++
 ..._slot_operator_update_probe_parent_downgrade.py | 68 ++++++++++++++++++++++
 2 files changed, 76 insertions(+)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 94eaed8..2a839d0 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1659,6 +1659,7 @@ class depgraph(object):
 		debug = "--debug" in self._frozen_config.myopts
 		selective = "selective" in self._dynamic_config.myparams
 		want_downgrade = None
+		want_downgrade_parent = None
 
 		def check_reverse_dependencies(existing_pkg, candidate_pkg,
 			replacement_parent=None):
@@ -1706,6 +1707,13 @@ class depgraph(object):
 		for replacement_parent in self._iter_similar_available(dep.parent,
 			dep.parent.slot_atom, autounmask_level=autounmask_level):
 
+			if replacement_parent < dep.parent:
+				if want_downgrade_parent is None:
+					want_downgrade_parent = self._downgrade_probe(
+						dep.parent)
+				if not want_downgrade_parent:
+					continue
+
 			if not check_reverse_dependencies(dep.parent, replacement_parent):
 				continue
 

diff --git a/pym/portage/tests/resolver/test_slot_operator_update_probe_parent_downgrade.py b/pym/portage/tests/resolver/test_slot_operator_update_probe_parent_downgrade.py
new file mode 100644
index 0000000..2ec15b6
--- /dev/null
+++ b/pym/portage/tests/resolver/test_slot_operator_update_probe_parent_downgrade.py
@@ -0,0 +1,68 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from portage.tests import TestCase
+from portage.tests.resolver.ResolverPlayground import \
+	ResolverPlayground, ResolverPlaygroundTestCase
+
+class SlotOperatorUpdateProbeParentDowngradeTestCase(TestCase):
+
+	def testSlotOperatorUpdateProbeParentDowngrade(self):
+
+		ebuilds = {
+			"net-nds/openldap-2.4.40-r3": {
+				"EAPI": "5",
+				"RDEPEND": "<sys-libs/db-6.0:= " + \
+					"|| ( sys-libs/db:5.3 sys-libs/db:5.1 )"
+			},
+			"net-nds/openldap-2.4.40": {
+				"EAPI": "5",
+				"RDEPEND": "sys-libs/db"
+			},
+			"sys-libs/db-6.0": {
+				"SLOT": "6.0",
+			},
+			"sys-libs/db-5.3": {
+				"SLOT": "5.3",
+			},
+		}
+
+		installed = {
+			"net-nds/openldap-2.4.40-r3": {
+				"EAPI": "5",
+				"RDEPEND": "<sys-libs/db-6.0:5.3/5.3= " + \
+					"|| ( sys-libs/db:5.3 sys-libs/db:5.1 )"
+			},
+			"sys-libs/db-6.0": {
+				"SLOT": "6.0",
+			},
+			"sys-libs/db-5.3": {
+				"SLOT": "5.3",
+			},
+		}
+
+		world = (
+			"net-nds/openldap",
+		)
+
+		test_cases = (
+			# bug 528610 - openldap rebuild was triggered
+			# inappropriately, due to slot_operator_update_probe
+			# selecting an inappropriate replacement parent of
+			# a lower version than desired.
+			ResolverPlaygroundTestCase(
+				["@world"],
+				success = True,
+				options = { "--update": True, "--deep": True },
+				mergelist = []),
+		)
+
+		playground = ResolverPlayground(ebuilds=ebuilds,
+			installed=installed, world=world, debug=False)
+		try:
+			for test_case in test_cases:
+				playground.run_TestCase(test_case)
+				self.assertEqual(test_case.test_success,
+					True, test_case.fail_msg)
+		finally:
+			playground.cleanup()


             reply	other threads:[~2014-11-16  9:04 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-16  9:04 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-05-04 17:12 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/_emerge/ Zac Medico
2018-04-12  2:45 Zac Medico
2017-09-29 17:24 Zac Medico
2017-06-02  5:41 Zac Medico
2017-04-01  5:48 Zac Medico
2017-03-22  8:59 Zac Medico
2017-03-16  4:51 Zac Medico
2017-03-09 19:36 Zac Medico
2016-08-07 17:55 Zac Medico
2015-11-24 16:45 Zac Medico
2014-10-27  9:26 Zac Medico
2014-09-19  9:28 Zac Medico
2014-09-19  9:17 Zac Medico
2014-09-17 16:35 Zac Medico
2014-09-16 21:04 Brian Dolbec
2014-09-11 21:37 Zac Medico
2014-04-26 19:44 Sebastian Luther
2014-02-16 17:25 Sebastian Luther
2014-02-15 12:40 Sebastian Luther
2014-02-05 19:42 Sebastian Luther
2014-01-07 22:22 Arfrever Frehtes Taifersar Arahesis
2013-12-05 15:38 Brian Dolbec
2013-12-01 10:19 Brian Dolbec
2013-11-27  7:44 Mike Frysinger
2013-08-02  8:26 Zac Medico
2013-07-07 19:16 Zac Medico
2013-07-06 21:45 Zac Medico
2013-03-19 21:06 Zac Medico
2013-03-05  0:56 Zac Medico
2013-02-14  4:45 Zac Medico
2013-02-12  2:50 Zac Medico
2013-02-11 22:51 Zac Medico
2013-02-11  1:58 Zac Medico
2012-12-01 23:23 Zac Medico
2012-10-26  6:06 Zac Medico
2012-10-26  4:57 Zac Medico
2012-07-05  3:16 Zac Medico
2012-06-15 23:04 Zac Medico
2012-02-26 10:00 Zac Medico
2011-11-18  1:26 Zac Medico
2011-09-30  8:30 Zac Medico
2011-09-19  3:05 Zac Medico
2011-09-18 20:08 Zac Medico
2011-09-18 19:42 Zac Medico
2011-09-15  5:10 Zac Medico
2011-09-11 20:43 Zac Medico
2011-06-12 22:13 Zac Medico
2011-05-24 23:59 Zac Medico
2011-05-23  5:40 Zac Medico
2011-05-22 23:49 Zac Medico
2011-05-21  3:49 Zac Medico
2011-05-03 22:59 Zac Medico
2011-04-27 20:40 Zac Medico
2011-02-13 13:55 Zac Medico
2011-02-13 10:23 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=1416128333.390f90c2bee92ee5c845cdd765824b48ed6718ad.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