CLICKHOUSE-3771: new version scheme

This commit is contained in:
proller 2018-07-17 14:15:14 +03:00
parent 0fde78584f
commit 3f949fc86a
4 changed files with 90 additions and 46 deletions

View File

@ -1,21 +1,21 @@
# This strings autochanged from release_lib.sh:
set(VERSION_DESCRIBE v1.1.54394-testing)
set(VERSION_REVISION 54394)
set(VERSION_GITHASH 875ea0f4eaa3592f1fe628b6a1150d91b04ad574)
set(VERSION_REVISION 54395 CACHE STRING "")
set(VERSION_MAJOR 1 CACHE STRING "")
set(VERSION_MINOR 1 CACHE STRING "")
set(VERSION_PATCH 54395 CACHE STRING "")
set(VERSION_GITHASH ddfce0df47374b27f04dc5f3529a23875aa7339d CACHE STRING "")
set(VERSION_DESCRIBE v1.1.54395-testing CACHE STRING "")
set(VERSION_STRING 1.1.54395 CACHE STRING "")
# end of autochange
set (VERSION_MAJOR 1)
set (VERSION_MINOR 1)
set (VERSION_PATCH ${VERSION_REVISION})
set (VERSION_EXTRA "")
set (VERSION_TWEAK "")
set(VERSION_EXTRA "" CACHE STRING "")
set(VERSION_TWEAK "" CACHE STRING "")
set (VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
if (VERSION_TWEAK)
set(VERSION_STRING "${VERSION_STRING}.${VERSION_TWEAK}")
string(CONCAT VERSION_STRING ${VERSION_STRING} "." ${VERSION_TWEAK})
endif ()
if (VERSION_EXTRA)
set(VERSION_STRING "${VERSION_STRING}${VERSION_EXTRA}")
string(CONCAT VERSION_STRING ${VERSION_STRING} "." ${VERSION_EXTRA})
endif ()
set (VERSION_FULL "${PROJECT_NAME} ${VERSION_STRING}")

2
debian/changelog.in vendored
View File

@ -1,4 +1,4 @@
clickhouse (1.1.@REVISION@) unstable; urgency=low
clickhouse (@VERSION_STRING@) unstable; urgency=low
* Modified source code

29
release
View File

@ -10,6 +10,16 @@
# Clang6 without internal compiler (for low memory arm64):
# env DIST=bionic DISABLE_PARALLEL=1 EXTRAPACKAGES="clang-6.0 libstdc++-8-dev" DEB_CC=clang-6.0 DEB_CXX=clang++-6.0 CMAKE_FLAGS=" -DNO_WERROR=1 " ./release
# Version increment:
# Default release: 18.1.2 -> 18.2.0:
# ./release --version
# or
# ./release --version minor
# Bugfix release (only with small patches to previous release): 18.1.2 -> 18.1.3:
# ./release --version patch
# Do this once per year: 18.1.2 -> 19.0.0:
# ./release --version major
set -e
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
@ -26,7 +36,7 @@ DEBUILD_NOSIGN_OPTIONS="-us -uc"
DEBUILD_NODEPS_OPTIONS="-d"
USE_PBUILDER=1
if [ -z "$REVISION" ] ; then
if [ -z "$VERSION_STRING" ] ; then
get_revision_author
fi
@ -40,12 +50,12 @@ do
DEBUILD_NODEPS_OPTIONS=""
shift
elif [[ $1 == '--version' ]]; then
gen_revision_author
git push
gen_revision_author $2
exit 0
elif [[ $1 == '--head' ]]; then
REVISION=`git rev-parse HEAD`
shift
# who use this?
#elif [[ $1 == '--head' ]]; then
# VERSION_STRING=`git rev-parse HEAD`
# shift
elif [[ $1 == '--pbuilder' ]]; then
# Default
shift
@ -62,7 +72,6 @@ do
fi
done
# Build options
if [ -n "$SANITIZER" ]
then
@ -90,10 +99,10 @@ CMAKE_FLAGS=" $LIBTCMALLOC_OPTS -DENABLE_EMBEDDED_COMPILER=1 $CMAKE_FLAGS"
export CMAKE_FLAGS
export EXTRAPACKAGES
REVISION+=$VERSION_POSTFIX
echo -e "\nCurrent revision is $REVISION"
VERSION_STRING+=$VERSION_POSTFIX
echo -e "\nCurrent version is $VERSION_STRING"
gen_changelog "$REVISION" "" "$AUTHOR" ""
gen_changelog "$VERSION_STRING" "" "$AUTHOR" ""
if [ -z "$USE_PBUILDER" ] ; then
# Build (only binary packages).

View File

@ -1,8 +1,23 @@
set +e
function get_revision {
function gen_version_string {
if [ -n "$TEST" ]; then
VERSION_STRING="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH.$VERSION_REVISION"
else
VERSION_STRING="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
fi
}
function get_version {
BASEDIR=$(dirname "${BASH_SOURCE[0]}")
grep "set(VERSION_REVISION" ${BASEDIR}/dbms/cmake/version.cmake | sed 's/^.*VERSION_REVISION \(.*\))$/\1/'
VERSION_REVISION=`grep "set(VERSION_REVISION" ${BASEDIR}/dbms/cmake/version.cmake | sed 's/^.*VERSION_REVISION \(.*\)$/\1/' | sed 's/[) ].*//'`
VERSION_MAJOR=`grep "set(VERSION_MAJOR" ${BASEDIR}/dbms/cmake/version.cmake | sed 's/^.*VERSION_MAJOR \(.*\)/\1/' | sed 's/[) ].*//'`
VERSION_MINOR=`grep "set(VERSION_MINOR" ${BASEDIR}/dbms/cmake/version.cmake | sed 's/^.*VERSION_MINOR \(.*\)/\1/' | sed 's/[) ].*//'`
VERSION_PATCH=`grep "set(VERSION_PATCH" ${BASEDIR}/dbms/cmake/version.cmake | sed 's/^.*VERSION_PATCH \(.*\)/\1/' | sed 's/[) ].*//'`
VERSION_PREFIX="${VERSION_PREFIX:-v}"
VERSION_POSTFIX="${VERSION_POSTFIX:--testing}"
gen_version_string
}
function get_author {
@ -13,9 +28,8 @@ function get_author {
# Generate revision number.
# set environment variables REVISION, AUTHOR
function gen_revision_author {
REVISION=$(get_revision)
VERSION_PREFIX="${VERSION_PREFIX:-v1.1.}"
VERSION_POSTFIX="${VERSION_POSTFIX:--testing}"
TYPE=$1
get_version
if [[ $STANDALONE != 'yes' ]]; then
@ -26,21 +40,40 @@ function gen_revision_author {
max_attempts=1000
while [ $succeeded -eq 0 ] && [ $attempts -le $max_attempts ]; do
attempts=$(($attempts + 1))
REVISION=$(($REVISION + 1))
git_tag_grep=`git tag | grep "$VERSION_PREFIX$REVISION$VERSION_POSTFIX"`
if [ "$TYPE" == "major" ]; then
VERSION_REVISION=$(($VERSION_REVISION + 1))
VERSION_MAJOR=$(($VERSION_MAJOR + 1))
VERSION_MINOR=0
VERSION_PATCH=0
elif [ "$TYPE" == "minor" ] || [ "$TYPE" == "" ]; then
VERSION_REVISION=$(($VERSION_REVISION + 1))
VERSION_MINOR=$(($VERSION_MINOR + 1))
VERSION_PATCH=0
elif [ "$TYPE" == "patch" ] || [ "$TYPE" == "bugfix" ]; then
# VERSION_REVISION not incremented.
VERSION_PATCH=$(($VERSION_PATCH + 1))
else
echo "Unknown version type $TYPE"
exit 1
fi
gen_version_string
git_tag_grep=`git tag | grep "$VERSION_PREFIX$VERSION_STRING$VERSION_POSTFIX"`
if [ "$git_tag_grep" == "" ]; then
succeeded=1
fi
done
if [ $succeeded -eq 0 ]; then
echo "Fail to create revision up to $REVISION"
echo "Fail to create revision up to $VERSION_REVISION"
exit 1
fi
auto_message="Auto version update to"
git_log_grep=`git log --oneline --max-count=1 | grep "$auto_message"`
if [ "$git_log_grep" == "" ]; then
tag="$VERSION_PREFIX$REVISION$VERSION_POSTFIX"
tag="$VERSION_PREFIX$VERSION_STRING$VERSION_POSTFIX"
# First tag for correct git describe
echo -e "\nTrying to create tag: $tag"
@ -48,11 +81,18 @@ function gen_revision_author {
git_describe=`git describe`
git_hash=`git rev-parse HEAD`
sed -i -- "s/VERSION_REVISION .*)/VERSION_REVISION $REVISION)/g;s/VERSION_DESCRIBE .*)/VERSION_DESCRIBE $git_describe)/g;s/VERSION_GITHASH .*)/VERSION_GITHASH $git_hash)/g;" dbms/cmake/version.cmake
sed -i -e "s/set(VERSION_REVISION [^) ]*/set(VERSION_REVISION $VERSION_REVISION/g;" \
-e "s/set(VERSION_DESCRIBE [^) ]*/set(VERSION_DESCRIBE $git_describe/g;" \
-e "s/set(VERSION_GITHASH [^) ]*/set(VERSION_GITHASH $git_hash/g;" \
-e "s/set(VERSION_MAJOR [^) ]*/set(VERSION_MAJOR $VERSION_MAJOR/g;" \
-e "s/set(VERSION_MINOR [^) ]*/set(VERSION_MINOR $VERSION_MINOR/g;" \
-e "s/set(VERSION_PATCH [^) ]*/set(VERSION_PATCH $VERSION_PATCH/g;" \
-e "s/set(VERSION_STRING [^) ]*/set(VERSION_STRING $VERSION_STRING/g;" \
dbms/cmake/version.cmake
gen_changelog "$REVISION" "" "$AUTHOR" ""
git commit -m "$auto_message [$REVISION]" dbms/cmake/version.cmake debian/changelog
#git push
gen_changelog "$VERSION_REVISION" "" "$AUTHOR" ""
git commit -m "$auto_message [$VERSION_REVISION]" dbms/cmake/version.cmake debian/changelog
git push
# Second tag for correct version information in version.cmake inside tag
if git tag --force -a "$tag" -m "$tag"
@ -68,34 +108,29 @@ function gen_revision_author {
fi
else
REVISION=$(get_revision)
echo reusing old version $REVISION
get_version
echo reusing old version $VERSION_STRING
fi
fi
AUTHOR=$(git config --get user.name || echo ${USER})
export REVISION
export AUTHOR
}
function get_revision_author {
REVISION=$(get_revision)
get_version
AUTHOR=$(get_author)
export REVISION
export AUTHOR
}
# Generate changelog from changelog.in.
# changes
# programs/CMakeLists.txt
# dbms/src/CMakeLists.txt
function gen_changelog {
REVISION="$1"
VERSION_STRING="$1"
CHDATE="$2"
AUTHOR="$3"
CHLOG="$4"
if [ -z "REVISION" ] ; then
if [ -z "$VERSION_STRING" ] ; then
get_revision_author
fi
@ -108,7 +143,7 @@ function gen_changelog {
fi
sed \
-e "s/[@]REVISION[@]/$REVISION/g" \
-e "s/[@]VERSION_STRING[@]/$VERSION_STRING/g" \
-e "s/[@]DATE[@]/$CHDATE/g" \
-e "s/[@]AUTHOR[@]/$AUTHOR/g" \
-e "s/[@]EMAIL[@]/$(whoami)@yandex-team.ru/g" \