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