mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 00:52:02 +00:00
release: import options from jenkins script (#714)
* release: import options from jenkins script * correct chdir * limit parallel build threads * VERSION_POSTFIX * add postfix * support BUILD_TYPE * Removed unused. * Fixed error [#CLICKHOUSE-2960]. * Fix version incrementing * Fix message
This commit is contained in:
parent
2d3e09af82
commit
ebd6bb5da4
87
release
87
release
@ -1,59 +1,66 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/release_lib.sh"
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||||
|
cd $CURDIR
|
||||||
|
|
||||||
|
source "./release_lib.sh"
|
||||||
|
|
||||||
CONTROL=debian/control
|
CONTROL=debian/control
|
||||||
CHLOG=debian/changelog
|
CHLOG=debian/changelog
|
||||||
CHDATE=$(LC_ALL=C date -R | sed -e 's/,/\\,/g') # Replace comma to '\,'
|
CHDATE=$(LC_ALL=C date -R | sed -e 's/,/\\,/g') # Replace comma to '\,'
|
||||||
|
|
||||||
# Build a package with configuration files for Yandex.Metrika.
|
DEBUILD_NOSIGN_OPTIONS="-us -uc"
|
||||||
BUILD_PACKAGE_FOR_METRIKA=$([ -f 'private/Server/metrika/config.xml' ] && echo 'yes')
|
|
||||||
|
|
||||||
while [[ $1 == --* ]]
|
while [[ $1 == --* ]]
|
||||||
do
|
do
|
||||||
# Don't sign packages, don't upload, don't create tags.
|
if [[ $1 == '--test' ]]; then
|
||||||
if [[ $1 == '--standalone' ]]
|
TEST='yes'
|
||||||
then
|
VERSION_POSTFIX+=-test
|
||||||
STANDALONE='yes'
|
shift
|
||||||
DEBUILD_NOSIGN_OPTIONS="-us -uc"
|
elif [[ $1 == '--ignore-deps' ]]; then
|
||||||
shift
|
DEBUILD_NODEPS_OPTIONS="-d"
|
||||||
elif [[ $1 == '--test' ]]
|
shift
|
||||||
then
|
elif [[ $1 == '--version' ]]; then
|
||||||
STANDALONE='yes'
|
gen_revision_author
|
||||||
TEST='yes'
|
git push
|
||||||
DEBUILD_NOSIGN_OPTIONS="-us -uc"
|
exit 0
|
||||||
shift
|
else
|
||||||
elif [[ $1 == '--ignore-deps' ]]
|
echo "Unknown option $1"
|
||||||
then
|
exit 2
|
||||||
DEBUILD_NODEPS_OPTIONS="-d"
|
fi
|
||||||
shift
|
|
||||||
elif [[ $1 == '--version' ]]
|
|
||||||
then
|
|
||||||
gen_revision_author
|
|
||||||
git push
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "Unknown option $1"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $TEST != 'yes' ]]
|
if [ -z "$REVISION" ] ; then
|
||||||
then
|
get_revision_author
|
||||||
# now incrementing done in external release scripts via --version
|
|
||||||
get_revision_author
|
|
||||||
else
|
|
||||||
REVISION=99999
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Build options
|
||||||
|
if [ -n "$SANITIZER" ]
|
||||||
|
then
|
||||||
|
CMAKE_BUILD_TYPE=$SANITIZER
|
||||||
|
VERSION_POSTFIX+=-${SANITIZER,,}
|
||||||
|
# todo: нужно ли отключить libtcmalloc?
|
||||||
|
LIBTCMALLOC_OPTS="-DENABLE_LIBTCMALLOC=0"
|
||||||
|
# GLIBC_COMPATIBILITY отключен по умолчанию
|
||||||
|
elif [[ $BUILD_TYPE == 'valgrind' ]]; then
|
||||||
|
LIBTCMALLOC_OPTS="-DENABLE_LIBTCMALLOC=0"
|
||||||
|
VERSION_POSTFIX+=-$BUILD_TYPE
|
||||||
|
elif [[ $BUILD_TYPE == 'debug' ]]; then
|
||||||
|
CMAKE_BUILD_TYPE=Debug
|
||||||
|
LIBTCMALLOC_OPTS="-DDEBUG_LIBTCMALLOC=1"
|
||||||
|
VERSION_POSTFIX+=-$BUILD_TYPE
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$THREAD_COUNT" ] ; then
|
||||||
|
THREAD_COUNT=`nproc || grep -c ^processor /proc/cpuinfo`
|
||||||
|
fi
|
||||||
|
|
||||||
|
CMAKE_FLAGS_ADD+=" $LIBTCMALLOC_OPTS -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE"
|
||||||
|
|
||||||
|
REVISION+=$VERSION_POSTFIX
|
||||||
echo -e "\nCurrent revision is $REVISION"
|
echo -e "\nCurrent revision is $REVISION"
|
||||||
|
|
||||||
gen_changelog "$REVISION" "$CHDATE" "$AUTHOR" "$CHLOG"
|
gen_changelog "$REVISION" "$CHDATE" "$AUTHOR" "$CHLOG"
|
||||||
|
|
||||||
# Build (only binary packages).
|
# Build (only binary packages).
|
||||||
debuild -eDEB_BUILD_OPTIONS=parallel=`nproc || grep -c ^processor /proc/cpuinfo` -e DEB_CC -e DEB_CXX -e CMAKE_FLAGS_ADD -b ${DEBUILD_NOSIGN_OPTIONS} ${DEBUILD_NODEPS_OPTIONS}
|
debuild -e SSH_AUTH_SOCK -e DEB_BUILD_OPTIONS=parallel=$THREAD_COUNT -e DEB_CC -e DEB_CXX -e CMAKE_FLAGS_ADD="$CMAKE_FLAGS_ADD" -b ${DEBUILD_NOSIGN_OPTIONS} ${DEBUILD_NODEPS_OPTIONS}
|
||||||
|
|
||||||
if [[ $STANDALONE != 'yes' ]]
|
|
||||||
then
|
|
||||||
upload_debs "$REVISION"
|
|
||||||
fi
|
|
||||||
|
@ -13,22 +13,44 @@ function make_control {
|
|||||||
function gen_revision_author {
|
function gen_revision_author {
|
||||||
REVISION=$(get_revision)
|
REVISION=$(get_revision)
|
||||||
|
|
||||||
if [[ $STANDALONE != 'yes' ]]
|
if [ -z $VERSION_PREFIX ] ; then
|
||||||
then
|
VERSION_PREFIX="v1.1."
|
||||||
|
fi
|
||||||
|
|
||||||
REVISION=$(($REVISION + 1))
|
if [ -z $VERSION_POSTFIX ] ; then
|
||||||
|
VERSION_POSTFIX="-testing"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $STANDALONE != 'yes' ]]; then
|
||||||
|
|
||||||
|
git fetch --tags
|
||||||
|
|
||||||
|
succeeded=0
|
||||||
|
attempts=0
|
||||||
|
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 [ "$git_tag_grep" == "" ]; then
|
||||||
|
succeeded=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ $succeeded -eq 0 ]; then
|
||||||
|
echo "Fail to create revision up to $REVISION"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
auto_message="Auto version update to"
|
auto_message="Auto version update to"
|
||||||
git_log_grep=`git log --oneline --max-count=1 | grep "$auto_message"`
|
git_log_grep=`git log --oneline --max-count=1 | grep "$auto_message"`
|
||||||
if [ "$git_log_grep" == "" ]; then
|
if [ "$git_log_grep" == "" ]; then
|
||||||
git fetch --tags
|
|
||||||
|
|
||||||
git_describe=`git describe`
|
git_describe=`git describe`
|
||||||
sed -i -- "s/VERSION_REVISION .*)/VERSION_REVISION $REVISION)/g;s/VERSION_DESCRIBE .*)/VERSION_DESCRIBE $git_describe)/g" dbms/cmake/version.cmake
|
sed -i -- "s/VERSION_REVISION .*)/VERSION_REVISION $REVISION)/g;s/VERSION_DESCRIBE .*)/VERSION_DESCRIBE $git_describe)/g" dbms/cmake/version.cmake
|
||||||
git commit -m "$auto_message [$REVISION]" dbms/cmake/version.cmake
|
git commit -m "$auto_message [$REVISION]" dbms/cmake/version.cmake
|
||||||
#git push
|
#git push
|
||||||
|
|
||||||
tag="v1.1.$REVISION-testing"
|
tag="$VERSION_PREFIX$REVISION$VERSION_POSTFIX"
|
||||||
|
|
||||||
echo -e "\nTrying to create tag: $tag"
|
echo -e "\nTrying to create tag: $tag"
|
||||||
if git tag -a "$tag" -m "$tag"
|
if git tag -a "$tag" -m "$tag"
|
||||||
|
Loading…
Reference in New Issue
Block a user