summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2010-10-27 05:29:39 +0000
committerMorgan Deters <mdeters@gmail.com>2010-10-27 05:29:39 +0000
commit12ce65216cf464f4a894ca4640895d29a638d681 (patch)
tree037575c9336bd3a3b6fccf78486aa2cf901331e7 /contrib
parent1f91455b66ae2d10ddec6a70c7758026162eeead (diff)
support focus on a particular subpackage (e.g. "expr")
Diffstat (limited to 'contrib')
-rwxr-xr-x[-rw-r--r--]contrib/depgraph38
1 files changed, 29 insertions, 9 deletions
diff --git a/contrib/depgraph b/contrib/depgraph
index c03c2209f..e85bcd694 100644..100755
--- a/contrib/depgraph
+++ b/contrib/depgraph
@@ -10,15 +10,23 @@ progname=`basename "$0"`
postproc='sort -u'
mode=packages
+target=
if [ $# -gt 0 ]; then
- if [ $# -eq 1 -a "$1" = "-a" ]; then
+ if [ "$1" = "-a" ]; then
postproc=cat
mode=headers
- else
- echo "usage: $progname [-a]"
+ shift
+ fi
+ if [ $# -gt 0 -a "$1" != "-h" ]; then
+ target="$1"
+ shift
+ fi
+ if [ $# -gt 0 ]; then
+ echo "usage: $progname [-a] [target]"
echo " -a ("all") produces _all_ headers in the source, with clusters for packages."
- echo " the default behavior produces just package dependence information."
+ echo " the default behavior produces just package dependence information."
+ echo " with target, focus on dependences of that particular package (e.g. \"expr\")"
exit 1
fi
fi
@@ -56,6 +64,7 @@ if [ "$mode" = headers ]; then
file=`echo "$path" | sed 's,^[^/]*/,,'`
package=`echo "$file" | sed 's,^\(.*\)/.*,\1,'`
file=`echo "$file" | sed 's,^.*/,,'`
+ if [ -n "$target" -a "$target" != "$package" ]; then continue; fi
if [ -n "$oldpackage" -a "$package" != "$oldpackage" ]; then
echo ' }'
fi
@@ -76,6 +85,7 @@ for path in $paths; do
package=`echo "$file" | sed 's,^\(.*\)/.*,\1,'`
file=`echo "$file" | sed 's,^.*/,,'`
incs=`grep '^# *include *".*"' "$path" | sed 's,^# *include *"\(.*\)".*,\1,'`
+ if [ -n "$target" -a "$target" != "$package" ]; then continue; fi
for inc in $incs; do
case "$inc" in
expr/expr.h) inc=expr/expr_template.h ;;
@@ -99,13 +109,23 @@ for path in $paths; do
fi
incpath=`echo "$incpath" | sed 's,^\./,,'`
incpath=`echo "$incpath" | sed "s,^$dir/,,"`
+ incdir=`echo "$incpath" | sed 's,^\([^/]*\).*,\1,'`
+ incpackage=`echo "$incpath" | sed 's,^\(.*\)/.*,\1,'`
+ incfile=`echo "$incpath" | sed 's,^.*/,,'`
if [ "$mode" = packages ]; then
- incdir=`echo "$incpath" | sed 's,^\([^/]*\).*,\1,'`
- incpackage=`echo "$incpath" | sed 's,^\(.*\)/.*,\1,'`
- incfile=`echo "$incpath" | sed 's,^.*/,,'`
- [ "$package" != "$incpackage" ] && echo " \"$package\" -> \"$incpackage\";"
+ if [ "$package" != "$incpackage" ]; then
+ if [ -n "$target" ]; then
+ echo " \"$package\" -> \"$incpackage\"[label=\"$incfile\"];"
+ else
+ echo " \"$package\" -> \"$incpackage\";"
+ fi
+ fi
else
- echo " \"$package/$file\" -> \"$incpath\";"
+ if [ -n "$target" ]; then
+ [ "$package" != "$incpackage" ] && echo " \"$package/$file\" -> \"$incpackage\"[label=\"$incfile\"];"
+ else
+ echo " \"$package/$file\" -> \"$incpath\";"
+ fi
fi
done
done | $postproc
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback