summaryrefslogtreecommitdiff
path: root/support-files
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-12-16 16:49:19 -0800
committerIgor Babaev <igor@askmonty.org>2012-12-16 16:49:19 -0800
commit7760efad74140680b1eefaf2172b0fa26f7b1146 (patch)
tree57742baa180206a1cd3ea35d38c58108accd22a9 /support-files
parent40bbf697aad7d923fc1bd995bc5f547e45461cbe (diff)
parentb8b875cb796743240bed71857eae73d37f03c28f (diff)
downloadmariadb-git-7760efad74140680b1eefaf2172b0fa26f7b1146.tar.gz
Merge mariadb-5.5 -> 10.0-base.
Diffstat (limited to 'support-files')
-rw-r--r--support-files/mysql.spec.sh28
-rw-r--r--support-files/rpm/server-postin.sh53
2 files changed, 59 insertions, 22 deletions
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 5b9a296d90a..0d673e5b339 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -252,6 +252,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
@@ -403,6 +406,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
@@ -480,6 +493,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
@@ -1146,6 +1166,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 Sep 28 2011 Joerg Bruehe <joerg.bruehe@oracle.com>
- Fix duplicate mentioning of "mysql_plugin" and its manual page,
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