FS#35661 - [pacman-contrib] pactree: show the shortest dependency path between packages foo and bar

Attached to Project: Pacman
Opened by Karol Błażewicz (karol) - Wednesday, 05 June 2013, 17:35 GMT
Last edited by Allan McRae (Allan) - Sunday, 06 March 2022, 08:50 GMT
Task Type Feature Request
Category General
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 4.1.2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Can pactree show the shortest dependency path between packages foo and bar?

Why does foo depend on bar?
$ pactree foo
foo
├─a
│ └─b
│ ├─c
│ │ └─d
│ │ └─bar
│ │ ├─e
│ │ ├─f
│ │ └─g
│ │ └─i
│ └─j
│ └─bar
...

Getting 'foo -> j -> bar' would be pretty useful.
Currently I pipe pactree's output to less and search my way from bar to foo.
This task depends upon

Closed by  Allan McRae (Allan)
Sunday, 06 March 2022, 08:50 GMT
Reason for closing:  None
Additional comments about closing:  appears fixed
Comment by Dave Reisner (falconindy) - Friday, 07 June 2013, 12:53 GMT
I really don't understand this request based on the input and expected outputs. Why is 'foo -> j -> bar' relevant? 'j' and 'bar' are both direct dependencies of foo, but so is 'a'...
Comment by Kevin (anonymous_user) - Friday, 07 June 2013, 13:26 GMT
If foo is the only (or one of a few) package to depend on bar, you could do pactree -r bar. This might give you shorter output.
Comment by Karol Błażewicz (karol) - Friday, 07 June 2013, 13:33 GMT
The formatting is messed up, but I may have messed this feature request up even more.

You're right, the shortest path is not 'foo -> j -> bar', but 'foo -> a -> b -> j -> bar'.
If there are multiple paths of the same length, any of them could be printed.
Comment by Olivier Brunel (jjacky) - Friday, 07 June 2013, 15:04 GMT
I stumble upon this and liked the idea, but I'm not really familiar with pactree's source code nor do I know how the output would/should look like, so I just did something similar in pacdep; Just pushed to the branch next[1]. pacdep doesn't really do the same as pactree, so you might not necessary be able to get the results you're looking for, but I figured I might as well mention it.

[1] https://github.com/jjk-jacky/pacdep/tree/next
Comment by Karol Błażewicz (karol) - Friday, 07 June 2013, 16:03 GMT
I haven't figured out the optimal combination of the switches, but

$ ./pacdep -PSs gtk2 | grep ^" pixman"
pixman 727.00 KiB <- cairo-infinality-ultimate <- gtk2
$ ./pacdep -PSs gtk2 | grep ^" glibc"
glibc 31.37 MiB <- pixman <- cairo-infinality-ultimate <- gtk2
$ ./pacdep -PSs gtk2 | grep ^" iana-etc"
iana-etc 3.44 MiB <- filesystem <- glibc <- pixman <- cairo-infinality-ultimate <- gtk2

looks fine. Thanks!

Loading...