Debian Codegraph @

doc/SystemTap_Tapset_Reference/tapcheck.sh

raw
1 #!/bin/sh
2
3 #check to make sure a tapsets.tmpl file exists
4 if [ ! -f tapsets.tmpl ]; then
5 echo "Error: tapsets.tmpl doesn't exist in the current directory!"
6 exit 1
7 fi
8 # list the tapsets in the tapsets.tmpl file and properly format the
9 # file names
10 grep "\.stp" tapsets.tmpl | grep ! | sed 's/!Itapset\///g' > checkfile2
11
12 # change to the tapset directory and check the tapsets there
13 # check to see if directory is present first
14 if [ ! -d ../../tapset/ ]; then
15 echo "Error: tapsets directory doesn't exist!"
16 exit 1
17 fi
18 (cd ../../tapset/; find -path "*.stp") | sed 's/\.\///g' > checkfile1
19 #might as well check for the functions that are documented in
20 #langref now too
21 (cd ../../tapset/; find -path "*.stp" -exec grep -H sfunction {} \; ) \
22 | sed 's/\.\///g' | cut -d : -f 1 | sort -d | uniq > tap1
23
24 # order the tapset names then diff the files to examine the differences
25 sort -d checkfile1 | uniq > checkfile1s
26 sort -d checkfile2 | uniq > checkfile2s
27 comm -23 checkfile1s checkfile2s > missingdoc
28 comm -12 missingdoc tap1 > commondoc
29 comm -23 missingdoc tap1 > missingdoc1
30 comm -13 checkfile1s checkfile2s > missingtap
31 zero='0'
32 one='1'
33 Missingdoc=`cat missingdoc1 |wc -l `
34 Missingtap=`cat missingtap | wc -l `
35 Commondoc=`cat commondoc | wc -l `
36
37 if [ "$Missingdoc" -gt "$zero" ]
38 then
39 echo "You have missing documentation from tapsets in use, specifically:"
40 cat missingdoc1
41 fi
42
43 if [ "$Missingtap" -gt "$zero" ]
44 then
45 echo "You have documentation for the following tapsets that don't exist!"
46 cat missingtap
47 fi
48
49 if [ "$Commondoc" -gt "$zero" ]
50 then
51 echo "The following tapsets did not appear in tapset.tmpl, but have references in the langref file."
52 cat commondoc
53 fi
54
55 rm checkfile2 checkfile2s checkfile1 checkfile1s missingtap missingdoc missingdoc1 commondoc tap1
56
57 # at the end we need to make sure we remove any files that we created
58 # change to proper directory first