You are not logged in.
The program has been completely rewritten in C and is included in pacman, so you shouldn't need to download anything. 2011-09-16
pactree - a dependency tree viewer
FEATURING
colored output: wowza
no duplicates: useful for backups
silent mode: useful to check for inconsistencies in the database
max-depth: self explanatory
image creation: generates a png of the dependency tree with graphviz (as of 20080719)Examples:
Grab the script here http://carlocci.ngi.it/arch/pactree
Enjoy
There used to be the code here
edit: fixed some bugs
edit2: fixed a minor bug I noticed thanks to marxav: it didn't strip the version number from the dependencies.
edit3: added something which should return colors to normal at the end of the script for users that don't set the colors in PS1
edit4: added graphviz support
It looks like the post was too long so you can grab the script at the link I placed at the beginning of the post
Last edited by carlocci (2011-09-17 00:53:37)
Offline
I am really liking this script. I will bump it on the pacman-dev list now to get comments on how provides should best be handled so this can be included with the pacman 3.2 release in the next week or so.
I will add a couple of comments here too:
> ./pactree glibc
|--glibc
+--bash provides bash
|--glibc
|--tzdata
I think you can see the problem there!
Also, currently the depth limiter requires a space in the parameter list (pactree -d 2 blah). That took me a while to figure out as I kept trying "pactree -d2 blah". Anyway you can get both to work?
Offline
> ./pactree glibc |--glibc +--bash provides bash |--glibc |--tzdata
I think you can see the problem there!
I'll answer like I did in the script source:
# bash scoping ;_;
I fixed it now.
Also, currently the depth limiter requires a space in the parameter list (pactree -d 2 blah). That took me a while to figure out as I kept trying "pactree -d2 blah". Anyway you can get both to work?
I wanted to add that, but I thought it was too hard. In the end it wasn't.
Offline
Wow I love it !!
pactree -c pacman
|--pacman
|--gcc-libs
|--bash
|--glibc
+--bash provides sh
|--tzdata
Offline
I fixed another bug.
Wow I love it !!
pactree -c pacman |--pacman |--gcc-libs |--bash |--glibc +--bash provides sh |--tzdata
With you, sir, I doubled the userbase!
If this trend keeps going, in a month more than a billion people will be using this script!
Last edited by carlocci (2008-07-16 23:19:57)
Offline
You are very enthusiastic LOL.
Offline
I did something similar a few weeks ago, except it uses graphviz to generate an imagefile of the dependency graph.
#!/bin/bash
# dgraph - pacman dependency graph generator
type="png"
insert(){
foundpkg=( ${foundpkg[@]} $1 )
}
is_in(){
for i in $(seq 0 ${#foundpkg[@]}); do
if [ "$1" == "${foundpkg[$i]}" ]; then
return 0
fi
done
return 1
}
deps(){
pacman -Qi $1 2> /dev/null | grep "Depends On" | gawk -F: '{print $2}' | sed -re 's|[<>=]+[0-9\.]+||g'
}
depgraph(){
pkg=$1
shift
insert $pkg
de=$(deps $pkg)
for d in $de; do
if [ "$d" != "None" ] ; then
echo \"$pkg\" '->' \"$d\"';'
fi
done
for d in $de; do
is_in $d || depgraph $d
done
}
run() {
echo digraph deps{
depgraph $1
echo }
}
run $1 | dot -T$type -o $1.deps.$type
So if you run
dgraph pacman
it will generate the file pacman.deps.png in the current directory that looks like this.
Offline
That is quite cool, let me steal that idea
Offline
That is quite cool, let me steal that idea
Add color to the graph like the textbase you built
Offline
So if you run
dgraph pacman
it will generate the file pacman.deps.png in the current directory that looks like this.
pretty cool! thanks
Offline
Nice script!..but..
Not sure if this has been fixed or not, but I noticed it isn't handling the terminal colors quite right. After I run it, my default terminal color has changed.
Here is a screenshot showing what I mean: http://spinjax.com/arch-images/pactree-color.png
Keep up the good work.
Offline
Not sure if this has been fixed or not, but I noticed it isn't handling the terminal colors quite right. After I run it, my default terminal color has changed.
Here is a screenshot showing what I mean: http://spinjax.com/arch-images/pactree-color.png
You are right: as I set the prompt colors in the PS1 variable I never experienced this problem.
I added
echo -ne '\033[0m' # return colors to normal?
at the end of the script which should do the trick.
Offline
I added the graphviz support. You can edit the colors at the beginning of the script.
Here's an example: the kopete dependency tree!
http://it.tinypic.com/view.php?pic=16c6dz8&s=4
Offline
Hey you were fast in adding colors !! Lovely
Offline
I just had an idea. If I wanted to run pactree on a package that is not installed yet so I have an idea as to what the installation involves in terms of dependencies.
Within the dependencies of the uninstalled packages, there might be packages that are already installed. Many will not be installed of course. These could show in red. And while we are there, a summary of the MB already installed and the MB to be installed...
Offline
Very nice, I wrote something similar once but it wasn't very good. Nice work!
Do you mind if I distribute this tool with my pkgtools package in AUR? You will of course be given full credit, and if you like, I can set you up with push access to my github repo for it.
Last edited by Daenyth (2008-07-19 20:15:10)
[git] | [AURpkgs] | [arch-games]
Offline
Hey! I have already flagged this for inclusion in pacman's contrib section and thus in the pacman-contrib package. No stealing!
I wouldn't mind something like the pt-pacfix script for inclusion there too...
Offline
I'd appreciate it if you included my pkgtools in pacman-contrib too
[git] | [AURpkgs] | [arch-games]
Offline
I just had an idea. If I wanted to run pactree on a package that is not installed yet so I have an idea as to what the installation involves in terms of dependencies.
I approve of this idea!
It is easy to implement too, although the way I wrote the script, which I considered fancy and smart in the beginning, begins to show its inherent limitations.
Very nice, I wrote something similar once but it wasn't very good. Nice work!
Do you mind if I distribute this tool with my pkgtools package in AUR? You will of course be given full credit, and if you like, I can set you up with push access to my github repo for it.
You flatter my e-pe-nis!
You are all free to do as you please with the script, the more people finds this useful, the happier I am; hell, I couldn't stop you even if I wanted due to the GPL
Hey! I have already flagged this for inclusion in pacman's contrib section and thus in the pacman-contrib package. No stealing!
hooray!
I wouldn't mind something like the pt-pacfix script for inclusion there too...
I had a nice idea for a pacfix script and parsing the package versions and names for a cleaning cache script is so impossible my mind is blown away.
Offline
man this is such a helpful piece of work..another set of thanks from me!
I need real, proper pen and paper for this.
Offline
I'd appreciate it if you included my pkgtools in pacman-contrib too
Can be done... Just send stuff to the pacman-dev list and its inclusion gets discussed there.
Someone already submitted a pacfile/pkgfile script which hasn't made the main codebase yet. I will probably include one in the next pacman-contrib release anyway.
Offline
I am really liking this script. I will bump it on the pacman-dev list now to get comments on how provides should best be handled so this can be included with the pacman 3.2 release in the next week or so.
Do you still plan to have this included in 3.2 source tarball?
pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))
Offline
Allan wrote:I am really liking this script. I will bump it on the pacman-dev list now to get comments on how provides should best be handled so this can be included with the pacman 3.2 release in the next week or so.
Do you still plan to have this included in 3.2 source tarball?
Yes, carlocci is going to submit the latest version as a patch.... aren't you!
If it doesn't make it in time, I will stick it into pacman-contrib package anyway. Still, it would be preferable to end up in the tarball.
Offline
shining wrote:Allan wrote:I am really liking this script. I will bump it on the pacman-dev list now to get comments on how provides should best be handled so this can be included with the pacman 3.2 release in the next week or so.
Do you still plan to have this included in 3.2 source tarball?
Yes, carlocci is going to submit the latest version as a patch.... aren't you!
Yes, master.
"Unfortunately" the date I set off on my trip to visit Quebec is drawing closer and closer, so my internet attention span gets smaller and smaller
Offline
Allan wrote:shining wrote:Do you still plan to have this included in 3.2 source tarball?
Yes, carlocci is going to submit the latest version as a patch.... aren't you!
Yes, master.
"Unfortunately" the date I set off on my trip to visit Quebec is drawing closer and closer, so my internet attention span gets smaller and smaller
Québec? Stopping by Gatineau ? LOL
Offline