You are not logged in.

#1 2009-03-07 17:48:49

scj
Member
From: Sweden
Registered: 2007-09-23
Posts: 158

pkg-depgraph. like pactree, but with less features.

I've been toying around with scheme and wrote a little package dependency graph generator. It doesn't do much, but it does it fairly fast. It's written in chicken scheme.

The usage is fairly simple, you invoke it with pkg-depgraph <pkg1> ... <pkgN> and it will spit out the dependency graph to stdout. This can (and should) be piped to graphviz's dot to render it into a picture.

It's a bit faster than pactree.

It's now available in AUR.

You can change the default settings by adding this to ~/.config/pkg-depgraph.conf:

; incase you happen to have your database in a non-standard location
(define *db-path* "/var/lib/pacman/local")

; the style applied to the packages queried
(define *style* "[color=black]")

;the style applied to the entire graph. It is a list of strings.
(define *graph-style* '("node [shape=box]"))

This is the dependency graph of pkg-depgraph, generated by pkg-depgraph:
pkg-dep.jpg


As an comparison between pkg-depgraph and pactree.sh, I picked moonlight, which has a fairly large dependency graph, as a benchmark.


time pkg-depgraph moonlight | dot -Tpng -opkg-dep-moonlight.png

pkg-depgraph moonlight  0.04s user 0.02s system 65% cpu 0.086 total
dot -Tpng -opkg-dep-moonlight.png  1.44s user 0.07s system 81% cpu 1.861 total

pkg-depgraph moonlight  0.04s user 0.01s system 55% cpu 0.096 total
dot -Tpng -opkg-dep-moonlight.png  1.41s user 0.07s system 89% cpu 1.651 total

pkg-depgraph moonlight  0.05s user 0.00s system 38% cpu 0.139 total
dot -Tpng -opkg-dep-moonlight.png  1.41s user 0.09s system 85% cpu 1.755 total

time ./pactree.sh -g moonlight

./pactree.sh -g moonlight  5.39s user 2.04s system 79% cpu 9.338 total

./pactree.sh -g moonlight  5.34s user 2.09s system 90% cpu 8.201 total

./pactree.sh -g moonlight  5.29s user 2.12s system 90% cpu 8.181 total

Since chicken is a scheme-to-c compiler, pkg-depgraph can also be compiled as a static binary.

Last edited by scj (2009-03-07 19:44:38)

Offline

#2 2009-03-07 19:23:20

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: pkg-depgraph. like pactree, but with less features.

We accept any patches to pactree to make it faster...

Online

#3 2009-03-08 01:31:00

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: pkg-depgraph. like pactree, but with less features.

wow, that was pretty sweet. also, where is pactree.sh?


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#4 2009-03-08 01:54:25

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: pkg-depgraph. like pactree, but with less features.

test1000 wrote:

also, where is pactree.sh?

pactree is part of pacman-contrib.

Offline

#5 2009-03-08 17:20:02

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: pkg-depgraph. like pactree, but with less features.

pacman-contrib. neever heard about that one before tongue pactree seemed to work fine and doens't need all these deps(sorry for saying that in this thread scj, but you kind of brought it on.)?


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#6 2009-03-08 19:10:25

scj
Member
From: Sweden
Registered: 2007-09-23
Posts: 158

Re: pkg-depgraph. like pactree, but with less features.

test1000 wrote:

pacman-contrib. neever heard about that one before tongue pactree seemed to work fine and doens't need all these deps(sorry for saying that in this thread scj, but you kind of brought it on.)?

As for "all these deps", it is possible to build it as a static binary, making chicken a makedepends instead. But in any case, use it or don't, I don't really care. If you ever find yourself looking at alot of dependency graphs, pkg-depgraph might save you a few milliseconds at a time.

Offline

Board footer

Powered by FluxBB