Skip to content

Commit

Permalink
stable/20240000: check_version.sh: current master version set by new_…
Browse files Browse the repository at this point in the history
…release.sh.
  • Loading branch information
bradbell committed Aug 10, 2024
1 parent ba30fc6 commit 67bdbf1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
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
4 changes: 2 additions & 2 deletions user_guide.xrst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

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

cppad-20240000: CppAD User's Manual
###################################
cppad-20240000.7: CppAD User's Manual
#####################################

.. image:: {xrst_dir coin.png}

Expand Down

0 comments on commit 67bdbf1

Please sign in to comment.