LUMIERA.clone/admin/setVersion
Ichthyostega 17ee3ac1cb Release: Introduce the Git-flow branching model
Starting with the upcoming ''preview release'', branches, branch names and tags
will be rearranged to follow the Git-flow pattern instead of the existing
ad-hoc organisation with a release branch.

The documentation provided here defines the actual naming conventions
and some fine points regarding the version number upgrades
and placement of release tags.


Furthermore, two helper-scripts are provided to automate version number updates
- `buildVersion.py` : extract current version from git tag and allow to bump version
- `setVersion` : manipulate all relevant files with `sed` to update the version info
2025-07-21 02:46:28 +02:00

44 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
#
# setVersion - place the version info given as argument
# into all the necessary places in the Lumiera tree
#
#
set -e
function fail() {
echo -e "\nFAIL: $1\n\n"
exit -1
}
PROJ_ROOT=$(git rev-parse --show-toplevel)
cd $PROJ_ROOT
[ $# -eq 1 ] || fail "need version as argument\n\nsetVersion <ver>"
[ -n "$1" ] || fail "need a nonemty version spec"
VER="$1"
function rewrite() {
# Process the indicated file with sed and replace the existing version spec
# The PREFIX argument must match everything from line start before the version;
# then the _remainder_ of this line will be replaced by the NEWVER
FILE="$1"
PREFIX="$2"
NEWVER="$3"
echo "rewrite..... $FILE"
egrep -q "^$PREFIX" $FILE || fail "not found in $FILE : $PREFIX"
#
sed -r -f - -i "$FILE" <<END_SCRIPT
/^$PREFIX/ {
s/(^$PREFIX).+/\1 $NEWVER/
}
END_SCRIPT
}
rewrite data/config/setup.ini 'version\s*=' "$VER"
rewrite doc/devel/Doxyfile 'PROJECT_NUMBER\s*=' "$VER"
rewrite doc/devel/Doxyfile.browse 'PROJECT_NUMBER\s*=' "$VER"
rewrite admin/scons/Setup.py 'VERSION\s*=' "\'$VER\'"
rewrite README 'Version:' "$VER"
echo -e "\nSUCCESSFULLY rewritten version $VER\ncheck git diff\n\n"