File: tapcheck.sh

package info (click to toggle)
systemtap 4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 36,436 kB
  • sloc: cpp: 72,388; ansic: 58,430; xml: 47,797; exp: 40,417; sh: 10,793; python: 2,759; perl: 2,252; tcl: 1,305; makefile: 1,119; lisp: 105; java: 102; awk: 101; asm: 91; sed: 16
file content (58 lines) | stat: -rwxr-xr-x 1,876 bytes parent folder | download | duplicates (8)
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
#!/bin/sh

#check to make sure a tapsets.tmpl file exists
if [ ! -f tapsets.tmpl ]; then
	echo "Error: tapsets.tmpl doesn't exist in the current directory!"
	exit 1
fi
# list the tapsets in the tapsets.tmpl file and properly format the
# file names
grep "\.stp" tapsets.tmpl | grep ! | sed 's/!Itapset\///g' > checkfile2

# change to the tapset directory and check the tapsets there
# check to see if directory is present first
if [ ! -d ../../tapset/ ]; then
	echo "Error: tapsets directory doesn't exist!"
	exit 1
fi
(cd ../../tapset/; find -path "*.stp") | sed 's/\.\///g' > checkfile1
#might as well check for the functions that are documented in
#langref now too
(cd ../../tapset/; find -path "*.stp" -exec grep -H sfunction {} \; ) \
| sed 's/\.\///g' | cut -d : -f 1 | sort -d | uniq  > tap1

# order the tapset names then diff the files to examine the differences
sort -d checkfile1 | uniq > checkfile1s
sort -d checkfile2 | uniq > checkfile2s
comm -23 checkfile1s checkfile2s > missingdoc
comm -12 missingdoc tap1 > commondoc
comm -23 missingdoc tap1 > missingdoc1
comm -13 checkfile1s checkfile2s > missingtap
zero='0'
one='1'
Missingdoc=`cat missingdoc1 |wc -l `
Missingtap=`cat missingtap | wc -l `
Commondoc=`cat commondoc | wc -l `

if [ "$Missingdoc" -gt "$zero" ]
 then
	echo "You have missing documentation from tapsets in use, specifically:"
	cat missingdoc1
fi

if [ "$Missingtap" -gt "$zero" ]
then
	echo "You have documentation for the following tapsets that don't exist!"
	cat missingtap
fi

if [ "$Commondoc" -gt "$zero" ]
then
	echo "The following tapsets did not appear in tapset.tmpl, but have references in the langref file."
	cat commondoc
fi

rm checkfile2 checkfile2s checkfile1 checkfile1s missingtap missingdoc missingdoc1 commondoc tap1

# at the end we need to make sure we remove any files that we created
# change to proper directory first