3 # usage: dependency_graph.sh <product> <version> <quals>
4 # will make <product>_<version>_<quals>_graph.pdf dependency tree using graphviz
5 # it sets up the dune environment and then the product and qualifier
6 # requires dot for taking the graphviz file and making a PDF graph
9 if [ x`echo $curprod | grep geant4` = x ]; then
10 if [ x`echo $curprod | grep mrb` = x ]; then
11 if [ x`echo $prod | grep cetpkgsupport` = x ]; then
12 if [ x`echo $prod | grep xerces_c` = x ]; then
13 if [ x`echo $prod | grep gcc` = x ]; then
14 echo "$curprod -> $prod"
23 function printprodver {
24 echo $prod [label=\"$prod\\n$prodver\"]
25 echo $curprod [label=\"$curprod\\n$curprodver\"]
30 # make a temporary file containing all the ups active's of all setup products
32 tempfile=`mktemp /tmp/deptreegraphviz.tmp.XXXXXX`
35 ups active | grep -v "Active ups products:" | while read iline
39 ups depend $ilc >> $tempfile
43 # need to read in without collapsing spaces. IFS does this but ups depend gags on that,
44 # so run ups depend and catch the output in a separate file
48 cat $tempfile | while read -r iline2
51 if [ x`echo $iline2 | grep $matchstr` = x ]; then
55 prod=`echo $iline2 | cut -d ' ' -f1`
56 prodver=`echo $iline2 | cut -d ' ' -f2`
62 plist[$curlev]=$curprod
63 plistver[$curlev]=$curprodver
66 # found a |__ -- downlevel product
68 dv1=`echo $iline2 | grep -b -o $matchstr | awk 'BEGIN {FS=":"}{print $1}'`
72 jprod1=${iline2/*|__/}
73 prod=`echo $jprod1 | cut -d ' ' -f1`
74 prodver=`echo $jprod1 | cut -d ' ' -f2`
76 if [ $depth = $clp1 ]; then
78 elif [ $depth -gt $clp1 ]; then
80 curprodver=$lastprodver
82 plist[$curlev]=$curprod
83 plistver[$curlev]=$curprodver
87 curprod=${plist[$curlev]}
88 curprodver=${plistver[$curlev]}
94 done # loop over lines in tempfile
101 if [ "$1" == "--help" ]; then
102 echo "Usage: dependency_graph.sh <product> <version> <qualifiers> to make a file <product>_<version>.pdf showing"
103 echo "the dependency tree. This version suppresses GEANT4's dependencies as well as mrb and cetpkgsupport"
108 source /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh
111 TF=`mktemp /tmp/dtgv.tmp.XXXXXX`
115 echo digraph G { > $TF
116 makegraph | sort | uniq >> $TF
119 dot -Tpdf -o $1_$2_$3_graph.pdf $TF