summaryrefslogtreecommitdiff
path: root/dist/s_copyright
blob: ce8f9970ae316c04a5afb40ab4d49420e411467e (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#! /bin/sh

# Check the copyrights.

c1=__wt.1$$
c2=__wt.2$$
c3=__wt.3$$
c4=__wt.4$$
trap 'rm -f $c1 $c2 $c3 $c4; exit 0' 0 1 2 3 13 15

year=`date +%Y`

cat > $c1 <<ENDOFTEXT
 * Copyright (c) 2008-$year WiredTiger, Inc.
 *	All rights reserved.
 *
 * See the file LICENSE for redistribution information.
ENDOFTEXT

# Copyright for files WiredTiger does not own.
cat > $c2 <<ENDOFTEXT
 * Public Domain 2008-$year WiredTiger, Inc.
 *
 * This is free and unencumbered software released into the public domain.
ENDOFTEXT

cat > $c3 <<ENDOFTEXT
# Copyright (c) 2008-$year WiredTiger, Inc.
#	All rights reserved.
#
# See the file LICENSE for redistribution information.
ENDOFTEXT

cat > $c4 <<ENDOFTEXT
# Public Domain 2008-$year WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
ENDOFTEXT

check()
{
	# Skip auto-generated files, files in which WiredTiger holds no rights.
	if `egrep "skip	$1" s_copyright.list > /dev/null`; then
		return;
	fi

	# It's okay if the file doesn't exist: we may be running in a release
	# tree with some files removed.
	test -f ../$i || return

	# Check for a correct copyright header.
	if `sed -e 2,4p -e 5q -e d ../$1 | diff - $c1 > /dev/null` ; then
		return;
	fi
	if `sed -e 2,3p -e 4q -e d ../$1 | diff - $c2 > /dev/null` ; then
		return;
	fi
	if `sed -e 3,5p -e 6q -e d ../$1 | diff - $c3 > /dev/null` ; then
		return;
	fi
	if `sed -e 3,4p -e 5q -e d ../$1 | diff - $c4 > /dev/null` ; then
		return;
	fi
	if `sed -e 1,2p -e 3q -e d ../$1 | diff - $c4 > /dev/null` ; then
		return;
	fi

	echo "$1: copyright information is incorrect"
}

# Search for files, ignoring test/3rdparty.
for i in `cd .. &&
    find [a-z]* -name '*.[chi]' \
        -o -name '*.cxx' -o -name '*.java' -o -name '*.py' |
    sed -e '/test\/3rdparty\//d' -e 's/^\.\///'`; do
	check $i
done

# The documentation copyright appears in two files.
s="Copyright (c) 2008-$year WiredTiger, Inc."
f="src/docs/build-javadoc.sh src/docs/style/footer.html"
for i in $f; do
	if `grep "$s" ../$i > /dev/null`; then
		continue;
	fi
	echo "$i: copyright information is incorrect"
done

# The wt utility and LICENSE files have a copyright.
s="Copyright (c) 2008-$year WiredTiger, Inc."
f="LICENSE src/utilities/util_cpyright.c"
for i in $f; do
	if `grep "$s" ../$i > /dev/null`; then
		continue;
	fi
	echo "$i: copyright information is incorrect"
done