Tiny Core Linux
General TC => Programming & Scripting - Unofficial => Topic started by: SvOlli on September 08, 2011, 02:28:34 PM
-
Needs graphviz and optionally eog.
Invoking ./tce-depends.sh graphviz
generates this output:
(http://forum.tinycorelinux.net/index.php?action=dlattach;topic=11382.0;attach=3111)
#!/bin/sh
tcedone="/tmp/tcedone.$$"
touch ${tcedone}
tcedir="$(cat /opt/.tce_dir)"
depends()
{
grep -v "^ *$" 2>/dev/null ${tcedir}/optional/$1.tcz.dep |
while read tce; do
tce=${tce%.tcz}
echo "\"${1}\" -> \"${tce}\""
if ! grep -q "^${tce}.tcz$" ${tcedone}; then
echo ${tce}.tcz >> ${tcedone}
depends "${tce}"
fi
done
}
(
echo "digraph connect {"
echo "rankdir = LR;"
echo "layout = dot;"
echo "node [ shape = box ];"
echo "\"$1\" [ style = filled, fillcolor = lightgrey ];"
depends "$1"
rm -f ${tcedone}
echo "}"
) | dot -Tpng -o${1}.png
eog ${1}.png && rm -f ${1}.png
Edit: included image from attachments
-
Great :D
-
!Like
-
Hi SvOlli,
Just curious: was the script I posted a couple of weeks ago that does the same thing not working for you? http://forum.tinycorelinux.net/index.php/topic,11300.0.html (http://forum.tinycorelinux.net/index.php/topic,11300.0.html)
-
@ixbiran: I obviously can't speak for SvOlli, but I had thought of re-writing your Perl script myself as a shell (or 'awk') script to not require 'perl5.tcz' (and yes, I now that 'microperl-5.8.9.tcz' would probably be enough).
Don't get me wrong, I REALLY like Perl, but I've in the last two years learned how much you can do with just the BusyBox tools, that I sometimes rewrite my own Perl scripts just for the fun of it.
-
@ixbiran: I obviously can't speak for SvOlli, but I had thought of re-writing your Perl script myself as a shell (or 'awk') script to not require 'perl5.tcz' (and yes, I now that 'microperl-5.8.9.tcz' would probably be enough).
Don't get me wrong, I REALLY like Perl, but I've in the last two years learned how much you can do with just the BusyBox tools, that I sometimes rewrite my own Perl scripts just for the fun of it.
Perl is a dependency of Graphviz so you're going to need Perl either way :)
-
Helli ixbrian,
Just curious: was the script I posted a couple of weeks ago that does the same thing not working for you?
I didn't know about your script until now. My script is more a byproduct of my hacking up a script that generates a visual representation of a Qt state machine. It was just the result of having fun for a couple of minutes.
... but I've in the last two years learned how much you can do with just the BusyBox tools, that I sometimes rewrite my own Perl scripts just for the fun of it.
I have not written any perl for several years now, so I've gone out of practice. I'm quicker hacking up a shell script to get things done, than picking up my perl-pieces again.