1 | #
|
---|
2 | # Copyright 2002-2004 The Apache Software Foundation
|
---|
3 | #
|
---|
4 | # Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | # you may not use this file except in compliance with the License.
|
---|
6 | # You may obtain a copy of the License at
|
---|
7 | #
|
---|
8 | # http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | #
|
---|
10 | # Unless required by applicable law or agreed to in writing, software
|
---|
11 | # distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | # See the License for the specific language governing permissions and
|
---|
14 | # limitations under the License.
|
---|
15 | #
|
---|
16 | #
|
---|
17 |
|
---|
18 | #
|
---|
19 | # Simple shell script that checks whether changed files contain a copyright
|
---|
20 | # statement for a given year.
|
---|
21 | #
|
---|
22 | # Rename (or symlink) this script to the year you want to check, i.e. name it
|
---|
23 | # 2002 if you want to check for copyright statements that do not contain#
|
---|
24 | # the year 2002.
|
---|
25 | #
|
---|
26 | # Use this script instead of your usual cvs update command.
|
---|
27 | #
|
---|
28 | # Usage YEAR [all]
|
---|
29 | #
|
---|
30 | # If the optional all argument has been omitted, the proposal directory will
|
---|
31 | # be skipped.
|
---|
32 | #
|
---|
33 |
|
---|
34 | if [ -n "$TMP" ]; then
|
---|
35 | TEMP_FILE="$TMP"/changed-files
|
---|
36 | else
|
---|
37 | if [ -n "$TEMP" ]; then
|
---|
38 | TEMP_FILE="$TEMP"/changed-files
|
---|
39 | else
|
---|
40 | TEMP_FILE=/tmp/changed-files
|
---|
41 | fi
|
---|
42 | fi
|
---|
43 |
|
---|
44 | YEAR=`basename $0`
|
---|
45 |
|
---|
46 | if [ $YEAR = yearcheck.sh ]; then
|
---|
47 | YEAR=`date -R | cut -d ' ' -f 4`
|
---|
48 | fi
|
---|
49 |
|
---|
50 | if [ -z "$1" ]; then
|
---|
51 | cvs -z3 update -dP | fgrep -v proposal | cut -f 2 -d ' ' > $TEMP_FILE
|
---|
52 | else
|
---|
53 | if [ "all" == "$1" ]; then
|
---|
54 | cvs -z3 update -dP | cut -f 2 -d ' ' > $TEMP_FILE
|
---|
55 | else
|
---|
56 | echo "Usage: $YEAR [all]"
|
---|
57 | exit
|
---|
58 | fi
|
---|
59 | fi
|
---|
60 |
|
---|
61 | echo "Changed:"
|
---|
62 | echo "========"
|
---|
63 | cat $TEMP_FILE
|
---|
64 | echo
|
---|
65 |
|
---|
66 | xargs fgrep -L Copyright < $TEMP_FILE > /tmp/no-copyright
|
---|
67 |
|
---|
68 | echo "No Copyright line"
|
---|
69 | echo "================="
|
---|
70 | cat /tmp/no-copyright
|
---|
71 | echo
|
---|
72 |
|
---|
73 | xargs egrep -L "Copyright.*$YEAR" < $TEMP_FILE | cut -f 1 -d : > /tmp/no-$YEAR
|
---|
74 |
|
---|
75 | echo "No Copyright line for year $YEAR"
|
---|
76 | echo "================================"
|
---|
77 | cat /tmp/no-$YEAR
|
---|
78 |
|
---|
79 | rm $TEMP_FILE
|
---|