Dont think code it

2013-7-9 OpenWRT dependency graph drawing

Here is script that show package compiled package dependencies of
OpenWrt packages. Script reads compiled packages dependencies and
generates GraphViz files and draws graph of all packaged dependencies.
This graph can be used to see how to remove unesesseray dependencies.
Practicaly this script was used to see how overall all system is
designed and if there is some circular dependencies. After there where
removed unnesesarry dependencies generated graph was used to see overall
system design.

*.ipk files are tar.gz archives and can be renamed as *.tar.gz and
opened with GUI or in terminal:

tar -xvf package.ipg

Structure of ipkg files is:

debian-binary - version
\data.tar.gz - here is all rootfs data files
  control - package info here is dependencies and package name.

Here tree based on OpenWRT git commit of 24 May 2013

How to use script, first parametr of script is directory where is all
OpenWrt package files usualy it is under


To use type system-path/openwrt-trunk/bin/platform-name/packages

Output files comes in same directory where script where lunched
generated file name is:

now convert dot file to pdf, psd, png:

dot -Tps $(NAME).dot -o
dot -Tpdf $(NAME).dot -o graph1.pdf
dot -Tpng $(NAME).dot -o graph1.png

All OpenWRT was default selected for default platform there is about
~152 of them the generated totaly 325 dependencies image

There where removed only one level deep dependencies there was
185 of then after first level deep dependencies where removed generated
image is little bit cleaner

Rules with dependecies where removed:

if (A depends on [B,C] and B depends on [C])    and
    there is (edges A->B->C and A->C) then 
        dependency C can be removed from A


add more sophisticated graph algorith
add to remove more dependencies