diff options
author | Seppo Jaakola <seppo.jaakola@codership.com> | 2012-10-24 23:13:43 +0300 |
---|---|---|
committer | Seppo Jaakola <seppo.jaakola@codership.com> | 2012-10-24 23:13:43 +0300 |
commit | 9b47a442b5452cb6c541e312f78746e7739e9f42 (patch) | |
tree | 29217d146f72f319b52e22820fbaae385e19c15b /support-files | |
parent | ef6f9a8250804efb047ad6f28e476c59d7223e85 (diff) | |
parent | 797082ca712f52437571e24962e26573d0723ad1 (diff) | |
download | mariadb-git-9b47a442b5452cb6c541e312f78746e7739e9f42.tar.gz |
References lp:1066784 - bzr merge lp:maria/5.5 (rev: 3562)
Diffstat (limited to 'support-files')
-rw-r--r-- | support-files/mysql.spec.sh | 28 | ||||
-rw-r--r-- | support-files/rpm/server-postin.sh | 53 |
2 files changed, 59 insertions, 22 deletions
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 4d7b1de6cb1..aeedd652d73 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -267,6 +267,9 @@ Vendor: %{mysql_vendor} Provides: msqlormysql MySQL-server mysql BuildRequires: %{distro_buildreq} +# Regression tests may take a long time, override the default to skip them +%{!?runselftest:%global runselftest 1} + # Think about what you use here since the first step is to # run a rm -rf BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -427,6 +430,16 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/ ############################################################################## %build +# Fail quickly and obviously if user tries to build as root +%if %runselftest + if [ x"`id -u`" = x0 ]; then + echo "The MySQL regression tests may fail if run as root." + echo "If you really need to build the RPM as root, use" + echo "--define='runselftest 0' to skip the regression tests." + exit 1 + fi +%endif + # Be strict about variables, bail at earliest opportunity, etc. set -eu @@ -510,6 +523,13 @@ mkdir release make ${MAKE_JFLAG} VERBOSE=1 ) +%if %runselftest + MTR_BUILD_THREAD=auto + export MTR_BUILD_THREAD + + (cd release && make test-bt-fast || true) +%endif + ############################################################################## %install @@ -1204,6 +1224,14 @@ echo "=====" >> $STATUS_HISTORY # merging BK trees) ############################################################################## %changelog +* Tue Jul 24 2012 Joerg Bruehe <joerg.bruehe@oracle.com> + +- Add a macro "runselftest": + if set to 1 (default), the test suite will be run during the RPM build; + this can be oveeridden via the command line by adding + --define "runselftest 0" + Failures of the test suite will NOT make the RPM build fail! + * Wed Dec 07 2011 Alexey Yurchenko <alexey.yurchenko@codership.com> - wsrep-related cleanups. diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh index 88ff059ff22..156865b61ad 100644 --- a/support-files/rpm/server-postin.sh +++ b/support-files/rpm/server-postin.sh @@ -1,37 +1,46 @@ -mysql_datadir=%{mysqldatadir} - -# Create data directory -mkdir -p $mysql_datadir/{mysql,test} # Make MySQL start/shutdown automatically when the machine does it. if [ $1 = 1 ] ; then if [ -x /sbin/chkconfig ] ; then /sbin/chkconfig --add mysql fi -fi -# Create a MySQL user and group. Do not report any problems if it already -# exists. -groupadd -r %{mysqld_group} 2> /dev/null || true -useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true -# The user may already exist, make sure it has the proper group nevertheless (BUG#12823) -usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true + mysql_dirs=(`%{_sbindir}/mysqld --verbose --help 2>/dev/null|sed -ne 's/^\(basedir\|datadir\)[[:space:]]*\(.*\)$/\2/p'`) + basedir="${mysql_dirs[0]}" + datadir="${mysql_dirs[1]}" + # datadir may be relative to a basedir! + if expr $datadir : / > /dev/null; then + mysql_datadir=$datadir + else + mysql_datadir=$basedir/$datadir + fi + + # Create a MySQL user and group. Do not report any problems if it already + # exists. + groupadd -r %{mysqld_group} 2> /dev/null || true + useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true + # The user may already exist, make sure it has the proper group nevertheless (BUG#12823) + usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true -# Change permissions so that the user that will run the MySQL daemon -# owns all database files. -chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir + # Change permissions so that the user that will run the MySQL daemon + # owns all database files. + chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir -# Initiate databases -%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user} + if [ ! -e $mysql_datadir ]; then + # Create data directory + mkdir -p $mysql_datadir/{mysql,test} -# Upgrade databases if needed would go here - but it cannot be automated yet + # Initiate databases + %{_bindir}/mysql_install_db --rpm --user=%{mysqld_user} + fi -# Change permissions again to fix any new files. -chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir + # Change permissions again to fix any new files. + chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir -# Fix permissions for the permission database so that only the user -# can read them. -chmod -R og-rw $mysql_datadir/mysql + # Fix permissions for the permission database so that only the user + # can read them. + chmod -R og-rw $mysql_datadir/mysql +fi # install SELinux files - but don't override existing ones SETARGETDIR=/etc/selinux/targeted/src/policy |