Update Mroonga to the latest version on 2015-04-30T04:44:30+0900

This commit is contained in:
Kentoku SHIBA 2015-04-30 04:44:30 +09:00
commit a0fdb258a4
413 changed files with 25886 additions and 5251 deletions

View file

@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright(C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -20,17 +20,17 @@
set -e
if [ "${MROONGA_BUNDLED}" = "yes" ]; then
cmake_args=(-DCMAKE_BUILD_TYPE=Debug)
if [ "${MROONGA_TEST_EMBEDDED}" = "yes" ]; then
cmake_args=("${cmake_args[@]}" "-DWITH_EMBEDDED_SERVER=TRUE")
fi
cmake . "${cmake_args[@]}"
cmake_args=(-DCMAKE_BUILD_TYPE=Debug)
if [ "${MROONGA_TEST_EMBEDDED}" = "yes" ]; then
cmake_args=("${cmake_args[@]}" "-DWITH_EMBEDDED_SERVER=TRUE")
fi
cmake . "${cmake_args[@]}"
else
./autogen.sh
./autogen.sh
if [ -d /opt/mysql/ ]; then
PATH=$(echo /opt/mysql/server-*/bin/):$PATH
fi
./configure \
--with-mysql-source=$PWD/vendor/mysql
if [ -d /opt/mysql/ ]; then
PATH=$(echo /opt/mysql/server-*/bin/):$PATH
fi
./configure \
--with-mysql-source=$PWD/vendor/mysql
fi

View file

@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright(C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -21,85 +21,94 @@ set -e
mariadb_download_base=http://mirror.jmu.edu/pub/mariadb
# export GROONGA_MASTER=yes
# export GROONGA_NORMALIZER_MYSQL_MASTER=yes
curl --silent --location https://github.com/groonga/groonga/raw/master/data/travis/setup.sh | sh
curl --silent --location https://github.com/groonga/groonga-normalizer-mysql/raw/master/data/travis/setup.sh | sh
# curl --silent --location https://github.com/clear-code/cutter/raw/master/data/travis/setup.sh | sh
if [ ! -f /usr/lib/groonga/plugins/tokenizers/mecab.so ]; then
sudo apt-get -qq -y install groonga-tokenizer-mecab
fi
export GROONGA_MASTER=yes
export GROONGA_NORMALIZER_MYSQL_MASTER=yes
if [ "${MROONGA_BUNDLED}" = "yes" ]; then
mkdir -p .mroonga
mv * .mroonga/
mv .mroonga/tools ./
sudo apt-get -qq -y build-dep mysql-server
# Support MariaDB for now.
download_base=${mariadb_download_base}/${MYSQL_VERSION}
tar_gz=${MYSQL_VERSION}.tar.gz
curl -O ${download_base}/source/${tar_gz}
tar xzf $tar_gz
mv ${MYSQL_VERSION}/* ./
rm -rf storage/mroonga
mv .mroonga storage/mroonga
rm -rf ${MYSQL_VERSION}
mkdir -p .mroonga
mv * .mroonga/
mv .mroonga/tools ./
sudo apt-get -qq -y build-dep mysql-server
# Support MariaDB for now.
download_base=${mariadb_download_base}/${MYSQL_VERSION}
tar_gz=${MYSQL_VERSION}.tar.gz
curl -O ${download_base}/source/${tar_gz}
tar xzf $tar_gz
mv ${MYSQL_VERSION}/* ./
rm -rf storage/mroonga
mv .mroonga storage/mroonga
rm -rf ${MYSQL_VERSION}
git clone --recursive --depth 1 \
https://github.com/groonga/groonga.git \
storage/mroonga/vendor/groonga
git clone --recursive --depth 1 \
https://github.com/groonga/groonga-normalizer-mysql.git \
storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql
else
mkdir -p vendor
cd vendor
curl --silent --location \
https://github.com/groonga/groonga/raw/master/data/travis/setup.sh | sh
curl --silent --location \
https://github.com/groonga/groonga-normalizer-mysql/raw/master/data/travis/setup.sh | sh
# curl --silent --location \
# https://github.com/clear-code/cutter/raw/master/data/travis/setup.sh | sh
version=$(echo "$MYSQL_VERSION" | sed -e 's/^\(mysql\|mariadb\)-//')
series=$(echo "$version" | sed -e 's/\.[0-9]*\(-\?[a-z]*\)\?$//g')
case "$MYSQL_VERSION" in
mysql-*)
sudo apt-get -qq update
sudo apt-get -qq -y build-dep mysql-server
if [ "$version" = "system" ]; then
sudo apt-get -qq -y install \
mysql-server mysql-server-5.5 mysql-server-core-5.5 \
mysql-testsuite libmysqld-dev
apt-get -qq source mysql-server
ln -s $(find . -maxdepth 1 -type d | sort | tail -1) mysql
else
download_base="http://cdn.mysql.com/Downloads/MySQL-${series}/"
if [ "$(uname -m)" = "x86_64" ]; then
architecture=x86_64
else
architecture=i686
fi
deb=mysql-${version}-debian6.0-${architecture}.deb
tar_gz=mysql-${version}.tar.gz
curl -O ${download_base}${deb} &
curl -O ${download_base}${tar_gz} &
wait
sudo apt-get -qq -y install libaio1
sudo dpkg -i $deb
tar xzf $tar_gz
ln -s mysql-${version} mysql
fi
;;
mariadb-*)
sudo apt-get -qq -y remove --purge mysql-common
if [ ! -f /usr/lib/groonga/plugins/tokenizers/mecab.so ]; then
sudo apt-get -qq -y install groonga-tokenizer-mecab
fi
distribution=$(lsb_release --short --id | tr 'A-Z' 'a-z')
code_name=$(lsb_release --short --codename)
component=main
apt_url_base="${mariadb_download_base}/repo/${series}"
cat <<EOF | sudo tee /etc/apt/sources.list.d/mariadb.list
mkdir -p vendor
cd vendor
version=$(echo "$MYSQL_VERSION" | sed -e 's/^\(mysql\|mariadb\)-//')
series=$(echo "$version" | sed -e 's/\.[0-9]*\(-\?[a-z]*\)\?$//g')
case "$MYSQL_VERSION" in
mysql-*)
sudo apt-get -qq update
sudo apt-get -qq -y build-dep mysql-server
if [ "$version" = "system" ]; then
sudo apt-get -qq -y install \
mysql-server mysql-server-5.5 mysql-server-core-5.5 \
mysql-testsuite libmysqld-dev
apt-get -qq source mysql-server
ln -s $(find . -maxdepth 1 -type d | sort | tail -1) mysql
else
download_base="http://cdn.mysql.com/Downloads/MySQL-${series}/"
if [ "$(uname -m)" = "x86_64" ]; then
architecture=x86_64
else
architecture=i686
fi
deb=mysql-${version}-debian6.0-${architecture}.deb
tar_gz=mysql-${version}.tar.gz
curl -O ${download_base}${deb} &
curl -O ${download_base}${tar_gz} &
wait
sudo apt-get -qq -y install libaio1
sudo dpkg -i $deb
tar xzf $tar_gz
ln -s mysql-${version} mysql
fi
;;
mariadb-*)
sudo apt-get -qq -y remove --purge mysql-common
distribution=$(lsb_release --short --id | tr 'A-Z' 'a-z')
code_name=$(lsb_release --short --codename)
component=main
apt_url_base="${mariadb_download_base}/repo/${series}"
cat <<EOF | sudo tee /etc/apt/sources.list.d/mariadb.list
deb ${apt_url_base}/${distribution}/ ${code_name} ${component}
deb-src ${apt_url_base}/${distribution}/ ${code_name} ${component}
EOF
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
sudo apt-get -qq update
sudo apt-get -qq -y build-dep mariadb-server
sudo apt-get -qq -y install \
mariadb-server libmariadbclient-dev mariadb-test
apt-get -qq source mariadb-server
ln -s $(find . -maxdepth 1 -type d | sort | tail -1) mysql
;;
esac
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
sudo apt-get -qq update
sudo apt-get -qq -y build-dep mariadb-server
sudo apt-get -qq -y install \
mariadb-server libmariadbclient-dev mariadb-test
apt-get -qq source mariadb-server
ln -s $(find . -maxdepth 1 -type d | sort | tail -1) mysql
;;
esac
cd ..
cd ..
fi

View file

@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright(C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -24,95 +24,95 @@ top_dir="${base_dir}/../.."
bundled_mroonga_dir="${top_dir}/storage/mroonga"
if [ -f "${bundled_mroonga_dir}/config.sh" ]; then
mroonga_dir="${bundled_mroonga_dir}"
. "${bundled_mroonga_dir}/config.sh"
mroonga_dir="${bundled_mroonga_dir}"
. "${bundled_mroonga_dir}/config.sh"
else
mroonga_dir="${top_dir}"
. "${top_dir}/config.sh"
mroonga_dir="${top_dir}"
. "${top_dir}/config.sh"
fi
n_processors="$(grep '^processor' /proc/cpuinfo | wc -l)"
max_n_processors=8
if (( $n_processors > $max_n_processors )); then
n_processors=$max_n_processors
n_processors=$max_n_processors
fi
build()
{
if [ "${MROONGA_BUNDLED}" = "yes" ]; then
make > /dev/null
else
make -j${n_processors} > /dev/null
fi
if [ "${MROONGA_BUNDLED}" = "yes" ]; then
make -j${n_processors} > /dev/null
else
make -j${n_processors} > /dev/null
fi
}
run_unit_test()
{
if [ "${MROONGA_BUNDLED}" != "yes" ]; then
NO_MAKE=yes ${mroonga_dir}/test/run-unit-test.sh
fi
if [ "${MROONGA_BUNDLED}" != "yes" ]; then
NO_MAKE=yes ${mroonga_dir}/test/run-unit-test.sh
fi
}
prepare_mysql_test_dir()
{
mysql_test_dir=/usr/mysql-test
if [ -d /usr/lib/mysql-testsuite/ ]; then
sudo cp -a /usr/lib/mysql-testsuite/ ${mysql_test_dir}/
elif [ -d /usr/share/mysql/mysql-test/ ]; then
sudo cp -a /usr/share/mysql/mysql-test/ ${mysql_test_dir}/
elif [ -d /opt/mysql/ ]; then
mysql_test_dir=$(echo /opt/mysql/server-*/mysql-test)
else
sudo cp -a ${MYSQL_SOURCE_DIR}/mysql-test/ ${mysql_test_dir}/
fi
sudo chown -R $(id -u):$(id -g) ${mysql_test_dir}/
mysql_test_dir=/usr/mysql-test
if [ -d /usr/lib/mysql-testsuite/ ]; then
sudo cp -a /usr/lib/mysql-testsuite/ ${mysql_test_dir}/
elif [ -d /usr/share/mysql/mysql-test/ ]; then
sudo cp -a /usr/share/mysql/mysql-test/ ${mysql_test_dir}/
elif [ -d /opt/mysql/ ]; then
mysql_test_dir=$(echo /opt/mysql/server-*/mysql-test)
else
sudo cp -a ${MYSQL_SOURCE_DIR}/mysql-test/ ${mysql_test_dir}/
fi
sudo chown -R $(id -u):$(id -g) ${mysql_test_dir}/
cp -a ${mroonga_dir}/mysql-test/mroonga/ ${mysql_test_dir}/suite/
cp -a ${mroonga_dir}/mysql-test/mroonga/ ${mysql_test_dir}/suite/
}
collect_test_suite_names()
{
cd ${mysql_test_dir}/suite/
test_suite_names=""
for test_suite_name in $(find mroonga -type d '!' -name '[tr]'); do
if [ -n "${test_suite_names}" ]; then
test_suite_names="${test_suite_names},"
fi
test_suite_names="${test_suite_names}${test_suite_name}"
done
cd -
cd ${mysql_test_dir}/suite/
test_suite_names=""
for test_suite_name in $(find mroonga -type d '!' -name '[tr]'); do
if [ -n "${test_suite_names}" ]; then
test_suite_names="${test_suite_names},"
fi
test_suite_names="${test_suite_names}${test_suite_name}"
done
cd -
}
prepare_sql_test()
{
sudo make install > /dev/null
prepare_mysql_test_dir
collect_test_suite_names
sudo make install > /dev/null
prepare_mysql_test_dir
collect_test_suite_names
}
run_sql_test()
{
test_args=()
if [ "${MROONGA_TEST_EMBEDDED}" = "yes" ]; then
test_args=("${test_args[@]}" "--embedded-server")
fi
test_args=()
if [ "${MROONGA_TEST_EMBEDDED}" = "yes" ]; then
test_args=("${test_args[@]}" "--embedded-server")
fi
if [ "${MROONGA_BUNDLED}" = "yes" ]; then
${mroonga_dir}/test/run-sql-test.sh \
"${test_args[@]}" \
--parallel="${n_processors}"
else
prepare_sql_test
if [ "${MROONGA_BUNDLED}" = "yes" ]; then
${mroonga_dir}/test/run-sql-test.sh \
"${test_args[@]}" \
--parallel="${n_processors}"
else
prepare_sql_test
cd ${mysql_test_dir}/
./mysql-test-run.pl \
"${test_args[@]}" \
--no-check-testcases \
--parallel="${n_processors}" \
--retry=1 \
--suite="${test_suite_names}" \
--force
fi
cd ${mysql_test_dir}/
./mysql-test-run.pl \
"${test_args[@]}" \
--no-check-testcases \
--parallel="${n_processors}" \
--retry=1 \
--suite="${test_suite_names}" \
--force
fi
}
build