On Wed, Mar 23, 2011 at 3:02 AM, Matt Rice <ratm...@gmail.com> wrote: > On Tue, Mar 22, 2011 at 3:41 PM, Bruno Haible <br...@clisp.org> wrote: >> Simon Josefsson wrote: >>> I didn't know why a >>> certain module was pulled in, and it wasn't immediately clear from the >>> modules I requested. A different way to resolve this problem could be >>> with a 'gnulib-tool --why strdup' command that could print: >>> >>> uniconv/u8-strconv-from-locale >>> uniconv/u8-strconv-from-enc >>> uniconv/u8-conv-from-enc >>> striconveha >>> strdup >>> >>> with the first line being something I manually requested. >>> >>> Just an idea, it might be too much work to implement this logic in shell >>> script. There is complexity because there may be multiple paths too, >>> although I think naming only one would be sufficient. >> >> I think, on the contrary, it would be essential to show all paths, >> otherwise the user does work to cut a dependency and then afterwards notices >> that there are other paths to the particular dependency that are much >> harder to cut. >> >> All this is in the area of graph display, where the graph is a Directed >> Acyclic Graph and 'gnulib-tool --extract-dependencies' provides the links >> between nodes. I won't have time to plunge into this; volunteers welcome. > > the attached shell script seems to work, > though it WILL create a ton of .dot files in your gnulib directory!!! > > the interesting ones are fullgraph-$module.dot. > gnulib.dot is just too big of a graph to do much anything with > > its possible i'm missing some modules due to the use of basename $module, > might need to escape those instead. > > anyhow, the outputted files should be suitable for running with dotty > or dot from graphviz. >
of course i didn't think about false positives caused by grep, which you can see by dotty unlink.dot these showed up as separated graphs. such as unlinkdir graph showing up in fullgraph-unlink.dot. --- old-dot.sh 2011-03-23 03:22:33.566478887 -0700 +++ ./dot.sh 2011-03-23 03:17:17.357394354 -0700 @@ -25,6 +25,6 @@ for module in `./gnulib-tool --list`; do dotfile=fullgraph-`basename $module`.dot echo digraph $module "{" | cat >$dotfile - grep $module gnulib.dot | grep -v "subgraph" | cat >>$dotfile + grep \"$module\" gnulib.dot | cat >>$dotfile echo "}" | cat >>$dotfile done
dot.sh
Description: Bourne shell script