Debian Codegraph @

dist/validate/s_chk_copyright

raw
1 #!/bin/sh -
2 #
3 # $Id$
4 #
5 # Check all source files for proper copyright notices.
6
7 d=../..
8 [ -f $d/LICENSE ] || {
9 echo 'FAIL: cannot find source distribution directory.'
10 exit 1
11 }
12
13 t1=__1
14 t2=__2
15
16 # create regex for Copyright notice using current year
17 COPYEXP='Copyright.*'`date +%C%y`'.*affiliates'
18 echo $COPYEXP
19
20 (cd $d && find . -name '*.[chys]' -o -name '*.cpp' -o -name '*.tcl' \
21 -o -name '*.java' -o -name '*.cs' -o -name '*.hpp' \
22 -o -name '*.src' | xargs egrep -l $COPYEXP) > $t1
23
24 # use sed to remove the files we do not care about, these are the ones
25 # from 3rd parties that are included in our distribution
26
27 (cd $d && find . -name '*.[chys]' -o -name '*.cpp' -o -name '*.tcl' \
28 -o -name '*.java' -o -name '*.cs' -o -name '*.hpp') | tee /tmp/o |
29 sed -e '/crypto\//d' \
30 -e '/dbinc_auto\//d' \
31 -e '/lang\/csharp\/src\/Internal\//d'\
32 -e '/lang\/java\/src\/com\/sleepycat\/db\/internal\//d' \
33 -e '/lang\/sql\/generated\//d' \
34 -e '/db_csharp_wrap.c$/d' \
35 -e '/db_java_wrap.c$/d' \
36 -e '/perl\//d' \
37 -e '/sha1.c$/d' \
38 -e '/sleepycat\/asm\//d' \
39 -e '/sqlite\//d' \
40 -e '/test\/stl\//d' > $t2
41
42
43 if diff $t1 $t2 > /dev/null; then
44 exit 0
45 else
46 echo "<<< source tree >>> missing copyright notices"
47 diff $t1 $t2 | grep '>' | awk '{print $2}'
48 exit 1
49 fi
50
51 rm -f $t1 $t2
52
53 exit 0