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.
Created attachment 111847 [details] [Portage 2.1.2-r9] emerge -uDNptv --with-bdeps=y world
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
Created attachment 111852 [details] [Portage 2.1.2-r13] emerge -uDNptv --with-bdeps=y world
Created attachment 111854 [details] `sort /var/lib/portage/world`
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).
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.
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.
This has been released in 2.1.2-r14.