public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/tests/resolver/soname/, pym/_emerge/
@ 2017-03-08 19:37 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2017-03-08 19:37 UTC (permalink / raw
  To: gentoo-commits

commit:     7c01a73c5a3ff969ddaa43e91730a7372a8a10c8
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  8 01:30:05 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar  8 19:36:20 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7c01a73c

depgraph: fix backtracking for slot operator rebuilds (bug 612042)

Fix package selection logic to avoid pulling in undesirable
rebuilds/updates during backtracking for slot operator rebuilds.
The undesirable rebuilds/updates have sent some calculations off
course, by triggering more and more rebuilds/updates with each
backtracking run.

In order to solve the problem, make various adjustments to the
package selection logic so that installed packages are preferred
over rebuilds/updates when appropriate. Also update unit tests
to work with these adjustments.

Fixes: 5842e87872fd ("Fix slot operator handling bug")
X-Gentoo-bug: 612042
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=612042
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/_emerge/depgraph.py                                  | 11 +++++++++--
 .../resolver/soname/test_slot_conflict_reinstall.py      | 16 +++++++++++++++-
 pym/portage/tests/resolver/test_slot_abi.py              | 12 +++++-------
 pym/portage/tests/resolver/test_slot_conflict_rebuild.py |  8 +++++++-
 4 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 02a32260a..bb3e307f0 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2304,7 +2304,7 @@ class depgraph(object):
 				# Check for slot update first, since we don't want to
 				# trigger reinstall of the child package when a newer
 				# slot will be used instead.
-				if rebuild_if_new_slot:
+				if rebuild_if_new_slot and dep.want_update:
 					new_dep = self._slot_operator_update_probe(dep,
 						new_child_slot=True)
 					if new_dep is not None:
@@ -6241,7 +6241,7 @@ class depgraph(object):
 							if highest_installed is None or pkg.version > highest_installed.version:
 								highest_installed = pkg
 
-					if highest_installed:
+					if highest_installed and self._want_update_pkg(parent, highest_installed):
 						non_installed = [pkg for pkg in matched_packages \
 							if not pkg.installed and pkg.version > highest_installed.version]
 
@@ -6285,11 +6285,18 @@ class depgraph(object):
 							built_timestamp != installed_timestamp:
 							return built_pkg, existing_node
 
+			inst_pkg = None
 			for pkg in matched_packages:
+				if pkg.installed:
+					inst_pkg = pkg
 				if pkg.installed and pkg.invalid:
 					matched_packages = [x for x in \
 						matched_packages if x is not pkg]
 
+			if (inst_pkg is not None and parent is not None and
+				not self._want_update_pkg(parent, inst_pkg)):
+				return inst_pkg, existing_node
+
 			if avoid_update:
 				for pkg in matched_packages:
 					if pkg.installed and self._pkg_visibility_check(pkg, autounmask_level):

diff --git a/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py b/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py
index f4747611f..f7154442e 100644
--- a/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py
+++ b/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py
@@ -251,13 +251,27 @@ class SonameSlotConflictReinstallTestCase(TestCase):
 				success = True,
 				mergelist = [
 					'[binary]app-misc/B-2',
+					'[binary]app-misc/A-2',
+				]
+			),
+			ResolverPlaygroundTestCase(
+				["@world"],
+				options = {
+					"--ignore-soname-deps": "n",
+					"--usepkgonly": True,
+					"--update": True,
+					"--deep": True,
+				},
+				success = True,
+				mergelist = [
+					'[binary]app-misc/B-2',
 					'[binary]app-misc/C-1',
 					'[binary]app-misc/A-2',
 				]
 			),
 		)
 
-		world = []
+		world = ['app-misc/A']
 
 		playground = ResolverPlayground(binpkgs=binpkgs,
 			installed=installed, world=world, debug=False)

diff --git a/pym/portage/tests/resolver/test_slot_abi.py b/pym/portage/tests/resolver/test_slot_abi.py
index 7263504b8..7dbbebe2f 100644
--- a/pym/portage/tests/resolver/test_slot_abi.py
+++ b/pym/portage/tests/resolver/test_slot_abi.py
@@ -170,23 +170,21 @@ class SlotAbiTestCase(TestCase):
 
 		test_cases = (
 
+			# The first 2 test cases don't trigger a libreoffice rebuild
+			# because sys-libs/db is the only package requested, and a
+			# rebuild is not necessary because the sys-libs/db:4.7 slot
+			# remains installed.
 			ResolverPlaygroundTestCase(
 				["sys-libs/db"],
 				options = {"--oneshot": True},
 				success = True,
-				mergelist = ["sys-libs/db-4.8", "app-office/libreoffice-3.5.4.2"]),
-
-			ResolverPlaygroundTestCase(
-				["sys-libs/db"],
-				options = {"--oneshot": True, "--ignore-built-slot-operator-deps": "y"},
-				success = True,
 				mergelist = ["sys-libs/db-4.8"]),
 
 			ResolverPlaygroundTestCase(
 				["sys-libs/db"],
 				options = {"--oneshot": True, "--usepkg": True},
 				success = True,
-				mergelist = ["[binary]sys-libs/db-4.8", "app-office/libreoffice-3.5.4.2"]),
+				mergelist = ["[binary]sys-libs/db-4.8"]),
 
 			ResolverPlaygroundTestCase(
 				["sys-libs/db"],

diff --git a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
index 2dfa79cc2..95b6396ba 100644
--- a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
+++ b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
@@ -165,7 +165,7 @@ class SlotConflictRebuildTestCase(TestCase):
 				["app-misc/A"],
 				ignore_mergelist_order=True,
 				all_permutations=True,
-				options = {"--backtrack": 3, '--deep': True},
+				options = {"--backtrack": 3, '--update': True, '--deep': True},
 				success = True,
 				mergelist = expected_mergelist),
 		)
@@ -229,6 +229,12 @@ class SlotConflictRebuildTestCase(TestCase):
 			ResolverPlaygroundTestCase(
 				["app-misc/A"],
 				success = True,
+				mergelist = ['app-misc/A-2']),
+
+			ResolverPlaygroundTestCase(
+				["app-misc/A"],
+				options={"--update": True, "--deep": True},
+				success = True,
 				mergelist = ['app-misc/B-2', 'app-misc/C-1', 'app-misc/A-2']),
 		)
 


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-08 19:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-08 19:37 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/tests/resolver/soname/, pym/_emerge/ Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox