From 96cb1ae61ff63cfbfacd143b609c4b8b1e47f18f Mon Sep 17 00:00:00 2001 From: Leif Walsh Date: Sun, 28 Apr 2013 20:49:26 -0400 Subject: [PATCH] #10 misc fixes to new build script --- scripts/common.sh | 37 +++++++++++++++++++++++++++++++++++++ scripts/make.mysql.new.bash | 9 ++++----- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/scripts/common.sh b/scripts/common.sh index 6685221a0f3..7154fb57039 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -1,3 +1,27 @@ +function retry() { + set +e + local cmd + local retries + local exitcode + cmd=$* + let retries=0 + while [ $retries -le 10 ] ; do + echo `date` $cmd + bash -c "$cmd" + exitcode=$? + echo `date` $cmd $exitcode $retries + let retries=retries+1 + if [ $exitcode -eq 0 ] ; then break; fi + sleep 10 + done + set -e + test $exitcode = 0 +} + +github_use_ssh=0 +github_token= +github_user= + function github_download() { repo=$1; shift rev=$1; shift @@ -63,6 +87,19 @@ function github_download() { fi } +# returns b if b is defined else returns a +function git_tree() { + set +u + local a=$1; shift + local b=$1; shift + if [ ! -z $b ] ; then + echo $b + else + echo $a; + fi + set -u +} + # compute the number of cpus in this system. used to parallelize the build. function get_ncpus() { if [ -f /proc/cpuinfo ]; then diff --git a/scripts/make.mysql.new.bash b/scripts/make.mysql.new.bash index d28c0953e96..0e892db1a95 100644 --- a/scripts/make.mysql.new.bash +++ b/scripts/make.mysql.new.bash @@ -13,7 +13,6 @@ system=$(uname -s | tr '[:upper:]' '[:lower:]') arch=$(uname -m | tr '[:upper:]' '[:lower:]') makejobs=$(get_ncpus) -github_use_ssh=0 git_tag=HEAD mysqlbuild= mysql=mysql-5.5.30 @@ -110,9 +109,9 @@ if [ ! -d storage/tokudb/ft-index/third_party/jemalloc ] ; then fi # append tokudb-specific version -if grep -qv tokudb VERSION ; then +if [ $(fgrep tokudb VERSION | wc -l) = 0 ] ; then # append the tokudb version to the MYSQL_VERSION_EXTRA variable in the VERSION file - sed -i "" -e"s/^MYSQL_VERSION_EXTRA=.*/&-tokudb-${tokudb_version}/" VERSION + sed --in-place="" -e "s/^MYSQL_VERSION_EXTRA=.*/&-tokudb-${tokudb_version}/" VERSION fi # prints a cmake command to eval @@ -159,10 +158,10 @@ function generate_cmake_cmd () { linux_distro=linux if [ -f /etc/issue ] ; then if [[ "$(head -1 /etc/issue)" =~ "Red Hat Enterprise Linux Server release ([56])" ]] ; then - linux_distro=rhel${BASH_REMATCH[1]) + linux_distro=rhel${BASH_REMATCH[1]} fi if [[ "$(head -1 /etc/issue)" =~ "CentOS release ([56])" ]] ; then - linux_distro=centos${BASH_REMATCH[1]) + linux_distro=centos${BASH_REMATCH[1]} fi fi echo -n " " -D RPM=$linux_distro