-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
master: advance to newer verison of xrst.git/bin/dev_tools.sh.
- Loading branch information
Showing
9 changed files
with
471 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,23 @@ set -e -u | |
# SPDX-FileCopyrightText: Bradley M. Bell <[email protected]> | ||
# SPDX-FileContributor: 2023-24 Bradley M. Bell | ||
# ---------------------------------------------------------------------------- | ||
if [ "$0" != "bin/check_copy.sh" ] | ||
then | ||
echo "bin/check_copy.sh: must be executed from its parent directory" | ||
exit 1 | ||
fi | ||
if [ "$#" != 0 ] | ||
then | ||
echo 'check_copy does not expect any arguments' | ||
exit 1 | ||
fi | ||
# | ||
# grep, sed | ||
source bin/grep_and_sed.sh | ||
# | ||
# spdx_license_id, no_copyright_list | ||
source bin/dev_settings.sh | ||
# ---------------------------------------------------------------------------- | ||
if [ $# != 0 ] | ||
then | ||
echo 'bin/check_copy.sh does not expect any arguments' | ||
|
@@ -20,43 +37,60 @@ then | |
exit 1 | ||
fi | ||
# --------------------------------------------------------------------------- | ||
license='SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later' | ||
username='bradbell' | ||
fullname='Bradley M. Bell' | ||
# --------------------------------------------------------------------------- | ||
if [ -e temp.sed ] | ||
then | ||
rm temp.sed | ||
fi | ||
for name in $no_copyright_list | ||
do | ||
if [ -f $name ] | ||
then | ||
echo "^$name\$" | $sed -e 's|/|[/]|g' -e 's|.*|/&/d|' >> temp.sed | ||
elif [ -d $name ] | ||
then | ||
echo "^$name/" | $sed -e 's|/|[/]|g' -e 's|.*|/&/d|' >> temp.sed | ||
else | ||
echo "$name in no_copyright_list is not a file or directory" | ||
exit 1 | ||
fi | ||
done | ||
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' \ | ||
) | ||
for file_name in $(git ls-files | $sed -f temp.sed) | ||
do | ||
if ! grep "$license\$" $file_name > /dev/null | ||
if ! $grep "$spdx_license_id\$" $file_name > /dev/null | ||
then | ||
if [ "$missing" == 'no' ] | ||
then | ||
echo "Cannot find line that ends with:" | ||
echo " $license" | ||
echo " $spdx_license_id" | ||
echo "In the following files:" | ||
fi | ||
echo "$file_name" | ||
missing='yes' | ||
fi | ||
done | ||
for file_name in $(git status --porcelain | sed -e 's|^...||' ) | ||
# --------------------------------------------------------------------------- | ||
cat << EOF > temp.sed | ||
s|\\(SPDX-FileContributor: *[0-9]\\{4\\}\\)[-0-9]* $fullname|\\1-24 $fullname| | ||
s|\\(SPDX-FileContributor\\): 2024-24 |\\1: 2024 | | ||
EOF | ||
list='' | ||
if [ "${USER+x}" != '' ] | ||
then | ||
if [ "$USER" == 'bradbell' ] | ||
then | ||
list=$(git status --porcelain | $sed -e 's|^...||' ) | ||
fi | ||
fi | ||
for file_name in $list | ||
do | ||
if [ -e $file_name ] | ||
then | ||
sed \ | ||
$sed \ | ||
-e 's|\(SPDX-FileContributor\): *\([0-9]\{4\}\)[-0-9]* |\1: \2-24 |' \ | ||
-e 's|\(SPDX-FileContributor\): 2024-24 |\1: 2024 |' \ | ||
$file_name > temp.$$ | ||
|
@@ -69,6 +103,11 @@ do | |
echo 'The following file contributor dates have been updated' | ||
fi | ||
echo $file_name | ||
if diff $file_name temp.$$ | ||
then | ||
echo 'check_version.sh: program error' | ||
exit 1 | ||
fi | ||
changed='yes' | ||
if [ -x $file_name ] | ||
then | ||
|
@@ -81,9 +120,10 @@ do | |
fi | ||
done | ||
# | ||
if [ "$missing" = 'yes' ] | ||
if [ "$missing" = 'yes' ] || [ "$changed" == 'yes' ] | ||
then | ||
echo 'bin/check_copy.sh: See copyright errors above' | ||
echo 'Re-execute bin/check_copy.sh ?' | ||
exit 1 | ||
fi | ||
echo 'bin/check_copy.sh: OK' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#! /usr/bin/env bash | ||
set -e -u | ||
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later | ||
# SPDX-FileCopyrightText: Bradley M. Bell <[email protected]> | ||
# SPDX-FileContributor: 2020-24 Bradley M. Bell | ||
# ----------------------------------------------------------------------------- | ||
if [ "$0" != "bin/check_sort.sh" ] | ||
then | ||
echo "bin/check_sort.sh: must be executed from its parent directory" | ||
exit 1 | ||
fi | ||
if [ "$#" == 0 ] | ||
then | ||
all='false' | ||
elif [ "$#" == 1 ] && [ "$1" == 'all' ] | ||
then | ||
all='true' | ||
else | ||
echo 'usage: bin/check_sort [all]' | ||
echo 'see usage message forbin/sort.sh' | ||
exit 1 | ||
fi | ||
# | ||
# grep, sed | ||
source bin/grep_and_sed.sh | ||
# ---------------------------------------------------------------------------- | ||
# file_list | ||
if [ "$all" == 'true' ] | ||
then | ||
file_list=$(git grep -l 'BEGIN_SORT_THIS_LINE_PLUS_') | ||
else | ||
file_list=$(git status --porcelain | $sed -e '/^D/d' -e 's|^...||') | ||
fi | ||
# | ||
# ok | ||
ok='yes' | ||
for file_name in $file_list | ||
do | ||
check='yes' | ||
if [ "$file_name" == 'bin/sort.sh' ] | ||
then | ||
check='no' | ||
fi | ||
if [ "$file_name" == 'bin/check_sort.sh' ] | ||
then | ||
check='no' | ||
fi | ||
if ! $grep BEGIN_SORT_THIS_LINE $file_name > /dev/null | ||
then | ||
check='no' | ||
fi | ||
if [ "$check" == 'yes' ] | ||
then | ||
if ! bin/sort.sh $file_name >& temp.$$ | ||
then | ||
cat temp.$$ | ||
echo 'check_sort.sh: Error' | ||
exit 1 | ||
fi | ||
last_line=$(tail -1 temp.$$) | ||
if [ "$last_line" == 'sort.sh: Done' ] | ||
then | ||
cat temp.$$ | ||
ok='no' | ||
fi | ||
fi | ||
done | ||
# | ||
if [ "$ok" == 'no' ] | ||
then | ||
echo 'check_sort.sh: Some files have been sorted (run again to get OK).' | ||
exit 1 | ||
fi | ||
echo 'check_sort.sh: OK' | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,74 @@ | ||
#! /bin/bash -e | ||
#! /usr/bin/env bash | ||
set -e -u | ||
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later | ||
# SPDX-FileCopyrightText: Bradley M. Bell <[email protected]> | ||
# SPDX-FileContributor: 2003-22 Bradley M. Bell | ||
# ---------------------------------------------------------------------------- | ||
if [ "$0" != 'bin/check_tab.sh' ] | ||
# SPDX-FileContributor: 2020-24 Bradley M. Bell | ||
# ----------------------------------------------------------------------------- | ||
if [ "$0" != "bin/check_tab.sh" ] | ||
then | ||
echo "bin/check_tab.sh: must be executed from its parent directory" | ||
exit 1 | ||
fi | ||
echo "-------------------------------------------------------" | ||
if [ "$#" == 0 ] | ||
then | ||
all='false' | ||
elif [ "$#" == 1 ] && [ "$1" == 'all' ] | ||
then | ||
all='true' | ||
else | ||
echo 'usage: bin/check_tab [all]' | ||
exit 1 | ||
fi | ||
# | ||
# sed | ||
source bin/grep_and_sed.sh | ||
# | ||
# invisible_and_tab_ok | ||
source bin/dev_settings.sh | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# sed.$$ | ||
echo '#' > sed.$$ | ||
for name in $invisible_and_tab_ok | ||
do | ||
if [ -f $name ] | ||
then | ||
echo "^$name\$" | $sed -e 's|/|[/]|g' -e 's|.*|/&/d|' >> sed.$$ | ||
elif [ -d $name ] | ||
then | ||
echo "^$name/" | $sed -e 's|/|[/]|g' -e 's|.*|/&/d|' >> sed.$$ | ||
else | ||
echo "$name in no_copyright_list is not a file or directory" | ||
exit 1 | ||
fi | ||
done | ||
# | ||
# file_list | ||
if [ "$all" == 'true' ] | ||
then | ||
file_list=$(git ls-files | $sed -f sed.$$) | ||
else | ||
file_list=$(git status --porcelain | \ | ||
$sed -e '/^D/d' -e 's|^...||' | $sed -f sed.$$) | ||
fi | ||
# | ||
# ok | ||
ok='yes' | ||
file_list=`git ls-files | sed \ | ||
-e '/makefile[.]am$/d' \ | ||
-e '/makefile[.]in$/d' \ | ||
-e '/^batch_edit.sed$/d' \ | ||
-e '/^coin.png$/d' \ | ||
-e '/^ar-lib$/d' \ | ||
-e '/^configure$/d' \ | ||
-e '/^compile$/d' \ | ||
-e '/^config.guess$/d' \ | ||
-e '/^config.sub$/d' \ | ||
-e '/^depcomp$/d' \ | ||
-e '/^install-sh$/d' \ | ||
-e '/^uw_copy_040507.html/d' \ | ||
` | ||
tab=$'\t' | ||
for file in $file_list | ||
do | ||
if grep $'\t' $file > /dev/null | ||
if $grep -P '\t' $file > /dev/null | ||
then | ||
echo $file | ||
echo "$file has a tab" | ||
ok='no' | ||
fi | ||
done | ||
echo "-------------------------------------------------------" | ||
if [ "$ok" = 'no' ] | ||
if [ "$ok" != 'yes' ] | ||
then | ||
echo 'bin/check_tab.sh: The files above contain tabs' | ||
echo 'check_tab: Error' | ||
rm sed.$$ | ||
exit 1 | ||
fi | ||
echo 'bin/check_if.sh: OK' | ||
# ----------------------------------------------------------------------------- | ||
rm sed.$$ | ||
echo 'check_tab.sh: OK' | ||
exit 0 |
Oops, something went wrong.