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

Bug 275217

Summary: sys-apps/portage: implement backtracking for slot conflicts
Product: Portage Development Reporter: Sebastian Luther (few) <SebastianLuther>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 210077, 288499    
Attachments: resolve the circular dep between Scheduler and depgraph; mark all functions as local that aren't used outside of depgraph
move changelog stuff stuff out of depgraph (needs changelog.py)
changelog.py for part2
splits depgraph.select_files into select_files and _resolve
Move all memeber variables of _emerge.depgraph into frozen_config or dynamic_config.
Make emerge mask the first package pulled into the tree in case of a slot conflict and restart the dependency calculation

Description Sebastian Luther (few) 2009-06-23 19:56:19 UTC
Another tale in the quest for a easier to follow portage code.
Comment 1 Sebastian Luther (few) 2009-06-23 19:57:40 UTC
Created attachment 195594 [details, diff]
resolve the circular dep between Scheduler and depgraph; mark all functions as local that aren't used outside of depgraph
Comment 2 Sebastian Luther (few) 2009-06-23 20:17:06 UTC
Created attachment 195595 [details, diff]
move changelog stuff stuff out of depgraph (needs changelog.py)
Comment 3 Sebastian Luther (few) 2009-06-23 20:17:33 UTC
Created attachment 195597 [details, diff]
changelog.py for part2
Comment 4 Zac Medico gentoo-dev 2009-06-23 20:45:14 UTC
(In reply to comment #1)
> Created an attachment (id=195594) [edit]
> resolve the circular dep between Scheduler and depgraph; mark all functions as
> local that aren't used outside of depgraph

Thanks, this is in svn r13676.

(In reply to comment #2)
> Created an attachment (id=195595) [edit]
> move changelog stuff stuff out of depgraph (needs changelog.py)

Thanks, this is in svn r13677.
Comment 5 Sebastian Luther (few) 2009-06-24 11:38:00 UTC
Created attachment 195653 [details, diff]
splits depgraph.select_files into select_files and _resolve

In the long term all decision making shall be made in _resolve. select_files converts its input to args and _resolve uses the args to pull in the root nodes now.
Comment 6 Zac Medico gentoo-dev 2009-06-24 21:08:15 UTC
(In reply to comment #5)
> Created an attachment (id=195653) [edit]
> splits depgraph.select_files into select_files and _resolve

Thanks, this is in svn r13685.
Comment 7 Sebastian Luther (few) 2009-06-30 21:49:54 UTC
Created attachment 196212 [details, diff]
Move all memeber variables of _emerge.depgraph into frozen_config or dynamic_config.

This patch creates two classes in _emerge/depgraph.py: _frozen_depgraph_config and _dynamic_depgraph_config. They are supposed to hold all member variables of _emerge.depgraph. Those that may change after initialization belong to _dynamic_depgraph_config, others to _frozen_depgraph_config. depgraph itself holds only instances of these two classes.
Comment 8 Zac Medico gentoo-dev 2009-06-30 22:06:46 UTC
(In reply to comment #7)
> Created an attachment (id=196212) [edit]
> Move all memeber variables of _emerge.depgraph into frozen_config or
> dynamic_config.

Thanks, this is in svn r13747.
Comment 9 Sebastian Luther (few) 2009-07-01 19:28:27 UTC
Just for reference:

What is left? 
1) Write wrapper functions for _dynamic_config to track changes to it.
2) Write a function that searches the point where offending packages were selected and reverts the dynamic_config to this point.
3) Write a function that figures out what to mask if something goes wrong.
4) modify _resolve to be somehow state less, so we can simply restart from any state.
Comment 10 Zac Medico gentoo-dev 2009-07-03 00:04:20 UTC
As discussed on irc, the simplest way implement backtracking (at least initially) is to try saving choices from depgraph, and then creating a whole new depgraph with slightly different choices. Right now I'm working on making the depgraph constructor take a _frozen_depgraph_config instance as a parameter, so that we can use a single instance for each depgraph we create.
Comment 11 Zac Medico gentoo-dev 2009-07-03 01:33:08 UTC
(In reply to comment #10)
> Right now I'm working on making
> the depgraph constructor take a _frozen_depgraph_config instance as a
> parameter, so that we can use a single instance for each depgraph we create.

This is done in svn r13760, and it's used to optimize resume_depgraph() in r13761.
Comment 12 Zac Medico gentoo-dev 2009-07-03 03:35:11 UTC
I looked at your backtracking patch with the _pref_list_lookup() function and I think that it would be better to use an approach similar to the one used to solve bug #253904, in which _dep_check_composite_db._visible() is used to influence the behavior of dep_zapdeps(). When a package is masked by _dep_check_composite_db._visible(), it appears to dep_zapdeps() that the package is unavailable, and so any choice which pulls in that package will be avoided.
Comment 13 Sebastian Luther (few) 2009-07-03 21:32:58 UTC
Created attachment 196543 [details, diff]
Make emerge mask the first package pulled into the tree in case of a slot conflict and restart the dependency calculation
Comment 14 Zac Medico gentoo-dev 2009-07-04 05:34:48 UTC
(In reply to comment #13)
> Created an attachment (id=196543) [edit]
> Make emerge mask the first package pulled into the tree in case of a slot
> conflict and restart the dependency calculation

Thanks, that's in svn r13769. I added some additional features:

 * display message about missed updates
 * cache frozen_config instance, to optimize performance
 * disable backtracking if it fails, fall back to a normal
Comment 15 Zac Medico gentoo-dev 2009-08-03 23:08:53 UTC
This is fixed in 2.2_rc34.
Comment 16 Zac Medico gentoo-dev 2009-08-05 20:40:20 UTC
Reopening until this is an unmasked release.
Comment 17 Zac Medico gentoo-dev 2009-10-11 00:49:26 UTC
This is fixed in 2.1.7.