diff --git a/bin/check_copy.sh b/bin/check_copy.sh new file mode 100755 index 000000000..5b3c959eb --- /dev/null +++ b/bin/check_copy.sh @@ -0,0 +1,89 @@ +#! /usr/bin/env bash +set -e -u +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later +# SPDX-FileCopyrightText: Bradley M. Bell +# SPDX-FileContributor: 2023-24 Bradley M. Bell +# ---------------------------------------------------------------------------- +if [ $# != 0 ] +then + echo 'bin/check_copy.sh does not expect any arguments' + exit 1 +fi +if [ "$0" != 'bin/check_copy.sh' ] +then + echo 'bin/check_copy.sh: must be executed from its parent directory' + exit 1 +fi +if [ ! -e './.git' ] +then + echo 'bin/check_copy.sh: cannot find ./.git' + exit 1 +fi +# --------------------------------------------------------------------------- +license='SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later' +missing='no' +changed='no' +for file_name in $(git ls-files | sed \ + -e '/\.yml$/d' \ + -e '/\.png$/d' \ + -e '/\.html$/d' \ + -e '/\.toml$/d' \ + -e '/\.xml$/d' \ + -e '/^.gitignore$/d' \ + -e '/^.readthedocs.yaml$/d' \ + -e '/^epl-2.0.txt$/d' \ + -e '/^COPYING$/d' \ + -e '/^authors$/d' \ + -e '/^batch_edit.sed$/d' \ + -e '/^build.bat$/d' \ + -e '/^bin[/]build.bat$/d' \ + -e '/^cmake[/]cppad_uninstall.cmake$/d' \ +) +do + if ! grep "$license\$" $file_name > /dev/null + then + if [ "$missing" == 'no' ] + then + echo "Cannot find line that ends with:" + echo " $license" + echo "In the following files:" + fi + echo "$file_name" + missing='yes' + fi +done +for file_name in $(git status --porcelain | sed -e 's|^...||' ) +do + if [ -e $file_name ] + then + sed \ + -e 's|\(SPDX-FileContributor\): \([0-9]\{4\}\)[-0-9]* |\1: \2-24 |' \ + $file_name > temp.$$ + if diff $file_name temp.$$ > /dev/null + then + rm temp.$$ + else + if [ "$changed" == 'no' ] + then + echo 'The following file contributor dates have been updated' + fi + echo $file_name + changed='yes' + if [ -x $file_name ] + then + mv temp.$$ $file_name + chmod +x $file_name + else + mv temp.$$ $file_name + fi + fi + fi +done +# +if [ "$missing" = 'yes' ] +then + echo 'bin/check_copy.sh: See copyright errors above' + exit 1 +fi +echo 'bin/check_copy.sh: OK' +exit 0 diff --git a/bin/check_invisible.sh b/bin/check_invisible.sh index aa2a31af2..07b526686 100755 --- a/bin/check_invisible.sh +++ b/bin/check_invisible.sh @@ -1,8 +1,8 @@ #! /usr/bin/env bash set -e -u -# SPDX-License-Identifier: GPL-3.0-or-later +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later # SPDX-FileCopyrightText: Bradley M. Bell -# SPDX-FileContributor: 2020-22 Bradley M. Bell +# SPDX-FileContributor: 2020-24 Bradley M. Bell # ----------------------------------------------------------------------------- if [ "$0" != "bin/check_invisible.sh" ] then diff --git a/bin/get_highlight.sh b/bin/get_highlight.sh deleted file mode 100755 index 4c05897c6..000000000 --- a/bin/get_highlight.sh +++ /dev/null @@ -1,56 +0,0 @@ -#! /bin/bash -e -# Copyright: None -# -------------------------------------------------------------------------- -# tarball='source-highlight-3.1.5.tar.gz' -tarball='source-highlight-3.1.8.tar.gz' -web_page='ftp://ftp.gnu.org/gnu/src-highlite/' -start_dir=`pwd` -# ----------------------------------------------------------------------------- -# bash function that echos and executes a command -echo_eval() { - echo $* - eval $* -} -# ----------------------------------------------------------------------------- -name='highlight' -if [ "$0" != "bin/get_$name.sh" ] -then - echo "get_$name.sh should be in the ./bin directory and executed using" - echo "bin/get_$name.sh" - exit 1 -fi -# ----------------------------------------------------------------------------- -# n_proc -if which nproc >& /dev/null -then - n_job=$(nproc) -else - n_job=$(sysctl -n hw.ncpu) -fi -# ----------------------------------------------------------------------------- -if [ ! -e build ] -then - mkdir build -fi -cd build -# ----------------------------------------------------------------------------- -dir=`echo $tarball | sed -e 's|\.tar||' -e 's|\.gz||'` -if [ ! -e $dir ] -then - echo_eval wget "$web_page/$tarball" - echo_eval tar -xzf $tarball - rm $tarball -fi -# ----------------------------------------------------------------------------- -echo_eval cd $dir -if [ ! -e build ] -then - mkdir build -fi -echo_eval cd build -# -echo_eval ../configure --prefix="$start_dir/build/prefix" -echo_eval make -j $n_job install -# ----------------------------------------------------------------------------- -echo "get_$name.sh: OK" -exit 1 diff --git a/bin/get_omhelp.sh b/bin/get_omhelp.sh deleted file mode 100755 index 03daf389b..000000000 --- a/bin/get_omhelp.sh +++ /dev/null @@ -1,66 +0,0 @@ -#! /bin/bash -e -# Copyright: None -# ----------------------------------------------------------------------------- -web_page='https://github.com/bradbell/omhelp.git' -version='20200131' -git_hash='3f992c04e78f84a866a38635caf007eef64de4d8' -start_dir=`pwd` -# ----------------------------------------------------------------------------- -# bash function that echos and executes a command -echo_eval() { - echo $* - eval $* -} -# ----------------------------------------------------------------------------- -name='omhelp' -if [ "$0" != "bin/get_$name.sh" ] -then - echo "get_$name.sh should be in the ./bin directory and executed using" - echo "bin/get_$name.sh" - exit 1 -fi -# ----------------------------------------------------------------------------- -# n_proc -if which nproc >& /dev/null -then - n_job=$(nproc) -else - n_job=$(sysctl -n hw.ncpu) -fi -# ----------------------------------------------------------------------------- -if [ ! -e build ] -then - mkdir build -fi -cd build -# ----------------------------------------------------------------------------- -if [ ! -e omhelp.git ] -then - git clone $web_page omhelp.git -fi -# ----------------------------------------------------------------------------- -cd omhelp.git -git checkout master -git pull -git checkout --quiet $git_hash -# ----------------------------------------------------------------------------- -if [ ! -e build ] -then - mkdir build -fi -echo_eval cd build -echo_eval cmake \ - -D source_highlight_prefix="$start_dir/build/prefix" \ - -D omhelp_prefix="$start_dir/build/prefix" \ - -D omhelp_datadir=share \ - -D omhelp_build_type=release \ - .. | tee cmake.log -if grep WARNING cmake.log -then - echo "get_$name.sh: aborting due to cmake command warnings" - exit 1 -fi -echo_eval make -j $n_job install -# ----------------------------------------------------------------------------- -echo "get_$name.sh: OK" -exit 1