Skip to content

Commit

Permalink
master: check_version.sh: only automatically edit version on master b…
Browse files Browse the repository at this point in the history
…ranch.

check_copy.sh: convert 2024-24 -> 2024.
  • Loading branch information
bradbell committed Feb 24, 2024
1 parent c2c1e66 commit 754281d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 28 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <[email protected]>
# SPDX-FileContributor: 2003-23 Bradley M. Bell
# SPDX-FileContributor: 2003-24 Bradley M. Bell
# ----------------------------------------------------------------------------
# =============================================================================
# Some constants
Expand All @@ -16,7 +16,7 @@ IF( POLICY CMP0054 )
ENDIF( POLICY CMP0054 )
#
# cppad_version is used by version.sh to get the version number.
SET(cppad_version "20240223")
SET(cppad_version "20240224")
SET(cppad_url "https://coin-or.github.io/CppAD" )
SET(cppad_description "Differentiation of C++ Algorithms" )
IF( NOT DEFINED CMAKE_BUILD_TYPE)
Expand Down
3 changes: 2 additions & 1 deletion bin/check_copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ do
if [ -e $file_name ]
then
sed \
-e 's|\(SPDX-FileContributor\): \([0-9]\{4\}\)[-0-9]* |\1: \2-24 |' \
-e 's|\(SPDX-FileContributor\): *\([0-9]\{4\}\)[-0-9]* |\1: \2-24 |' \
-e 's|\(SPDX-FileContributor\): 2024-24 |\1: 2024 |' \
$file_name > temp.$$
if diff $file_name temp.$$ > /dev/null
then
Expand Down
36 changes: 13 additions & 23 deletions bin/check_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
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
# SPDX-FileContributor: 2003-24 Bradley M. Bell
# ----------------------------------------------------------------------------
if [ $# != 0 ]
then
Expand Down Expand Up @@ -46,31 +46,21 @@ version=$(
sed -e 's|.*"\([^"]*\)".*|\1|'
)
#
# version, release
release='yes'
if echo $version | grep '[0-9]\{4\}0000[.]' > /dev/null
# branch
branch=$(git branch | sed -n -e '/^[*]/p' | sed -e 's|^[*] *||')
#
# version
if [ "$branch" == 'master' ]
then
version=$( date +%Y%m%d )
fi
if echo $branch | grep '^stable/' > /dev/null
then
res=''
while [ "$res" != 'ok' ] && [ "$res" != 'date' ] && [ "$res" != 'abort' ]
do
echo "In CMakeLists.txt version = $version"
echo 'ok: use this version.'
echo 'date: repalce this by the current date.'
echo 'abort: if you whish to change the version in CMakeLists.txt.'
read -p '[ok/date/abort] ?' res
done
if [ "$res" == 'abort' ]
if ! echo $version | grep '^[0-9]\{4\}0000[.]' > /dev/null
then
echo 'check_version.sh: Stable version does not begin with yyyy0000.'
exit 1
fi
if [ "$res" == 'date' ]
then
release='no'
version=$( date +%Y%m%d )
fi
else
release='no'
version=$( date +%Y%m%d )
fi
#
# version_ok
Expand All @@ -83,7 +73,7 @@ version_files='
'
#
# temp.sed
if [ "$release" == 'yes' ]
if echo $branch | grep '^stable/' > /dev/null
then
stable=$( echo $version | sed -e 's|[.][0-9]*$||' )
cat << EOF > temp.sed
Expand Down
4 changes: 2 additions & 2 deletions user_guide.xrst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <[email protected]>
# SPDX-FileContributor: 2003-23 Bradley M. Bell
# SPDX-FileContributor: 2003-24 Bradley M. Bell
# ----------------------------------------------------------------------------
{xrst_begin user_guide}
{xrst_spell
Expand All @@ -13,7 +13,7 @@

{xrst_comment BEGIN: Before changing see new_release.sh and check_version.sh}

cppad-20240223: CppAD User's Manual
cppad-20240224: CppAD User's Manual
###################################

.. image:: {xrst_dir coin.png}
Expand Down

0 comments on commit 754281d

Please sign in to comment.