Skip to content

Commit

Permalink
master: check_version.sh: correct sttting of both master and release …
Browse files Browse the repository at this point in the history
…versions.
  • Loading branch information
bradbell committed Jul 29, 2024
1 parent 1c7b04e commit b4531c2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "20240625")
SET(cppad_version "20240729")
SET(cppad_url "https://coin-or.github.io/CppAD" )
SET(cppad_description "Differentiation of C++ Algorithms" )
IF( NOT DEFINED CMAKE_BUILD_TYPE)
Expand Down
41 changes: 19 additions & 22 deletions bin/check_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,35 @@ check_version() {
}
# -----------------------------------------------------------------------------
#
# version
version=$(
# this_version
this_version=$(
sed -n -e '/^SET( *cppad_version *"[0-9.]*")/p' CMakeLists.txt | \
sed -e 's|.*"\([^"]*\)".*|\1|'
)
#
# branch
branch=$(git branch | sed -n -e '/^[*]/p' | sed -e 's|^[*] *||')
#
# version
# this_version
if [ "$branch" == 'master' ]
then
version=$( date +%Y%m%d )
this_version=$( date +%Y%m%d )
fi
#
# stable_version, release_version
if echo $branch | grep '^stable/' > /dev/null
then
if ! echo $version | grep '^[0-9]\{4\}0000[.]' > /dev/null
if ! echo $this_version | grep '^[0-9]\{4\}0000[.]' > /dev/null
then
echo 'check_version.sh: Stable version does not begin with yyyy0000.'
exit 1
fi
release_version="$this_version"
stable_version=$(echo $release_version | sed -e 's|[.][0-9]*$||')
else
eval $(grep '^stable_version=' bin/new_release.sh)
eval $(grep '^release=' bin/new_release.sh)
release_version="$stable_version.$release"
fi
#
# version_ok
Expand All @@ -73,30 +81,19 @@ version_files='
'
#
# temp.sed
if echo $branch | grep '^stable/' > /dev/null
then
stable=$( echo $version | sed -e 's|[.][0-9]*$||' )
cat << EOF > temp.sed
#
# CMakeLists.txt
s|^SET( *cppad_version *"[0-9.]*")|SET(cppad_version "$version")|
s|^SET( *cppad_version *"[0-9.]*")|SET(cppad_version "$this_version")|
#
# user_guide.xrst
s|[0-9]\\{8\\}[.][0-9]*|$version|g
s|documentation-[0-9]\\{8\\}|documentation-latest|g
s|stable-[0-9]\\{8\\}|latest|g
s|cppad-[0-9]\\{8\\}[0-9.]*|cppad-$stable|g
EOF
else
cat << EOF > temp.sed
s|cppad-[0-9]\\{8\\}[.]*[.0-9]*|cppad-$this_version|
#
# CMakeLists.txt
s|^SET( *cppad_version *"[0-9.]*")|SET(cppad_version "$version")|
s|release-[0-9]\\{8\\}\.[.0-9]*|release-$release_version|
s|archive/[0-9]\\{8\\}\.[0-9]*|archive/$release_version|
#
# user_guide.xrst
s|cppad-[0-9]\\{8\\}|cppad-$version|g
s|documentation-[0-9]\\{8\\}|documentation-$stable_version|
s|stable-[0-9]\\{8\\}|stable-$stable_version|
EOF
fi
#
for file in $version_files
do
Expand Down
6 changes: 4 additions & 2 deletions user_guide.xrst
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@

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

cppad-20240625: CppAD User's Manual
cppad-20240729: CppAD User's Manual
###################################
{xrst_comment The scripts bin/check_version.sh and bin/new_release.sh
edit version numbers in tables below.}

.. image:: {xrst_dir coin.png}

.. list-table::
:widths: auto

* - `release-20240000.6 <https://codeload.github.com/coin-or/CppAD/tar.gz/refs/tags/20240000.4>`_
* - `release-20240000.6 <https://github.com/coin-or/CppAD/archive/20240000.6.tar.gz>`_
- `documentation-20240000 <https://cppad.readthedocs.io/stable-20240000>`_
- `other releases <https://github.com/coin-or/CppAD/tags>`_
- `github <https://github.com/coin-or/CppAD>`_
Expand Down

0 comments on commit b4531c2

Please sign in to comment.