Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 632202

Summary: sys-apps/portage: slot conflict solver interferes with @preserved-rebuild
Product: Portage Development Reporter: Zac Medico <zmedico>
Component: Core - Interface (emerge)Assignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: esigra
Priority: Normal Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 155723, 631448    

Description Zac Medico gentoo-dev 2017-09-27 22:44:22 UTC
It's possible for the depgraph _solve_non_slot_operator_slot_conflicts to eliminate packages that @preserved-rebuild has selected for rebuild. In this case, it's better to allow the conflict to be resolved by backtracking, which will ultimately choose a version to build that doesn't trigger a conflict. This quick-and-dirty patch solved the problem for me:

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 785c036b8..2afbc7b9c 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1336,6 +1336,13 @@ class depgraph(object):
 				all_parent_atoms.update(
 					self._dynamic_config._parent_atoms.get(pkg, []))
 
+			if (inst_pkg is not None and
+				not self._want_installed_pkg(inst_pkg)):
+				for pkg in sorted(conflict, reverse=True):
+					if not pkg.installed:
+						non_matching_forced.add(pkg)
+						break
+
 			for parent, atom in all_parent_atoms:
 				is_arg_parent = isinstance(parent, AtomArg)
 				is_non_conflict_parent = parent not in conflict_pkgs and \
Comment 1 Zac Medico gentoo-dev 2017-09-28 01:08:25 UTC
This fix is better but it makes SlotConflictUpdateTestCase fail the same way as bug 632210:

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 785c036b8..f0de40178 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1337,7 +1337,8 @@ class depgraph(object):
 					self._dynamic_config._parent_atoms.get(pkg, []))
 
 			for parent, atom in all_parent_atoms:
-				is_arg_parent = isinstance(parent, AtomArg)
+				is_arg_parent = (inst_pkg is not None and
+					not self._want_installed_pkg(inst_pkg))
Comment 2 Zac Medico gentoo-dev 2017-09-29 08:20:19 UTC
Patch sent for review:

https://github.com/gentoo/portage/pull/211
Comment 4 Zac Medico gentoo-dev 2017-10-02 19:37:18 UTC
Released in 2.3.11.