mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12: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
|
||||
|
||||
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
|
||||
CHLOG=debian/changelog
|
||||
CHDATE=$(LC_ALL=C date -R | sed -e 's/,/\\,/g') # Replace comma to '\,'
|
||||
|
||||
# Build a package with configuration files for Yandex.Metrika.
|
||||
BUILD_PACKAGE_FOR_METRIKA=$([ -f 'private/Server/metrika/config.xml' ] && echo 'yes')
|
||||
DEBUILD_NOSIGN_OPTIONS="-us -uc"
|
||||
|
||||
while [[ $1 == --* ]]
|
||||
do
|
||||
# Don't sign packages, don't upload, don't create tags.
|
||||
if [[ $1 == '--standalone' ]]
|
||||
then
|
||||
STANDALONE='yes'
|
||||
DEBUILD_NOSIGN_OPTIONS="-us -uc"
|
||||
shift
|
||||
elif [[ $1 == '--test' ]]
|
||||
then
|
||||
STANDALONE='yes'
|
||||
TEST='yes'
|
||||
DEBUILD_NOSIGN_OPTIONS="-us -uc"
|
||||
shift
|
||||
elif [[ $1 == '--ignore-deps' ]]
|
||||
then
|
||||
DEBUILD_NODEPS_OPTIONS="-d"
|
||||
shift
|
||||
elif [[ $1 == '--version' ]]
|
||||
then
|
||||
gen_revision_author
|
||||
git push
|
||||
exit 0
|
||||
else
|
||||
echo "Unknown option $1"
|
||||
exit 2
|
||||
fi
|
||||
if [[ $1 == '--test' ]]; then
|
||||
TEST='yes'
|
||||
VERSION_POSTFIX+=-test
|
||||
shift
|
||||
elif [[ $1 == '--ignore-deps' ]]; then
|
||||
DEBUILD_NODEPS_OPTIONS="-d"
|
||||
shift
|
||||
elif [[ $1 == '--version' ]]; then
|
||||
gen_revision_author
|
||||
git push
|
||||
exit 0
|
||||
else
|
||||
echo "Unknown option $1"
|
||||
exit 2
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $TEST != 'yes' ]]
|
||||
then
|
||||
# now incrementing done in external release scripts via --version
|
||||
get_revision_author
|
||||
else
|
||||
REVISION=99999
|
||||
if [ -z "$REVISION" ] ; then
|
||||
get_revision_author
|
||||
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"
|
||||
|
||||
gen_changelog "$REVISION" "$CHDATE" "$AUTHOR" "$CHLOG"
|
||||
|
||||
# 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}
|
||||
|
||||
if [[ $STANDALONE != 'yes' ]]
|
||||
then
|
||||
upload_debs "$REVISION"
|
||||
fi
|
||||
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}
|
||||
|
@ -13,22 +13,44 @@ function make_control {
|
||||
function gen_revision_author {
|
||||
REVISION=$(get_revision)
|
||||
|
||||
if [[ $STANDALONE != 'yes' ]]
|
||||
then
|
||||
if [ -z $VERSION_PREFIX ] ; 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"
|
||||
git_log_grep=`git log --oneline --max-count=1 | grep "$auto_message"`
|
||||
if [ "$git_log_grep" == "" ]; then
|
||||
git fetch --tags
|
||||
|
||||
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
|
||||
git commit -m "$auto_message [$REVISION]" dbms/cmake/version.cmake
|
||||
#git push
|
||||
|
||||
tag="v1.1.$REVISION-testing"
|
||||
tag="$VERSION_PREFIX$REVISION$VERSION_POSTFIX"
|
||||
|
||||
echo -e "\nTrying to create tag: $tag"
|
||||
if git tag -a "$tag" -m "$tag"
|
||||
|
Loading…
Reference in New Issue
Block a user