Adrian Schröter wrote:
Am Montag, 17. August 2009 17:23:16 schrieb Luke Imhoff:
We hit a similar issue on our internal OBS instance, so I made some mods to the server so that a developer could grab a dependency graph and determine all packages that depend on their OBS package (it actually goes down to the Subversion code project itself, but that's not required.) So the developer can be in kernel-source and do svndownstream deps ls and get a listing all OBS packages that depend on kernel-source.
What happens is svndownstream gets a list of all the buildinfos (which a mod to the server merges into one xml file at /build/_builddependencytree) and then uses the bdep entries and some python code in svndownstream (which is built on top of osc) to generate a dependency graph.
The problem with it is my implementation. I couldn't follow all the code in bs_sched, so we had to switch to generating the full depgraph only daily (since it takes 8-9 minutes). I'm sure someone that actually wrote sub buildinfo() or bs_sched could improve on that time since in theory bs_sched has a depgraph already and there's potential for caching if you know you're going to ask for everyone's buildinfo. It's just bs_sched is a big loop and I couldn't figure out how to extract it any of the information it had in it.
We have actually the "whatdependson" call as (the last?) missing feature for our 1.7 release.
We have already the :depend data on the server, so it should be not too hard to get this implemented.
However, I would be very interessted in your code creating the graphes. It would be nice if we could integrate this into our web interface (maybe even interactive via clicking on an item and jump to that package ;)
bye adrian
The main class doing all the calculations based on the /build/_binarytree and /build/_builddependencytree is DependencyGraph in build.py. The binarytree and builddependencytree are just calls to the server that merge together all the _binary or bdeps entries for the _buildinfo calls for all packages. You can infer the layout from DependencyGraph.fetch(). Creating a tree is down in the DependencyGraph.tree(). It gives output like emerge --tree: PROJECT PACKAGE REPOSITORY ARCH DEPENDENT_PROJECT DEPENDENT_PACKAGE DEPENDENT_REPOSITORY DEPENDENT_ARCH The tree is just based on a topological sort (http://en.wikipedia.org/wiki/Topological_sort) generated by DependencyGraph.topologicalSort() that includes the items depth in the tree so the tree can be printed with indentation for the levels. DependencyGraph.dot() will generate a dot file that can be passed to graphviz to make pretty (or scary depending on your point of view and how many things are interdependent) pictures of the dependency graph.