mariadb/mariadb.spec

964 lines
37 KiB
RPMSpec
Raw Normal View History

#
# spec file for package mariadb (Version 5.1.44)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
# Few definitions which will alter build
%define prefered 0
%define cluster 0
%define srv_vers 5.1.47
%if %{?rel:0}%{!?rel:1}
%define rel 1
%endif
#Distribution: %dist
#Packager: %packager
#Vendor: %vendor
Name: mariadb
Summary: A True Multiuser, Multithreaded SQL Database Server
Version: 5.1.47
Release: 0
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Group: Productivity/Databases/Servers
Url: http://www.mysql.com
# http://askmonty.org/downloads/r/http://ftp.rediris.es/mirror/MariaDB/mariadb-5.1.47/kvm-tarbake-jaunty-x86/%{name}-%{version}.tar.gz
Source: mariadb-%{version}.tar.bz2
Source2: baselibs.conf
Source3: README.debug
Source4: suse-test-run
Source5: mysql.SuSEfirewall2
Source7: rc.mysql-multi
Source8: README.SuSE
# Polishing default config file
Patch2: mysql-cnf.patch
Patch3: mysql-multi-configuration.patch
# Adds option to set group to something else similarly to the user settings
Patch4: mysql-group.patch
# Warning about initscript in mysql_install_db disabled, since the SUSE RPM comes with an init script installed
Patch5: mysql-install_db-quiet.patch
# Checks flush-logs exit status in support-files/mysql-log-rotate.sh
Patch7: mysql-logrotate.patch
# Adds reload funcionality to mysqld_multi.sh perl script and adds --datadir support
Patch8: mysqld_multi.patch
# Disables failure on one test during update and improves error message during update a little bit
Patch13: mysql_upgrade-exit-status.patch
# Changes pkglib_LIBRARIES into lib_LIBRARIES in libmysql
Patch18: libmysql-no-pkglibdir.patch
# Adds option -avoid-version to LDFLAGS for plugins blackhole, archive and example
Patch19: mysql-plugins-avoid-version.patch
# This patch loads plugins by default if there is no settings regarding plugins.
Patch23: mysql-enable-plugins.patch
# PATCH-FIX-UPSTREAM mysql-5.1.31-shebang.patch [] mhrusecky@suse.cz -- adds mising shebangs
Patch25: mysql-5.1.31-shebang.patch
# PATCH-FIX-UPSTREAM mysql-5.1.35-test-variables-big.patch [upstream bug #38811] -- different way to test whether server crashed
# http://bugs.mysql.com/bug.php?id=38811
Patch27: mysql-5.1.35-test-variables-big.patch
# PATCH-FIX-SUSE mysql-5.1.32-myslq-test.patch mhrusecky@suse.cz -- installs tests into datadir not into prefix
Patch28: mysql-5.1.42-myslq-test.patch
# PATCH-FIX-UPSTREAM mysql-5.1.33-scripts-paths.patch [ upstream#45616 ] mhrusecky@suse.cz -- fixes build of scripts when compilation occurs somewhere else
# http://bugs.mysql.com/bug.php?id=45616
Patch29: mysql-5.1.33-scripts-paths.patch
# PATCH-FIX-SUSE mysql-5.1.33-safe-process-in-bin.patch [] mhrusecky@suse.cz -- this will let us move one binary to /usr/bin instead of /usr/share/mysql-test/...
Patch30: mysql-5.1.45-safe-process-in-bin.patch
# PATCH-FIX-SUSE mysql-5.1.33-ssl-lib64-macro.patch [] mhrusecky@suse.cz -- search for ssl libraries also in lib64
Patch31: mysql-5.1.33-ssl-lib64-macro.patch
# PATCH-FIX-SUSE mysql-5.1.35-test-utf8.patch [] mhrusecky@suse.cz -- we use utf-8 by default which produces different output with few tests
Patch35: mysql-5.1.35-test-utf8.patch
# PATCH-FIX-UPSTREAM mysql-5.1.36-bmove512.patch [ upstream#19975 ] mhrusecky@suse.cz -- using standard memcpy instead of bmove512 as it should be beeter
# http://bugs.mysql.com/bug.php?id=19975
Patch37: mysql-5.1.36-bmove512.patch
# PATCH-FIX-UPSTREAM mysql-5.1.36-hotcopy.patch [ upstream#43594, bnc#525325 ] mhrusecky@suse.cz -- hotcopy ignores log tables
# http://bugs.mysql.com/bug.php?id=43594
Patch38: mysql-5.1.36-hotcopy.patch
# PATCH-FIX-UPSTREAM mysql_config.patch [ upstream#39175, bnc#420313 ] mhrusecky@suse.cz -- Fix linking options.
Patch39: mysql_config.patch
Patch45: abi_test.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
PreReq: pwdutils
%else
PreReq: /usr/sbin/useradd /usr/sbin/usermod /usr/sbin/groupadd
%endif
PreReq: coreutils sed grep
%if 0%{?suse_version}
PreReq: %install_info_prereq %insserv_prereq
%endif
BuildRequires: gcc-c++ ncurses-devel openssl-devel procps readline-devel zlib-devel
%if 0%{?suse_version}
BuildRequires: pwdutils tcpd-devel
%endif
%if 0%{?suse_version} > 1030 || 0%{?fedora_version} > 8
BuildRequires: fdupes
%endif
%if 0%{?fedora_version} > 11
BuildRequires: sqlite
%endif
%if 0%{?suse_version} > 1030
Recommends: logrotate
%else
Requires: logrotate
%endif
# required by rcmysql
Requires: %{name}-client perl-base
Provides: mysql-Max = %{srv_vers}
Provides: mysql = %{srv_vers}
Conflicts: otherproviders(mysql)
%description
MariaDB is a backward compatible, drop-in replacement branch of the MySQL
Database Server. It includes all major open source storage engines, including
the Maria storage engine.
This package only contains the server-side programs.
%if ! 0%{?prefered} > 0
#-------------------------------------------------------------------------------
%package -n libmariadbclient16
#-------------------------------------------------------------------------------
Summary: MariaDB Shared Libraries
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Group: Development/Libraries/Other
%description -n libmariadbclient16
This package contains the shared libraries (.so) which certain
languages and applications need to dynamically load and use MariaDB.
Authors:
--------
Michael Widenius <monty@mysql.com>
David Axmark <davida@mysql.com>
#-------------------------------------------------------------------------------
%package -n libmariadbclient_r16
#-------------------------------------------------------------------------------
Summary: MariaDB Shared Libraries
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Group: Development/Libraries/Other
%description -n libmariadbclient_r16
This package contains the shared libraries (.so) which certain
languages and applications need to dynamically load and use MariaDB.
Authors:
--------
Michael Widenius <monty@mysql.com>
David Axmark <davida@mysql.com>
%endif
%if 0%{?prefered} > 0
#-------------------------------------------------------------------------------
%package -n libmysqlclient-devel
#-------------------------------------------------------------------------------
# mysql-devel was last used in openSUSE 10.2
Provides: mysql-devel = %srv_vers-%release
Requires: libmysqlclient16 = %srv_vers libmysqlclient_r16 = %srv_vers glibc-devel zlib-devel openssl-devel
Summary: MariaDB Development Header Files and Libraries
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Group: Development/Libraries/C and C++
%description -n libmysqlclient-devel
This package contains the development header files and libraries
necessary to develop MariaDB client applications.
Authors:
--------
Michael Widenius <monty@mysql.com>
David Axmark <davida@mysql.com>
#-------------------------------------------------------------------------------
%package -n libmysqld0
#-------------------------------------------------------------------------------
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Summary: MariaDB embedded server development files
# the headers files are the shared
Requires: libmysqlclient-devel = %srv_vers
Group: Development/Libraries/C and C++
%description -n libmysqld0
This package contains the development header files and libraries
for developing application that embed the MariaDB server
#-------------------------------------------------------------------------------
%package -n libmysqld-devel
#-------------------------------------------------------------------------------
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Summary: MariaDB embedded server development files
# the headers files are the shared
Requires: libmysqlclient-devel = %srv_vers
Requires: libmysqld0 = %srv_vers
Group: Development/Libraries/C and C++
%description -n libmysqld-devel
This package contains the development header files and libraries
for developing application that embed the MariaDB server
#-------------------------------------------------------------------------------
%package -n libmysqlclient16
#-------------------------------------------------------------------------------
Summary: MariaDB Shared Libraries
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Group: Development/Libraries/Other
%description -n libmysqlclient16
This package contains the shared libraries (.so) which certain
languages and applications need to dynamically load and use MariaDB.
Authors:
--------
Michael Widenius <monty@mysql.com>
David Axmark <davida@mysql.com>
#-------------------------------------------------------------------------------
%package -n libmysqlclient_r16
#-------------------------------------------------------------------------------
Summary: MariaDB Shared Libraries
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Group: Development/Libraries/Other
%description -n libmysqlclient_r16
This package contains the shared libraries (.so) which certain
languages and applications need to dynamically load and use MariaDB.
Authors:
--------
Michael Widenius <monty@mysql.com>
David Axmark <davida@mysql.com>
%endif
#-------------------------------------------------------------------------------
%package client
#-------------------------------------------------------------------------------
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Summary: MariaDB Client
Group: Productivity/Databases/Clients
Provides: mysql-client = %{srv_vers}
Conflicts: otherproviders(mysql-client)
%description client
This package contains the standard MariaDB clients.
Authors:
--------
Michael Widenius <monty@mysql.com>
David Axmark <davida@mysql.com>
#-------------------------------------------------------------------------------
%package bench
#-------------------------------------------------------------------------------
Requires: %{name}-client perl-DBD-mysql
License: LGPLv2.1
Summary: MariaDB - Benchmarks
Group: Productivity/Databases/Tools
Provides: mysql-bench = %{srv_vers}
Conflicts: otherproviders(mysql-bench)
%description bench
This package contains MariaDB benchmark scripts and data.
To run these database benchmarks, start the script "run-all-tests" in
the directory /usr/share/sql-bench after starting MariaDB.
Authors:
--------
Michael Widenius <monty@mysql.com>
David Axmark <davida@mysql.com>
#-------------------------------------------------------------------------------
%package debug
#-------------------------------------------------------------------------------
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Summary: MariaDB server with debug options turned on
Group: Productivity/Databases/Servers
Requires: %{name} = %{srv_vers}
Provides: mysql-debug = %{srv_vers}
Conflicts: otherproviders(mysql-debug)
%description debug
A version of the mysql server that has some debug code turned on.
It should be only used to track down problems with the standard
servers. Note that merely installing this package won't replace the
standard server. Read /usr/share/doc/packages/mysql/README.debug for
information on how to use the debug server.
Authors:
--------
Michael Widenius <monty@mysql.com>
David Axmark <davida@mysql.com>
#-------------------------------------------------------------------------------
%package test
#-------------------------------------------------------------------------------
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Summary: MariaDB testsuite
Group: Productivity/Databases/Servers
Requires: %{name} = %{srv_vers}
Requires: %{name}-client = %{srv_vers}
Requires: perl-DBD-mysql
Requires: %{name}-tools = %{srv_vers}
Requires: %{name}-bench = %{srv_vers}
Provides: mysql-test = %{srv_vers}
Conflicts: otherproviders(mysql-test)
%description test
This package contains the MariaDB test scripts and data.
To run the testsuite, run /usr/share/mysql-test/suse-test-run.
Authors:
--------
Michael Widenius <monty@mysql.com>
David Axmark <davida@mysql.com>
#-------------------------------------------------------------------------------
%package tools
#-------------------------------------------------------------------------------
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Summary: MariaDB tools
Group: Productivity/Databases/Servers
Requires: perl-DBD-mysql
# make sure this package is installed when updating from 10.2 and older
Provides: mysql:/usr/bin/mysqlhotcopy mysql-client:/usr/bin/perror
Provides: mysql-tools = %{srv_vers}
Conflicts: otherproviders(mysql-tools)
%description tools
A set of scripts for administering a MariaDB server or developing
applications with MariaDB.
Authors:
--------
Michael Widenius <monty@mysql.com>
David Axmark <davida@mysql.com>
%if 0%{?cluster} > 0
#-------------------------------------------------------------------------------
%package ndb-storage
#-------------------------------------------------------------------------------
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Summary: MariaDB - ndbcluster storage engine
Group: Productivity/Databases/Servers
Provides: mysql-ndb-storage = %{srv_vers}
Conflicts: otherproviders(mysql-ndb-storage)
%description ndb-storage
This package contains the ndbcluster storage engine.
It is necessary to have this package installed on all
computers that should store ndbcluster table data.
#-------------------------------------------------------------------------------
%package ndb-management
#-------------------------------------------------------------------------------
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Summary: MariaDB - ndbcluster storage engine management
Group: Productivity/Databases/Servers
Provides: mysql-ndb-management = %{srv_vers}
Conflicts: otherproviders(mysql-ndb-management)
%description ndb-management
This package contains ndbcluster storage engine management.
It is necessary to have this package installed on at least
one computer in the cluster.
#-------------------------------------------------------------------------------
%package ndb-tools
#-------------------------------------------------------------------------------
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Summary: MariaDB - ndbcluster storage engine basic tools
Group: Productivity/Databases/Servers
Provides: mysql-ndb-tools = %{srv_vers}
Conflicts: otherproviders(mysql-ndb-tools)
%description ndb-tools
This package contains ndbcluster storage engine basic tools.
#-------------------------------------------------------------------------------
%package ndb-extra
#-------------------------------------------------------------------------------
License: GPLv2 ; with additional permissions: EXCEPTIONS-CLIENT
Summary: MariaDB - ndbcluster storage engine extra tools
Group: Productivity/Databases/Servers
Provides: mysql-ndb-extra = %{srv_vers}
Conflicts: otherproviders(mysql-ndb-extra)
%description ndb-extra
This package contains some extra ndbcluster storage engine tools for the
advanced user. They should be used with caution.
%endif
#-------------------------------------------------------------------------------
%prep
#-------------------------------------------------------------------------------
%setup -q -n mariadb-%{version}
cp %_sourcedir/README.SuSE .
cp %_sourcedir/suse-test-run .
%patch2
%patch3
%patch4
%patch5
%patch7
%patch8
%patch13
%patch18
%patch19
%patch23
%patch25 -p1
%patch27
%patch28
%patch29
%patch30
%patch31
%patch35
%patch37
%patch38
%patch39
%patch45 -p1
# remove unneeded manpages ('make install' basically installs everything under
# man/*)
rm -f man/mysqlman.1 # dummy fallback manpage
rm -f man/mysql.server.1 # init script, not installed in our rpm
rm -f man/make_win_*.1 # windows build scripts
rm -f man/comp_err.1 # built-time utility
# 5.1 Carrier Grade Edition only / still under development as of 5.1.22
rm -f man/ndbd_redo_log_reader.1
# breaks VPATH builds when in sourcedir, is generated in the builddirs
rm -f sql/sql_builtin.cc
sed -i 's|@localstatedir@|/var/log|' support-files/mysql-log-rotate.sh
%if ! 0%{?prefered} > 0
for i in `grep -Rl mysqlclient .`; do
sed -i 's|mysqlclient|mariadbclient|g' $i
done
%endif
#-------------------------------------------------------------------------------
%build
#-------------------------------------------------------------------------------
%if 0%{?suse_version} < 1120 && 0%{?suse_version} > 0
%define socketpath /var/lib/mysql
%else
%define socketpath /var/run/mysql
%endif
autoreconf -f -i
export CFLAGS="$RPM_OPT_FLAGS -DPIC -fPIC -DUNDEF_HAVE_INITGROUPS -DFORCE_INIT_OF_VARS -fno-strict-aliasing"
export CXXFLAGS="$CFLAGS -fno-exceptions -fno-rtti"
# Make the compile a function, since we do multiple builds
BuildMySQL() {
# The --enable-assembler simply does nothing on systems that do not
# support assembler speedups.
suffix="$1"; shift
mkdir _build$suffix
pushd _build$suffix
../configure \
--enable-assembler \
--without-readline \
--infodir=%{_infodir} \
--libdir=%{_libdir} \
--libexecdir=/usr/sbin \
--localstatedir=/var/lib/mysql \
--mandir=%{_mandir} \
--prefix=%{_prefix} \
--sysconfdir=/etc \
--with-mysqld-user=mysql \
--with-mysqld-group=mysql \
--without-debug \
--datadir=/usr/share \
--includedir=/usr/include \
--with-charset=utf8 \
--with-collation=utf8_unicode_ci \
--with-extra-charsets=all \
--with-unix-socket-path=%{socketpath}/mysql.sock \
--enable-thread-safe-client \
--with-comment="SUSE MariaDB RPM" \
--with-libwrap \
--with-server-suffix=$suffix \
%ifarch s390 s390x
--with-atomic-ops=rwlocks \
%else
--with-atomic-ops=smp \
%endif
--with-ssl=/usr \
--with-plugins=partition,csv,heap,myisam,ndbcluster,innobase \
HOSTNAME="/bin/hostname -f" \
"$@"
# Add this for MyISAM RAID support:
# --with-raid
# benchdir does not fit in above model. Fix when we make a separate package
make %{?jobs:-j%jobs}
nm --numeric-sort sql/mysqld > sql/mysqld.sym
# needed for make check, which is not VPATH aware
# copy the files unconditionally so that manual 'make check' after
# the build works, too
cp -a ../mysql-test/* mysql-test/
cp -a ../sql/share/{english,charsets} sql/share/
cp -a ../scripts/*.sql scripts/
%if %{?_with_testsuite:1}0
pushd mysql-test; perl ./mysql-test-run.pl --force; popd
%endif
popd
}
# Build the client, extra tools, libraries
BuildMySQL "" --with-embedded-server
# build mysqld-debug
BuildMySQL "-debug" --with-debug --without-embedded-server
%if 0%{?prefered} > 0
mkdir -p _buildlibmysqld/tmp
cd _buildlibmysqld/tmp
ar -x ../../_build/libmysqld/libmysqld.a
gcc $CFLAGS $LDFLAGS -shared -Wl,-soname,libmysqld.so.0 -o ../libmysqld.so.0.0.1 \
*.o \
-lpthread -lcrypt -lnsl -lssl -lcrypto -lz -lrt -lstdc++ -lm -lc
cd ..
rm -rf tmp
cd ..
%endif
#-------------------------------------------------------------------------------
%install
#-------------------------------------------------------------------------------
# install the debug server first, so that we don't overwrite the standard
# /usr/sbin/mysqld
mkdir -p %buildroot%_libdir/mysql
make -C _build-debug/sql install DESTDIR=%buildroot
mv %buildroot/usr/sbin/mysqld %buildroot/usr/sbin/mysqld-debug
install -m 644 _build-debug/sql/mysqld.sym %buildroot%_libdir/mysql/mysqld-debug.sym
# install the client, extra tools, libraries and the standard server
make -C _build install DESTDIR=%buildroot benchdir_root=/usr/share/
install -m 644 _build/sql/mysqld.sym %buildroot%_libdir/mysql/mysqld.sym
# remove most static libs (FIXME: don't build them at all...)
rm -f %buildroot%_libdir/libmysqlclient*a
rm -f %buildroot%_libdir/mysql/*.a %buildroot%_libdir/mysql/*.la
rm -f %buildroot%_libdir/mysql/plugin/*a
# XXX: package these? The ndb tools are linked statically atm
rm -f %buildroot%_libdir/mysql/libndbclient.*
rm -f %{buildroot}/usr/share/mysql-test/mysql-test-run
rm -f %{buildroot}/usr/share/mysql-test/mtr
ln -sf mysql-test-run.pl %{buildroot}/usr/share/mysql-test/mtr
ln -sf mysql-test-run.pl %{buildroot}/usr/share/mysql-test/mysql-test-run
mv %{buildroot}/usr/share/mysql-test/lib/My/SafeProcess/my_safe_process %{buildroot}%{_bindir}
# generate filelist for binaries and their manpages (easier than enumerating
# all the binaries and manapages manually, esp. when there are new manpages in
# each release)
filelist()
{
echo '%%defattr(-, root, root)'
pushd %buildroot >/dev/null
for i; do
if test -e usr/sbin/"$i"; then
echo /usr/sbin/"$i"
fi
if test -e usr/bin/"$i"; then
echo /usr/bin/"$i"
fi
if ls usr/share/man/*/"$i".[1-9]* >/dev/null 2>&1; then
echo "%%doc %_mandir/*/$i.[1-9]*"
fi
done
popd >/dev/null
}
filelist innochecksum my_print_defaults myisam_ftdump myisamchk myisamlog myisampack mysql_fix_extensions mysql_fix_privilege_tables mysql_install_db mysql_secure_installation mysql_upgrade mysqlbug mysqld mysqld_multi mysqld_safe mysqlbinlog mysqldumpslow mysqlmanager resolve_stack_dump resolveip >mysql.files
filelist mysql mysqladmin mysqlcheck mysqldump mysqlimport mysqlshow >mysql-client.files
filelist mysql_config >libmysqlclient-devel.files
filelist mysqlslap >mysql-bench.files
filelist mysql_client_test mysql_client_test_embedded mysql_waitpid mysqltest mysqltest_embedded >mysql-test.files
# all binaries that don't need to be in a "default" install (mysql.rpm +
# mysql-client.rpm)
filelist msql2mysql mysql_convert_table_format mysql_find_rows mysql_setpermission mysql_tzinfo_to_sql mysql_zap mysqlaccess mysqlhotcopy perror replace >mysql-tools.files
filelist ndbd ndbmtd ndbd_redo_log_reader >mysql-ndb-storage.files
filelist ndb_mgmd >mysql-ndb-management.files
filelist ndb_{config,desc,error_reporter,mgm,print_backup_file,print_schema_file,print_sys_file,restore,select_all,select_count,show_tables,size.pl,test_platform,waiter} >mysql-ndb-tools.files
filelist ndb_{cpcd,delete_all,drop_index,drop_table} >mysql-ndb-extra.files
### files not installed by make install
# Create directory structure
DOCS=(COPYING README EXCEPTIONS-CLIENT %_sourcedir/README.debug %_sourcedir/README.SuSE)
DOCDIR=%buildroot%_defaultdocdir/%name
install -d -m 755 ${DOCDIR}
install -d -m 755 %buildroot/etc/logrotate.d
install -d -m 755 %buildroot/etc/init.d
install -m 644 _build/support-files/mysql-log-rotate %buildroot/etc/logrotate.d/mysql
%if 0%{?prefered} > 0
install -m 644 _buildlibmysqld/*.so* %buildroot%_libdir
ln -s libmysqld.so.0.0.1 %buildroot%_libdir/libmysqld.so.0
ln -s libmysqld.so.0.0.1 %buildroot%_libdir/libmysqld.so
%endif
install -m 660 _build/support-files/my-medium.cnf %buildroot/etc/my.cnf
install -m 640 scripts/mysqlaccess.conf %buildroot/etc/mysqlaccess.conf
install -m 644 "${DOCS[@]}" ${DOCDIR}
install -m 755 %_sourcedir/rc.mysql-multi %buildroot/etc/init.d/mysql
ln -sf ../../etc/init.d/mysql %buildroot/usr/sbin/rcmysql
# this is used by the init script
install -m 755 -d %buildroot/var/run/mysql
# SuSEfirewall service description
install -D -m 644 %_sourcedir/mysql.SuSEfirewall2 \
%buildroot/etc/sysconfig/SuSEfirewall2.d/services/mysql
# testsuite
mkdir -p '%buildroot'/usr/share/mysql-test/
install -m 755 suse-test-run '%buildroot'/usr/share/mysql-test/
# XXX this should go under /var/..., but some tests get confused by a symlink
# var -> ../../../var/...
#ln -sf ../../../var/lib/mysql/mysql-test %buildroot/usr/share/mysql-test/var
mkdir '%buildroot'/usr/share/mysql-test/var
# Final fixes
find '%buildroot'/usr/share/mysql-test -name '*.orig' -delete
%if 0%{?suse_version} > 1030
%fdupes -s '%buildroot'/usr/share/mysql-test
%endif
%if 0%{?fedora_version} > 8
fdupes -q -n -r '%buildroot'/usr/share/mysql-test
%endif
dos2unixConversion() {
%{__sed} -i 's/\r//g' "$1"
}
for i in `grep -Rl '\r' '%buildroot'/usr/share/sql-bench`; do
dos2unixConversion "$i"
done
%if ! 0%{cluster} > 0
cat mysql-ndb-storage.files mysql-ndb-management.files \
mysql-ndb-tools.files mysql-ndb-extra.files | \
sed 's|^%%doc\ ||' | while read tmp; do
cd '%buildroot'
rm -f .$tmp
done
%endif
%if ! 0%{prefered} > 0
cat libmysqlclient-devel.files | while read tmp; do
cd '%buildroot'
rm -f .$tmp
done
rm -rf '%buildroot'/%_libdir/libmysqld.*
rm -rf '%buildroot'/%_libdir/libmysqlclient*
rm -rf '%buildroot'/%_libdir/libmariadbclient.{a,la,so}
rm -rf '%buildroot'/%_libdir/libmariadbclient_r*.{a,la,so}
rm -rf '%buildroot'/%_includedir
rm -rf '%buildroot'/%_datadir/man/*/mysql_config*
rm -rf '%buildroot'/%_datadir/aclocal
%endif
sed -i 's|doc/packages/mysql|doc/packages/%{name}|g' '%buildroot'/etc/init.d/mysql
ln -s mysqlcheck '%buildroot'%_bindir/mysqlrepair
ln -s mysqlcheck '%buildroot'%_bindir/mysqlanalyze
ln -s mysqlcheck '%buildroot'%_bindir/mysqloptimize
#-------------------------------------------------------------------------------
%pre
#-------------------------------------------------------------------------------
/usr/sbin/groupadd -r mysql >/dev/null 2>/dev/null || :
/usr/sbin/useradd -r -o -g mysql -u 60 -c "MySQL database admin" \
-s /bin/false -d /var/lib/mysql mysql 2> /dev/null || :
/usr/sbin/usermod -g mysql -s /bin/false mysql || :
#-------------------------------------------------------------------------------
%preun
#-------------------------------------------------------------------------------
[ $1 = 1 ] || /usr/sbin/rcmysql stop
%pretrans
if [ -x /usr/sbin/rcmysql ]; then
RESTART=""
/usr/sbin/rcmysql status > /dev/null && RESTART="yes"
/usr/sbin/rcmysql stop
[ "$RESTART" ] && mkdir -p /var/run/mysql/restart
fi
dbfile=var/mysql/mysql/db.ISM
olddir=var/mysql
newdir=var/lib/mysql
# Do the database files still belong to root (very old installation)?
# Change ownerships
if [ -O $dbfile ]
then
chown -Rv mysql:mysql var/mysql/
fi
#-------------------------------------------------------------------------------
%posttrans
#-------------------------------------------------------------------------------
%install_info --info-dir=%{_infodir} %{_infodir}/mysql.info.gz
if [ -d /var/lib/mysql ]; then
touch /var/lib/mysql/.run-mysql_upgrade
chown -R mysql:mysql /var/lib/mysql
fi
for i in /var/lib/mysql/{.protected,.tmp}; do
( [ -d "$i" ] && rmdir "$i" ) || :
done
# start mysql again if it should run
if [ "`ls /etc/rc.d/rc*.d/S*mysql 2> /dev/null`" ] || [ -d /var/run/mysql/restart ]; then
[ -x /usr/sbin/rcmysql ] && /usr/sbin/rcmysql start
rmdir /var/run/mysql/restart || :
fi
%if ! 0%{prefered} > 0
#-------------------------------------------------------------------------------
%post -n libmariadbclient16
#-------------------------------------------------------------------------------
/sbin/ldconfig
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%postun -n libmariadbclient16
#-------------------------------------------------------------------------------
/sbin/ldconfig
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%post -n libmariadbclient_r16
#-------------------------------------------------------------------------------
/sbin/ldconfig
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%postun -n libmariadbclient_r16
#-------------------------------------------------------------------------------
/sbin/ldconfig
#-------------------------------------------------------------------------------
%endif
%if 0%{prefered} > 0
#-------------------------------------------------------------------------------
%post -n libmysqlclient16
#-------------------------------------------------------------------------------
/sbin/ldconfig
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%postun -n libmysqlclient16
#-------------------------------------------------------------------------------
/sbin/ldconfig
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%post -n libmysqlclient_r16
#-------------------------------------------------------------------------------
/sbin/ldconfig
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%postun -n libmysqlclient_r16
#-------------------------------------------------------------------------------
/sbin/ldconfig
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%post -n libmysqld0
#-------------------------------------------------------------------------------
/sbin/ldconfig
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%postun -n libmysqld0
#-------------------------------------------------------------------------------
/sbin/ldconfig
#-------------------------------------------------------------------------------
%endif
#-------------------------------------------------------------------------------
%postun
#-------------------------------------------------------------------------------
if [ $1 = 0 ]; then
%install_info_delete --info-dir=%{_infodir} %{_infodir}/mysql.info.gz
%{insserv_cleanup}
fi
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%clean
#-------------------------------------------------------------------------------
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && %{__rm} -rf $RPM_BUILD_ROOT
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%files -f mysql.files
#-------------------------------------------------------------------------------
%defattr(-, root, root)
%config(noreplace) %attr(0640, root, mysql) /etc/my.cnf
%config /etc/logrotate.d/mysql
%doc %{_defaultdocdir}/%{name}
%doc %{_infodir}/mysql.info.gz
/etc/init.d/mysql
/usr/sbin/rcmysql
/usr/share/mysql/
%dir %attr(755,mysql,mysql)/var/run/mysql
%dir %{_libdir}/mysql
%{_libdir}/mysql/mysqld.sym
%config /etc/sysconfig/SuSEfirewall2.d/services/mysql
%dir %_libdir/mysql/plugin
%_libdir/mysql/plugin/*.so
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%files client -f mysql-client.files
#-------------------------------------------------------------------------------
%defattr(-, root, root)
%config /etc/mysqlaccess.conf
#-------------------------------------------------------------------------------
%if ! 0%{prefered} > 0
#-------------------------------------------------------------------------------
%files -n libmariadbclient16
#-------------------------------------------------------------------------------
%defattr(-, root, root)
%{_libdir}/libmariadbclient.so.*
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%files -n libmariadbclient_r16
#-------------------------------------------------------------------------------
%defattr(-, root, root)
%{_libdir}/libmariadbclient_r.so.*
#-------------------------------------------------------------------------------
%endif
%if 0%{prefered} > 0
#-------------------------------------------------------------------------------
%files -n libmysqlclient-devel -f libmysqlclient-devel.files
#-------------------------------------------------------------------------------
%defattr(-, root, root)
/usr/include/mysql
%{_libdir}/libmysqlclient.so
%{_libdir}/libmysqlclient_r.so
/usr/share/aclocal/mysql.m4
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%files -n libmysqld-devel
#-------------------------------------------------------------------------------
%defattr(-,root,root)
%_libdir/libmysqld.a
%_libdir/libmysqld.so
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%files -n libmysqld0
#-------------------------------------------------------------------------------
%defattr(-,root,root)
%_libdir/libmysqld.so.*
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%files -n libmysqlclient16
#-------------------------------------------------------------------------------
%defattr(-, root, root)
%{_libdir}/libmysqlclient.so.*
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%files -n libmysqlclient_r16
#-------------------------------------------------------------------------------
%defattr(-, root, root)
%{_libdir}/libmysqlclient_r.so.*
#-------------------------------------------------------------------------------
%endif
#-------------------------------------------------------------------------------
%files bench -f mysql-bench.files
#-------------------------------------------------------------------------------
%defattr(-, root, root)
/usr/share/sql-bench
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%files debug
#-------------------------------------------------------------------------------
%defattr(-, root, root)
/usr/sbin/mysqld-debug
%{_libdir}/mysql/mysqld-debug.sym
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%files test -f mysql-test.files
#-------------------------------------------------------------------------------
%defattr(-, root, root)
%{_bindir}/my_safe_process
%_mandir/man1/mysql-test-run.pl.1*
%_mandir/man1/mysql-stress-test.pl.1*
/usr/share/mysql-test/valgrind.supp
%dir %attr(755, root, root)/usr/share/mysql-test
/usr/share/mysql-test/[^v]*
%dir %attr(755, mysql, mysql) /usr/share/mysql-test/var
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%files tools -f mysql-tools.files
%defattr(-, root, root)
%_bindir/mysqlrepair
%_bindir/mysqlanalyze
%_bindir/mysqloptimize
#-------------------------------------------------------------------------------
%if 0%{cluster} > 0
#-------------------------------------------------------------------------------
%files ndb-storage -f mysql-ndb-storage.files
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%files ndb-management -f mysql-ndb-management.files
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%files ndb-tools -f mysql-ndb-tools.files
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
%files ndb-extra -f mysql-ndb-extra.files
#-------------------------------------------------------------------------------
%endif
%changelog