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

Bug 169046

Summary: >=portage-2.1.2-r10: --tree does NOT show the dependency tree correctly
Product: Portage Development Reporter: Arfrever Frehtes Taifersar Arahesis (RETIRED) <arfrever>
Component: Core - Interface (emerge)Assignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS, REGRESSION
Priority: High    
Version: 2.1   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 167107    
Attachments: [Portage 2.1.2-r9] emerge -uDNptv --with-bdeps=y world
[Portage 2.1.2-r10] emerge -uDNptv --with-bdeps=y world
[Portage 2.1.2-r13] emerge -uDNptv --with-bdeps=y world
`sort /var/lib/portage/world`
add more "nomerge" nodes to the --tree display
add more "nomerge" nodes to the --tree display

Description Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2007-03-02 21:08:36 UTC
In >=portage-2.1.2-r10 the dependency tree isn't shown correctly.

From emerge.1:
 --tree (-t)
   Shows the dependency tree for the given target by indenting dependencies.

It is more important than showing the reverse of the actual merge order.

I know about bug #158100. I appreciate showing the reverse of the merge order. I suggest that --tree shows both the reverse of the merge order AND the correct dependency tree.

I attach some emerge outputs.
Comment 1 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2007-03-02 21:11:56 UTC
Created attachment 111847 [details]
[Portage 2.1.2-r9] emerge -uDNptv --with-bdeps=y world
Comment 2 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2007-03-02 21:15:39 UTC
Created attachment 111849 [details]
[Portage 2.1.2-r10] emerge -uDNptv --with-bdeps=y world

Outputs of r{11,12} differ only in line:
[ebuild     U ] sys-apps/portage-2.1.2-r13 [2.1.2-r10] USE="-build -doc -epydoc (-selinux)" LINGUAS="pl" 0 kB
Comment 3 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2007-03-02 21:17:09 UTC
Created attachment 111852 [details]
[Portage 2.1.2-r13] emerge -uDNptv --with-bdeps=y world
Comment 4 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2007-03-02 21:30:32 UTC
Created attachment 111854 [details]
`sort /var/lib/portage/world`
Comment 5 Zac Medico gentoo-dev 2007-03-02 21:40:53 UTC
I think I can make the --tree display work better while still displaying packages in the exact reverse merge order.  It seems like it's just a matter of adding "nomerge" nodes wherever possible.

Note that the --tree display is inherently flawed because it can't show multiple parents of a given node.  To solve that, will have to add a new option (see bug #169047).
Comment 6 Zac Medico gentoo-dev 2007-03-03 00:28:44 UTC
Created attachment 111872 [details, diff]
add more "nomerge" nodes to the --tree display

This patch should mostly solve the problem.  It inserts "nomerge" nodes in order to fill in the tree structure.  Packages may appear in the display list multiple times, and will be marked "nomerge" when their position in the list does not correspond to actual merge order.

One flaw in the algorithm as implemented in this patch is that it stops filling in the parents when it encounters a dependency cycle (I noticed this while looking at the output of `emerge -pet world`).  It should work pretty well for most cases though.
Comment 7 Zac Medico gentoo-dev 2007-03-03 01:24:44 UTC
Created attachment 111873 [details, diff]
add more "nomerge" nodes to the --tree display

This improved version actively avoids direct cycles in order to increase the likelihood of traversing all the way up to a root node.  It's in svn r6136.
Comment 8 Zac Medico gentoo-dev 2007-03-03 12:33:32 UTC
This has been released in 2.1.2-r14.