Dependency graph v2
By Pierre-Yves on Friday, December 17 2010, 19:32 - Permalink
Small update about the dependency graph story.
Quelques nouvelles sur cette histoire de graphique de dépendances.
English version (Pas de française)
Few days ago (one week to be precise), I was presenting a small python script to generate dependency graph.
I was then pointed that, it is similar to rpmorphan, that it does not deal with Provides and that the story was anyway more complicated than what I was doing. So it was nice but unfinished business.
Yesterday, akurtakov asks me if I could have a look at
repoquery --tree-requires <package>
and see if I could make a dot file out of it.
So I gave it a shot and wrote generateDependencyList2.py. This script takes a folder with spec files or a given package name, runs repoquery --tree-requires <package>
and parse the output to generate a SVG picture of the first level dependencies.
This was nice and looked nice until sochotni asked this morning if we could get the same picture but for the command:
repoquery --tree-whatrequires <package>
Of course, the script works in the same way, but it is kinda quick and dirty solution. So I decided that the best would actually to try to get this within repoquery.
After speaking with Seth I therefore wrote another small python script (package-graph.py) which I have submitted for comments on yum-devel. If this work out, we should be able to quickly and simply get the graph of packages depending / requiring the given package.
Feel free to test this new version and make RFE :-)
To use it:
- Download the script from http://pingou.fedorapeople.org/package-graph.py
- Put it in /usr/bin (it needs repoquery's code)
- package-graph.py --package=foo > foo.dot
- twopi -Tsvg -O foo.dot
- eog foo.dot.svg
Comments
$ wget http://pingou.fedorapeople.org/pack...
# mv /home/bochecha/Downloads/package-graph.py /usr/bin/
# chmod u+x /usr/bin/package-graph.py
$ package-graph.py
Traceback (most recent call last):
File "/usr/bin/package-graph.py", line 25, in <module>
from repoquery import YumBaseQuery
ImportError: No module named repoquery
Yes, repoquery is installed here, any idea why it doesn't work?
I guess a better solution would be to move the repoquery code to be a proper Python module (in /usr/lib/python/site-packages/) and have the /usr/bin/repoquery script be a simple wrapper around it.
That would make it easier on your own script as well.
Anyway, that's pretty awesome, thanks. :)