File: mkgraphs

package info (click to toggle)
tagcoll 1.6.3-2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 2,500 kB
  • ctags: 2,062
  • sloc: cpp: 10,930; sh: 8,892; makefile: 201; lex: 54; yacc: 27
file content (83 lines) | stat: -rwxr-xr-x 1,353 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash

# Bound graph size
# Fix tooltip (now we have 'foo\nbar\n')
# Build a Celestia universe with the packages
#   (debian universe)
# Use constellations for nodes

TIMELIMIT=60

makegraph() {
	name=$1

	( ulimit -t $TIMELIMIT ; twopi -Tpng $name.dot > $name.png )
	res=$?
	if [ $res -ne 0 ]
	then
		echo "Fail $res"
		if [ $res = 139 ]
		then
			echo "$name.dot crashed"
			mv $name.dot $name.dot.crashed
			return
		elif [ $res = 137 ]
		then
			echo "$name.dot ran for more than $TIMELIMIT seconds"
			mv $name.dot $name.dot.loops
			return
		else
			exit 1
		fi
	fi

	(
		echo "<html><body><map name="node">"
		if ! ( ulimit -t $TIMELIMIT ; twopi -Tcmap $name.dot )
		then
			echo "Failed: $?"
			exit 1
		fi
		echo "</map>"
		echo "<img border='0' src='$name.png' usemap='#node'/>"
		
		echo "<ul>"
		for i in `grep tooltip $name.dot | head -1 | sed 's/.\+tooltip="\(.\+\)".\+/\1/'`
		do
			echo "<li>$i"
		done
		echo "</ul>"

		echo "</body></html>"
	) > $name.html
}

if [ -z $1 ]
then
	for i in node*.dot
	do
		if [ -e stop ]
		then
			rm stop
			exit 0
		fi
		if [ ! -e `basename $i .dot`.html ]
		then
			echo "Building $i"
			makegraph `basename $i .dot`
		else
			echo "Already built $i"
		fi
	done
else
	for i in $*
	do
		if [ -e stop ]
		then
			rm stop
			exit 0
		fi
		echo "Building $i"
		makegraph `basename $i .dot`
	done
fi