Commit b47e18cd authored by Rich Prohaska's avatar Rich Prohaska

build from a branch

parent 6cf610b4
...@@ -4,16 +4,26 @@ shopt -s compat31 2> /dev/null ...@@ -4,16 +4,26 @@ shopt -s compat31 2> /dev/null
function usage() { function usage() {
echo "make.mysql.bash - build mysql with the fractal tree" echo "make.mysql.bash - build mysql with the fractal tree"
echo "--git_tag=$git_tag --git_server=$git_server" echo "--git_tag=$git_tag"
echo "--mysqlbuild=$mysqlbuild" echo "--mysqlbuild=$mysqlbuild"
echo "--tokudb_version=$tokudb_version"
echo "--mysql=$mysql" echo "--mysql=$mysql"
echo "--build_type=$build_type" echo "--build_type=$build_type"
echo "--build_debug=$build_debug" echo "--build_debug=$build_debug"
echo "--build_tgz=$build_tgz" echo "--build_tgz=$build_tgz"
echo "--build_rpm=$build_rpm" echo "--build_rpm=$build_rpm"
echo "--cmake_build_type=$cmake_build_type"
echo "--cc=$cc --cxx=$cxx" echo "--cc=$cc --cxx=$cxx"
echo "--do_s3=$do_s3 --do_make_check=$do_make_check" echo "--do_s3=$do_s3"
echo "--do_make_check=$do_make_check"
echo "example: build from the tokudb-7.0.1 git tag"
echo " make.mysql.bash --mysqlbuild=mysql-5.5.30-tokudb-7.0.1-linux-x86_64"
echo " make.mysql.bash --mysqlbuild=mariadb-5.5.30-tokudb-7.0.1-linux-x86_64"
echo " make.mysql.bash --git_tag=tokudb-7.0.1 --mysql=mysql-5.5.30"
echo "example: build from the HEAD of the repos"
echo " make.mysql.bash --mysql=mysql-5.5.30 --tokudb_version=my_tokudb_version"
echo " make.mysql.bash --mysql=mariadb-5.5.30 --tokudb_versio=my_tokudb_verison"
echo "example: build from a branch"
echo " make.mysql.bash --mysql_tree=my_mysql_branch --ftengine_tree=my_ftengine_branch"
return 1 return 1
} }
...@@ -46,26 +56,37 @@ function github_download() { ...@@ -46,26 +56,37 @@ function github_download() {
--header "Authorization:\\ token\\ $github_token" \ --header "Authorization:\\ token\\ $github_token" \
--location https://api.github.com/repos/$repo/tarball/$rev \ --location https://api.github.com/repos/$repo/tarball/$rev \
--output $dest.tar.gz --output $dest.tar.gz
if [ $? != 0 ] ; then return; fi
tar --extract \ tar --extract \
--gzip \ --gzip \
--directory=$dest \ --directory=$dest \
--strip-components=1 \ --strip-components=1 \
--file $dest.tar.gz --file $dest.tar.gz
if [ $? != 0 ] ; then return; fi
rm -f $dest.tar.gz rm -f $dest.tar.gz
elif [ ! -z $github_user ] ; then elif [ ! -z $github_user ] ; then
retry curl \ retry curl \
--user $github_user \ --user $github_user \
--location https://api.github.com/repos/$repo/tarball/$rev \ --location https://api.github.com/repos/$repo/tarball/$rev \
--output $dest.tar.gz --output $dest.tar.gz
if [ $? != 0 ] ; then return; fi
tar --extract \ tar --extract \
--gzip \ --gzip \
--directory=$dest \ --directory=$dest \
--strip-components=1 \ --strip-components=1 \
--file $dest.tar.gz --file $dest.tar.gz
if [ $? != 0 ] ; then return; fi
rm -f $dest.tar.gz rm -f $dest.tar.gz
else else
tempdir=$(mktemp -d -p $PWD) tempdir=$(mktemp -d -p $PWD)
retry git clone git@github.com:${repo}.git $tempdir retry git clone git@github.com:${repo}.git $tempdir
if [ $? != 0 ] ; then return; fi
if [ $rev != HEAD ] ; then
pushd $tempdir
git checkout $rev; exitcode=$?
popd
if [ $exitcode != 0 ] ; then return $exitcode; fi
fi
# export the right branch or tag # export the right branch or tag
(cd $tempdir ; (cd $tempdir ;
...@@ -74,12 +95,21 @@ function github_download() { ...@@ -74,12 +95,21 @@ function github_download() {
$rev) | \ $rev) | \
tar --extract \ tar --extract \
--directory $dest --directory $dest
if [ $? != 0 ] ; then exit 1; fi if [ $? != 0 ] ; then return; fi
rm -rf $tempdir rm -rf $tempdir
fi fi
} }
function git_tree() {
local a=$1; shift
local b=$1; shift
if [ ! -z $b ] ; then
echo $b
else
echo $a;
fi
}
function get_ncpus() { function get_ncpus() {
if [ -f /proc/cpuinfo ]; then if [ -f /proc/cpuinfo ]; then
grep bogomips /proc/cpuinfo | wc -l grep bogomips /proc/cpuinfo | wc -l
...@@ -93,7 +123,7 @@ function get_ncpus() { ...@@ -93,7 +123,7 @@ function get_ncpus() {
function build_jemalloc() { function build_jemalloc() {
if [ ! -d jemalloc ] ; then if [ ! -d jemalloc ] ; then
# get the jemalloc repo jemalloc # get the jemalloc repo jemalloc
github_download Tokutek/jemalloc $git_tag jemalloc github_download Tokutek/jemalloc $(git_tree $git_tag $jemalloc_tree) jemalloc
if [ $? != 0 ] ; then exit 1; fi if [ $? != 0 ] ; then exit 1; fi
pushd jemalloc pushd jemalloc
if [ $? != 0 ] ; then exit 1; fi if [ $? != 0 ] ; then exit 1; fi
...@@ -110,7 +140,7 @@ function build_fractal_tree() { ...@@ -110,7 +140,7 @@ function build_fractal_tree() {
if [ ! -d ft-index ] ; then if [ ! -d ft-index ] ; then
# get the ft-index repo # get the ft-index repo
github_download Tokutek/ft-index $git_tag ft-index github_download Tokutek/ft-index $(git_tree $git_tag $ftindex_tree) ft-index
if [ $? != 0 ] ; then exit 1; fi if [ $? != 0 ] ; then exit 1; fi
# get the commit id of the ft-index repo # get the commit id of the ft-index repo
...@@ -415,19 +445,19 @@ function build_mysql_src() { ...@@ -415,19 +445,19 @@ function build_mysql_src() {
# get the mysql repo # get the mysql repo
if [ ! -d $mysql_distro ] ; then if [ ! -d $mysql_distro ] ; then
github_download Tokutek/$mysql_distro $git_tag $mysqlsrc github_download Tokutek/$mysql_distro $(git_tree $git_tag $mysql_tree) $mysqlsrc
if [ $? != 0 ] ; then exit 1; fi if [ $? != 0 ] ; then exit 1; fi
fi fi
# get the hot backup source # get the hot backup source
if [ ! -d backup-$build_type ] ; then if [ ! -d backup-$build_type ] ; then
github_download Tokutek/backup-$build_type $git_tag backup-$build_type github_download Tokutek/backup-$build_type $(git_tree $git_tag $backup_tree) backup-$build_type
if [ $? != 0 ] ; then exit 1; fi if [ $? != 0 ] ; then exit 1; fi
fi fi
# get the ft-engine repo # get the ft-engine repo
if [ ! -d ft-engine ] ; then if [ ! -d ft-engine ] ; then
github_download Tokutek/ft-engine $git_tag ft-engine github_download Tokutek/ft-engine $(git_tree $git_tag $ftengine_tree) ft-engine
if [ $? != 0 ] ; then exit 1; fi if [ $? != 0 ] ; then exit 1; fi
fi fi
...@@ -522,6 +552,8 @@ function build_mysql_release() { ...@@ -522,6 +552,8 @@ function build_mysql_release() {
fi fi
} }
# parse a mysqlbuild string and extract the mysql_distro, mysql_version, tokudb_distro, tokudb_version, target_system, and target_arch
# compute build_type, build_debug, and git_tag
function parse_mysqlbuild() { function parse_mysqlbuild() {
local mysqlbuild=$1 local mysqlbuild=$1
local exitcode local exitcode
...@@ -542,7 +574,7 @@ function parse_mysqlbuild() { ...@@ -542,7 +574,7 @@ function parse_mysqlbuild() {
fi fi
if [[ $tokudb_version =~ (.*)-debug$ ]] ; then if [[ $tokudb_version =~ (.*)-debug$ ]] ; then
build_debug=1 build_debug=1
tokudb_verison=${BASH_REMATCH[1]} tokudb_version=${BASH_REMATCH[1]}
else else
build_debug=0 build_debug=0
fi fi
...@@ -566,7 +598,6 @@ system=$(uname -s | tr '[:upper:]' '[:lower:]') ...@@ -566,7 +598,6 @@ system=$(uname -s | tr '[:upper:]' '[:lower:]')
arch=$(uname -m | tr '[:upper:]' '[:lower:]') arch=$(uname -m | tr '[:upper:]' '[:lower:]')
makejobs=$(get_ncpus) makejobs=$(get_ncpus)
git_server=git@github.com
git_tag=HEAD git_tag=HEAD
mysqlbuild= mysqlbuild=
mysql=mysql-5.5.30 mysql=mysql-5.5.30
...@@ -578,8 +609,14 @@ build_debug=0 ...@@ -578,8 +609,14 @@ build_debug=0
build_type=community build_type=community
build_tgz=1 build_tgz=1
build_rpm=0 build_rpm=0
tokudb_version=
tokudb_patches=1 tokudb_patches=1
cmake_build_type=RelWithDebInfo cmake_build_type=RelWithDebInfo
mysql_tree=
ftengine_tree=
ftindex_tree=
jemalloc_tree=
backup_tree=
while [ $# -gt 0 ] ; do while [ $# -gt 0 ] ; do
arg=$1; shift arg=$1; shift
...@@ -595,8 +632,7 @@ done ...@@ -595,8 +632,7 @@ done
if [ ! -z $mysqlbuild ] ; then if [ ! -z $mysqlbuild ] ; then
parse_mysqlbuild $mysqlbuild parse_mysqlbuild $mysqlbuild
if [ $? != 0 ] ; then exit 1; fi if [ $? != 0 ] ; then exit 1; fi
else elif [ -z $tokudb_version ] ; then
# set tokudb version
if [ $git_tag = HEAD ] ; then if [ $git_tag = HEAD ] ; then
tokudb_version=$(date +%s) tokudb_version=$(date +%s)
elif [[ $git_tag =~ tokudb-(.*) ]] ; then elif [[ $git_tag =~ tokudb-(.*) ]] ; then
...@@ -622,8 +658,8 @@ else ...@@ -622,8 +658,8 @@ else
exit 1 exit 1
fi fi
# set build dir
builddir=build-tokudb-$tokudb_version builddir=build-tokudb-$tokudb_version
if [ -d builds ] ; then builddir=builds/$builddir; fi
if [ ! -d $builddir ] ; then mkdir $builddir; fi if [ ! -d $builddir ] ; then mkdir $builddir; fi
pushd $builddir pushd $builddir
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment