Florian Heckl <[EMAIL PROTECTED]> writes:

> We sometimes seem to have the same ideas. If you haven't yet, you
> might have a look at
> http://florian-heckl.de/ooo/OOODependencies.graffle (to be opened with
> OmniGraffle 3, available at www.omnigroup.com; I wanted to export it
> as a jpeg but aborted after a few minutes without success)
>
Why are you doing that by hand? 

C.P. Hennessy has a canned version here:

http://tools.openoffice.org/project_dependencies.png

And the attached script will generate you a PS file from the current
source tree (graphviz tools required):

#!/bin/bash
#
# MkDep - Version 0.2
# Build Date: Jul 2 , 2004
#
# Generate dependency tree of OOo from build.lst
# and visualize with dot
#
# by Thorsten Behrens
# [EMAIL PROTECTED]
#
# Copyright 2004 Thorsten Behrens
# Complies with the GNU GENERAL PUBLIC LICENSE
# and is released as "Open Source Software".
# NO WARRANTY IS OFFERED FOR THE USE OF THIS SOFTWARE
#
#

# set major stand
BASE_STAND=SRC680
                
# set path prefix where all projects reside
PATH_PREFIX=/develop4/update

# defaulting 
SEARCH_PATH=""
FILTER_LIST=""
MINOR=""

USAGE="Usage: mkdep.sh [-h|-m <major version>|-p <path to source>]
       -h:         this cruft
       -f:         filter out toplevel projects (instset etc.)
       -m <major>: specify major version (default: $BASE_STAND)
       -p <path>:  specify full path to source tree
If no path is specified, /develop4/update/<MAJOR>/<MINOR> is 
used, where automatically the newest minor is selected.
"

while :
do
   case "$1" in
        -f|--filter) FILTER_LIST="test10|instset|instsetoo|epl2x|solenv"; 
shift;;
        -m|--major) BASE_STAND="$2"; shift 2;;
        -p|--path) SEARCH_PATH="$2"; shift 2;;
        -h|--help) printf "$USAGE"; exit 0; shift;;
        -*) echo "$USAGE" >&2; exit 1;;
        *) break;;
        esac
done

if [ $# -gt 0 ]; then 
        echo $usage >&2
        exit 1
fi 

###################################################
#
# Determine stand
#
###################################################
if [ ! -d $SEARCH_PATH ]; then
        echo "$SEARCH_PATH does not exist, looking at default places..." >&2
        SEARCH_PATH=""
fi

if [ -z $SEARCH_PATH ]; then
        # determine latest stand
        MINOR=`ls -td --color=never $PATH_PREFIX/$BASE_STAND/src.m* | sed -e " 
s|/develop4/update/$BASE_STAND/||" | awk "{ if ( NR == 1 ) print }"`

        # setup include path
        INCLUDE_PATH=`ls -td --color=never $PATH_PREFIX/$BASE_STAND/unx* | awk 
"{ if ( NR == 1 ) print }"`/inc.`echo $MINOR | sed -e " s/src.//"`

        # are includes already delivered (i.e. is the stand ready)?
        if [ ! -d $INCLUDE_PATH ]; then
        echo "No UNIX includes delivered yet ($INCLUDE_PATH does not exist)."
        exit 1          
        fi
        if [ ! -f $INCLUDE_PATH/vcl/window.hxx ]; then  
        echo "UNIX includes delivery incomplete ($INCLUDE_PATH/vcl/window.hxx 
does not exist)."
        exit 1
        fi

        # setup search list
        SEARCH_PATH=`ls -td --color=never $PATH_PREFIX/$BASE_STAND/$MINOR`
fi

###################################################
#
# Generate dependency file
#
###################################################

for PRJ in $SEARCH_PATH/*; do
        if [ -f $PRJ/prj/build.lst ]; then
                # TODO: find a proper attribute to change with the project 
size. Color, Line width?
                # PRJ_SIZE=`du -s -L -k $PRJ | awk '{ print $1 }' `
                # LOG_SIZE=`echo "l ($PRJ_SIZE) * 0.2" | bc -l`
                LOG_SIZE=0.4
                if [ -z $FILTER_LIST ]; then
                        head -n 1 $PRJ/prj/build.lst | grep ':' | sed -e 
's/:\+/:/' -e 's/NULL//' -e 's/\\//' -e "s/^\(.*\)/$LOG_SIZE \1/" >> 
$$.dep$BASE_STAND$MINOR
                else
                        # filter out toplevel projects (installation sets), 
they mess up the tree
                        head -n 1 $PRJ/prj/build.lst | grep ':' | egrep -v -i 
"$FILTER_LIST" | sed -e 's/:\+/:/' -e 's/NULL//' -e 's/\\//' -e 
"s/^\(.*\)/$LOG_SIZE \1/" >> $$.dep$BASE_STAND$MINOR
                fi      
        fi      
done

###################################################
#
# Generate dependency graph
#
###################################################

# sed magic: place marker (@) at position where to successively add processed 
input and loop
cat $$.dep$BASE_STAND$MINOR | sed \
        -e ': LOOP' \
        -e '/@$/ {' \
        -e 's/@/;/' \
        -e 'n' -e '}' \
                                  \
        -e 
'/^[^[:space:]]*[[:space:]]\+[^[:space:]]*[[:space:]]\+[^[:space:]]\+[[:space:]]*:[[:space:]]*[^[:space:]]*/
 
s/^\([^[:space:]]*\)[[:space:]]\+[^[:space:]]*[[:space:]]\+\([^[:space:]]*\)[[:space:]]*:[[:space:]]*\(.*\)$/\2
 [height=0.2,width="\1",shape="box",label="\2",[EMAIL PROTECTED]/' \
        -e 
'/^[^[:space:]]*[[:space:]]\+[^[:space:]]*[[:space:]]\+[^[:space:]]\+[[:space:]]*:[[:space:]]*[^[:space:]]*/
 
s/^\([^[:space:]]*\)[[:space:]]\+[^[:space:]]*[[:space:]]\+\([^[:space:]]*\)[[:space:]]*:/\2
 [height=0.2,width="\1",shape="box",label="\2",fontsize=20]@/' \
        -e '/@[[:space:]]*[^[:space:]]\+/ 
s/^\([^[:space:]]*\)\(.*\)@[[:space:]]*\([^[:space:]]*\)[[:space:]]*/\1\2\
\1 -> \3 [dir=back,color="midnightblue",fontsize=20,style="solid"]@/' \
        -e 'b LOOP' | \
sed -e 's/\(.*\)/   \1/' | \
                                                   \
awk 'BEGIN { print "digraph dependencies {" }; { print } END { print "}" }' | \
                                                                                
                                                                                
\
# fill a complete A1 page with graph output (heuristic, works pretty
# well for current office depency graph)
dot -Gratio=fill -Gsize=33,23 -Tps

# to keep dependency file, comment out
#rm $$.dep$BASE_STAND$MINOR
Have fun,

-- 

Thorsten

If you're not failing some of the time, you're not trying hard enough.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to