[pacman-dev] pactree, view the dependency tree
Hello,
this time I wrote a dependency tree viewer.
Feel free to check it: comments are very welcome.
I especially would like to know how it should behave with packages which
provide another one: I wrote part of the script thinking you couldn't install
two packets providing the same one, but Allan proved me wrong.
At the moment the script is untested with multiple providers, but otherwise it
works quite well.
The design choice of passing the directory instead of the packet name was ugly
in the end, but I was fighting with the scoping in bash at the time, so I
preferred to let things be; I might fix it.
Hope you like it.
I just noticed the ascii art failed me :(
-----------------------------SCRIPT----------------------------------
#!/bin/bash
# here you can set the colors
branch_color="\033[0;33m" #Brown
leaf_color="\033[1;32m" #Light green
leaf2_color="\033[0;32m" #Green
# here you can set the separators
separator=" "
branch_tip="|--"
provides="provides "
########----------------END-OF-CONFIGURABLE-PART----------------#######
# pactree : a simple dependency tree viewer
#
# Copyright (c) 2008 Carlo "carlocci" Bersani
Carlo Bersani wrote:
Hello, this time I wrote a dependency tree viewer. Feel free to check it: comments are very welcome. I especially would like to know how it should behave with packages which provide another one: I wrote part of the script thinking you couldn't install two packets providing the same one, but Allan proved me wrong. At the moment the script is untested with multiple providers, but otherwise it works quite well. The design choice of passing the directory instead of the packet name was ugly in the end, but I was fighting with the scoping in bash at the time, so I preferred to let things be; I might fix it. Hope you like it.
I am going to give this a prod. There is a slightly updated version on the forums (http://bbs.archlinux.org/viewtopic.php?pid=393865). The only question I have for everyone is what is the best way to deal with provides? e.g. Currently:
./pactree glibc |--glibc +--bash provides sh |--glibc |--tzdata
But there is the possibility that multiple installed packages provide something E.g. there are multiple packages that provide imap-server that don't (all) conflict: bincimap/PKGBUILD:provides=('imap-server') courier-imap/PKGBUILD:provides=('imap-server' 'pop3-server') courier-mta/PKGBUILD:provides=('smtp-server' 'imap-server' 'pop3-server' 'courier-imap' 'courier-maildrop') dovecot/PKGBUILD:provides=('imap-server' 'pop3-server') imap/PKGBUILD:provides=('imap-server' 'pop3-server') So what is the best approach here? If possible I think that continuing down the dependency tree if we find one installed provider is good but we should just list the providers if more than one. Any opinions? Allan
Allan McRae wrote:
I am going to give this a prod. There is a slightly updated version on the forums (http://bbs.archlinux.org/viewtopic.php?pid=393865).
The only question I have for everyone is what is the best way to deal with provides? e.g. Currently:
./pactree glibc |--glibc +--bash provides sh |--glibc |--tzdata
But there is the possibility that multiple installed packages provide something E.g. there are multiple packages that provide imap-server that don't (all) conflict:
bincimap/PKGBUILD:provides=('imap-server') courier-imap/PKGBUILD:provides=('imap-server' 'pop3-server') courier-mta/PKGBUILD:provides=('smtp-server' 'imap-server' 'pop3-server' 'courier-imap' 'courier-maildrop') dovecot/PKGBUILD:provides=('imap-server' 'pop3-server') imap/PKGBUILD:provides=('imap-server' 'pop3-server')
So what is the best approach here? If possible I think that continuing down the dependency tree if we find one installed provider is good but we should just list the providers if more than one.
Any opinions?
What pacman does when resolving dependencies is to first look for a package with the literal name (eg sh or imap-server) and if it doesn't exist, then it just picks up the first provider it finds. So just doing the same in pactree is fine. I guess that, as a bonus, you could also display the other providers (without their dep tree), but that is just optional.
participants (3)
-
Allan McRae
-
Carlo Bersani
-
Xavier