summaryrefslogtreecommitdiff
path: root/db-4.8.30/test/scr031/chk.copy
blob: a752c7a58947f5515ce806eb0391082af23c3f54 (plain)
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
#!/bin/sh -
#
# $Id$
#
# Check all source files for proper copyright notices.

d=../..

# Test must be run from the top-level directory, not from a test directory.
[ -f $d/LICENSE ] || {
	echo 'FAIL: cannot find source distribution directory.'
	exit 1
}

t1=__1
t2=__2

# create regex for Copyright notice using current year
COPYEXP='Copyright.*'`date +%C%y`

(cd $d && find . -name '*.[chys]' -o -name '*.cpp' -o -name '*.tcl'  \
             -o -name '*.java' -o -name '*.cs' -o -name '*.hpp' |
    xargs egrep -l  $COPYEXP) > $t1
 
# use sed to remove the files we do not care about, these are the ones
# from 3rd parties that are included in our distribution

(cd $d && find . -name '*.[chys]' -o -name '*.cpp' -o -name '*.tcl'  \
             -o -name '*.java' -o -name '*.cs' -o -name '*.hpp') | tee /tmp/o |
   sed -e '/crypto\//d' \
       -e '/sha1.c$/d' \
       -e '/sleepycat\/asm\//d' \
       -e '/perl\//d' \
       -e '/mod_db4\//d' \
       -e '/sqlite\//d' > $t2


if diff $t1 $t2 > /dev/null; then
        exit 0
else
        echo "<<< source tree >>> missing copyright notices"
        diff $t1 $t2 | grep '>' | awk '{print $2}'
        exit 1
fi

exit 0