On Sat, 25 Jan 2014 20:34:51 -0500
Christopher Barry <christopher.r.ba...@gmail.com> wrote:


So, trying to see what depends on what, I discovered debtree - a very
cool script that generates dependency graphs.

# apt-get install debtree

Then I ran it like so:
# debtree -R e17 >/tmp/out.dot \
  && dot -T png -o /tmp/out.png /tmp/out.dot \
  && gpicview /tmp/out.png


See output image here:
http://www.pasteall.org/pic/show.php?id=65797

I hacked up a quick wrapper to make it a bit easier to use.
saveas debgraph somewhere in the path, chown root:root, and chmod 750
watch for any line-wrapping from this email...

-C

#!/bin/bash

# generate a dependency graph of a package

DEBTREE=debtree
DOT=dot
VIEWER=gpicview
TMPDIR=/tmp

[[ "$(id -u)" == "0" ]] || { echo "gotta be root"; exit 1; }

[[ ${#} -gt 0 ]] || {
    echo "generate and view dependency graphs for deb packages"
    echo "Usage: $0 [see 'man debtree' for options] <pkgname>"
    exit 1
}

args=("$@")
TMPFN=${TMPDIR}/${args[${#args[@]} - 1]}_dep-graph

[[ $(which ${DEBTREE}) ]] || {
    echo "Error: $DEBTREE not installed."
    echo "use: apt-get install debtree"
    exit 1
}

[[ $(which ${DOT}) ]] || {
    echo "Error: $DOT not installed."
    echo "use: apt-get install graphviz"
    exit 1
}

[[ $(which ${VIEWER}) ]] || {
    echo "Error: $VIEWER not installed."
    echo "Either install it, or edit $0 with different VIEWER program"
    exit 1
}

${DEBTREE} $@ | ${DOT} -T png -o ${TMPFN}.png <(cat -) \
    && ${VIEWER} ${TMPFN}.png

# after exiting the viewer...
read -p "Delete generated graph ${TMPFN}.png? [Yn] " ans

case ${ans} in
    n|N) :: ;;
    *)   rm -f ${TMPFN}.png ;;
esac

exit $?



------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users

Reply via email to