dependency-graph.sh improved

master
Marc Wäckerlin 8 years ago
parent ca0837c04f
commit e1f6fa76c0
  1. 44
      scripts/dependency-graph.sh

@ -38,8 +38,10 @@ success() {
# commandline parameter evaluation # commandline parameter evaluation
files=${0%/*}/configure.ac files=${0%/*}/configure.ac
short=0
while test $# -gt 0; do while test $# -gt 0; do
case "$1" in case "$1" in
(--short|-s) short=1;;
(--help|-h) less <<EOF (--help|-h) less <<EOF
SYNOPSIS SYNOPSIS
@ -48,6 +50,7 @@ SYNOPSIS
OPTIONS OPTIONS
--help, -h show this help --help, -h show this help
--short, -s short graph with no external dependencies
<files> list of zero or more configure.ac files <files> list of zero or more configure.ac files
(default: ${files}) (default: ${files})
@ -135,19 +138,34 @@ trap 'traperror "$? ${PIPESTATUS[@]}" $LINENO $BASH_LINENO "$BASH_COMMAND" "${FU
########################################################################################## ##########################################################################################
echo "digraph G {" filter() {
for file in $files; do if test $short -eq 1; then
if ! test -e $file; then all=$(cat)
error "file $file not found"; exit 1 allowed=$(sed -n '/"\(.*\)" \[style=solid\];/{s//\1/;H};${x;s/\n//;s/\n/\\|/gp}' <<<"${all}")
sed -n '/"\('"${allowed}"'\)" -> "\('"${allowed}"'\)"/p' <<<"${all}"
else
cat
fi fi
sed -n ' }
/^ *m4_define(x_package_name, */ {s///;s/ *).*//;h;s/.*/& [shape=doublecircle];/p}
/^ *AX_REQUIRE_QT/ {s/.*/qt -> /;G;s/\n//;s/.*/&;/p} echo "digraph G {"
/^ *AX_PKG_REQUIRE(\[\?\([^],]\+\)\]\?, \[\?\([^],]\+\)\]\?.*/ {s//\2 -> /;G;s/\n//;s/.*/&;/p} if test $short -eq 0; then
/^ *AX_PKG_REQUIRE(\[\?\([^],]\+\)\]\?.*/ {s//\1 -> /;G;s/\n//;s/.*/&;/p} echo "node [style=dashed];"
/^ *AX_CHECK_QT/ {s/.*/qt -> /;G;s/\n//;s/.*/& [style=dotted];/p} fi
/^ *AX_PKG_CHECK(\[\?\([^],]\+\)\]\?, \[\?\([^],]\+\)\]\?.*/ {s//\2 -> /;G;s/\n//;s/.*/& [style=dotted];/p} (
/^ *AX_PKG_CHECK(\[\?\([^],]\+\)\]\?.*/ {s//\1 -> /;G;s/\n//;s/.*/& [style=dotted];/p} for file in $files; do
if ! test -e $file; then
error "file $file not found"; exit 1
fi
sed -n '
/^ *m4_define(x_package_name, */ {s//"/;s/ *).*/"/;h;s/.*/& [style=solid];/p}
/^ *AX_REQUIRE_QT/ {s/.*/"qt" -> /;G;s/\n//;s/.*/&;/p}
/^ *AX_PKG_REQUIRE(\[\?\([^],)]\+\)\]\?, \[\?\([^],)]\+\)\]\?.*/ {s//"\2" -> /;G;s/\n//;s/.*/&;/p}
/^ *AX_PKG_REQUIRE(\[\?\([^],)]\+\)\]\?.*/ {s//"\1" -> /;G;s/\n//;s/.*/&;/p}
/^ *AX_CHECK_QT/ {s/.*/"qt" -> /;G;s/\n//;s/.*/& [style=dashed];/p}
/^ *AX_PKG_CHECK(\[\?\([^],)]\+\)\]\?, \[\?\([^],)]\+\)\]\?.*/ {s//"\2" -> /;G;s/\n//;s/.*/& [style=dotted];/p}
/^ *AX_PKG_CHECK(\[\?\([^],)]\+\)\]\?.*/ {s//"\1" -> /;G;s/\n//;s/.*/& [style=dotted];/p}
' $file ' $file
done done
) | filter
echo "}" echo "}"

Loading…
Cancel
Save