source: stable/20170000/bin/check_copyright.sh @ 3866

Last change on this file since 3866 was 3866, checked in by bradbell, 3 years ago

merge to branch: stable/20170000
from repository: https://github.com/coin-or/CppAD
start hash code: be5942014af74c220dc1ed7ba397599cc48a7282
end hash code: 0201594a22c035232289215f8095c7ae308d194b

commit 0201594a22c035232289215f8095c7ae308d194b
Author: Brad Bell <bradbell@…>
Date: Thu Jan 19 04:59:07 2017 -0700

stable/20170000 branch:
package.sh: suppress runing doxygen; see d505fac90a987
ad_tape.hpp: fix problem with Visual C++2015; see issue 17.
check_copyright.sh: change date for changes from 2016 -> 2017.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1#! /bin/bash -e
2# -----------------------------------------------------------------------------
3# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 Bradley M. Bell
4#
5# CppAD is distributed under multiple licenses. This distribution is under
6# the terms of the
7#                     Eclipse Public License Version 1.0.
8#
9# A copy of this license is included in the COPYING file of this distribution.
10# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
11# -----------------------------------------------------------------------------
12if [ $0 != "bin/check_copyright.sh" ]
13then
14        echo "bin/check_copyright.sh: must be executed from its parent directory"
15        exit 1
16fi
17if [ ! -e .git ]
18then
19        echo 'This is not a git repository so cannot check copyright.'
20        echo 'check_copyright.sh: skipped'
21        exit 0
22fi
23list=`git status | sed -n \
24        -e '/^[#\t ]*deleted:/p' \
25        -e '/^[#\t ]*modified:/p' \
26        -e '/^[#\t ]*both modified:/p' \
27        -e '/^[#\t ]*renamed:/p' \
28        -e '/^[#\t ]*new file:/p' | \
29            sed -e 's/^.*: *//' -e 's/ -> /\n/' | \
30                        sed -e '/^makefile.in$/d' \
31                                -e '/^.gitignore$/d' \
32                                -e '/\/makefile.in$/d' \
33                                -e '/\/check_copyright.sh$/d' \
34                                -e '/AUTHORS/d' \
35                                -e '/COPYING/d' |
36                sort -u`
37cat << EOF > check_copyright.1.$$
38# Change copyright second year to current year
39s/Copyright (C) \\([0-9]*\\)-[0-9][0-9] Bradley M. Bell/Copyright (C) \\1-17 Bradley M. Bell/
40s/Copyright (C) \\([0-9]*\\)-20[0-9][0-9] Bradley M. Bell/Copyright (C) \\1-17 Bradley M. Bell/
41EOF
42ok=true
43for file in $list
44do
45        if [ -e $file ]
46        then
47                if ! grep 'Copyright (C) [0-9]*-[0-9][0-9]' $file > /dev/null
48                then
49                        echo "Cannot find copyright message in $file"
50                        exit 1
51                fi
52                sed -f check_copyright.1.$$ $file > check_copyright.2.$$
53                if ! diff $file check_copyright.2.$$ > /dev/null
54                then
55                        echo '----------------------------------------------------'
56                        echo "check_copyright.sh: automatic changes to $file:"
57                        if diff $file check_copyright.2.$$
58                        then
59                                echo 'bin/check_copyright.sh: program error'
60                                rm check_copyright.*.$$
61                                exit 1
62                        fi
63                        ok='no'
64                        if [ -x $file ]
65                        then
66                                mv check_copyright.2.$$ $file
67                                chmod +x $file
68                        else
69                                mv check_copyright.2.$$ $file
70                        fi
71                fi
72        fi
73done
74if [ "$ok" == 'no' ]
75then
76        rm check_copyright.*.$$
77        exit 1
78fi
79rm check_copyright.*.$$
80# ----------------------------------------------------------------------------
81echo "$0: OK"
82exit 0
Note: See TracBrowser for help on using the repository browser.