mariadb/mariadb.spec

546 lines
17 KiB
RPMSpec
Raw Normal View History

#
# spec file for package mariadb
#
# Copyright (c) 2014 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/
#
%define preferred 01
%define have_info 0
%define builtin_plugins partition,csv,heap,aria,pbxt,myisam,myisammrg,xtradb
%define use_extra_provides 1
%define extra_provides mariadb_100
%define srv_vers 5.6.26
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif
%if 0 > 0
%define_with_jemalloc 1
%define_with_oqgraph 1
%define_with_cassandra 1
%else
%define_with_jemalloc 0
%define_with_oqgraph 0
%define_with_cassandra 0
%endif
Name: mariadb
Version: 10.0.17
Release: 0
Summary: Server part of MariaDB
License: SUSE-GPL-2.0-with-FLOSS-exception
Group: Productivity/Databases/Servers
Url: https://www.mariadb.org
Source: https://downloads.mariadb.org/f/mariadb-%{version}/source/mariadb-%{version}.tar.gz
Source2: baselibs.conf
Source3: README.debug
Source4: suse-test-run
Source5: mysql.SuSEfirewall2
Source7: README.install
Source8: README.SUSE
Source9: mysql-patches.tar.bz2
Source10: build.inc
Source11: install.inc
Source12: series
Source13: configuration-tweaks.tar.bz2
Source14: my.ini
Source15: rc.mysql.sysvinit
Source16: rc.mysql.systemd
Source17: mysql.service
BuildRequires: bison
%if 0%{with_oqgraph} > 0 || 0%{with_cassandra} > 0
BuildRequires: boost-devel
%endif
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: gcc-c++
%if 0%{with_jemalloc} > 0
BuildRequires: jemalloc-devel
%endif
%if 0%{with_oqgraph} > 0
BuildRequires: judy-devel
%endif
BuildRequires: libaio-devel
BuildRequires: libbz2-devel
BuildRequires: libedit-devel
BuildRequires: libevent-devel
%if 0%{with_cassandra} > 0
BuildRequires: libthrift-devel
%endif
BuildRequires: libtool
BuildRequires: libxml2-devel
BuildRequires: lzo-devel
BuildRequires: ncurses-devel
BuildRequires: openssl-devel
BuildRequires: pam-devel
BuildRequires: pcre-devel
BuildRequires: procps
BuildRequires: pwdutils
BuildRequires: readline-devel
BuildRequires: sqlite
BuildRequires: tcpd-devel
BuildRequires: zlib-devel
BuildRequires: pkgconfig(systemd)
# required by rcmysql
Requires: %{name}-client
Requires: %{name}-errormessages = %{version}
Requires: perl-base
Requires(pre): pwdutils
Recommends: logrotate
Provides: mysql-Max = %{srv_vers}
# Compatibility with Fedora/CentOS
Provides: mysql-server = %{srv_vers}
Provides: mariadb-server = %{srv_vers}
# Compatibility with old version
Provides: %{name}-debug-version = %{srv_vers}
Obsoletes: %{name}-debug-version < %{srv_vers}
Provides: %{name}-debug = %{srv_vers}
Obsoletes: %{name}-debug < %{srv_vers}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Conflicts: otherproviders(mysql)
Conflicts: otherproviders(mysql-server)
Conflicts: otherproviders(mariadb-server)
Conflicts: otherproviders(mysql-debug)
%{?systemd_requires}
%if 0%{have_info} > 0
Requires(post): %{install_info_prereq} %insserv_prereq
%endif
%if "%{name}" != mysql
Provides: mysql = %{srv_vers}
Provides: mysql-debug = %{srv_vers}
%endif
%if 0%{?use_extra_provides} > 0
Provides: %{extra_provides} = %{version}
Obsoletes: %{extra_provides} < %{version}
Provides: %{extra_provides}-debug-version = %{version}
Obsoletes: %{extra_provides}-debug-version < %{version}
%endif
%if 0%{?preferred} > 0
Obsoletes: mysql-Max < %{srv_vers}
%if "%{name}" != mysql
Obsoletes: mysql < %{srv_vers}
Obsoletes: mysql-debug < %{srv_vers}
%endif
%endif
%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%{?preferred} > 0
%package -n libmysqlclient-devel
Summary: MariaDB development header files and libraries
Group: Development/Libraries/C and C++
Requires: glibc-devel
Requires: libmysqlclient_r18 = %{version}
Requires: libmysqlclient18 = %{version}
Requires: openssl-devel
Requires: zlib-devel
# mysql-devel was last used in openSUSE 10.2
Provides: mysql-devel = %{srv_vers}-%{release}
Obsoletes: mysql-devel < %{srv_vers}
%description -n libmysqlclient-devel
This package contains the development header files and libraries
necessary to develop client applications for MariaDB.
%package -n libmysqld18
Summary: MariaDB embedded server development files
Group: Development/Libraries/C and C++
Requires: %{name}-errormessages = %{version}
%description -n libmysqld18
This package contains the development header files and libraries
for developing applications that embed the MariaDB.
%package -n libmysqld-devel
Summary: MariaDB embedded server development files
Group: Development/Libraries/C and C++
# the headers files are the shared
Requires: libmysqlclient-devel = %{version}
Requires: libmysqld18 = %{version}
Requires: tcpd-devel
%description -n libmysqld-devel
This package contains the development header files and libraries
for developing applications that embed the MariaDB.
%endif
%package -n libmysqlclient18
Summary: Shared Libraries for MariaDB
Group: Development/Libraries/Other
%description -n libmysqlclient18
This package contains the shared libraries (.so) which certain
languages and applications need to dynamically load and use MariaDB.
%package -n libmysqlclient_r18
Summary: Shared Libraries for MariaDB
Group: Development/Libraries/Other
Requires: libmysqlclient18
%description -n libmysqlclient_r18
This package contains the shared libraries (.so) which certain
languages and applications need to dynamically load and use MariaDB.
%package client
Summary: Client for MariaDB
Group: Productivity/Databases/Clients
Requires: %{name}-errormessages = %{version}
Conflicts: otherproviders(mysql-client)
%if "%{name}" != mysql
Provides: mysql-client = %{srv_vers}
%endif
Requires(pre): pwdutils
%if 0%{?use_extra_provides} > 0
Provides: %{extra_provides}-client = %{version}
Obsoletes: %{extra_provides}-client < %{version}
%endif
%if 0%{?preferred} > 0
%if "%{name}" != mysql
Obsoletes: mysql-client < %{srv_vers}
%endif
%endif
%description client
This package contains the standard clients for MariaDB.
%package errormessages
Summary: MySQL Community Server development header files and libraries
Group: Development/Libraries/C and C++
%description errormessages
This package provides the translated error messages for the standalone
server daemon as well as the embedded server
%package bench
Summary: Benchmarks for MariaDB
Group: Productivity/Databases/Tools
Requires: %{name}-client
Requires: perl-DBD-mysql
Conflicts: otherproviders(mysql-bench)
%if "%{name}" != mysql
Provides: mysql-bench = %{srv_vers}
%endif
%if 0%{?use_extra_provides} > 0
Provides: %{extra_provides}-bench = %{version}
Obsoletes: %{extra_provides}-bench < %{version}
%endif
%if 0%{?preferred} > 0
%if "%{name}" != mysql
Obsoletes: mysql-bench < %{srv_vers}
%endif
%endif
%description bench
This package contains benchmark scripts and data for MariaDB.
To run these database benchmarks, start the script "run-all-tests" in
the directory %{_datadir}/sql-bench after starting MariaDB.
%package test
Summary: Testsuite for MariaDB
Group: Productivity/Databases/Servers
Requires: %{name} = %{version}
Requires: %{name}-bench = %{version}
Requires: %{name}-client = %{version}
Requires: %{name}-tools = %{version}
Requires: perl-DBD-mysql
Conflicts: otherproviders(mysql-test)
%if "%{name}" != mysql
Provides: mysql-test = %{srv_vers}
%endif
%if 0%{?use_extra_provides} > 0
Provides: %{extra_provides}-test = %{version}
Obsoletes: %{extra_provides}-test < %{version}
%endif
%if 0%{?preferred} > 0
%if "%{name}" != mysql
Obsoletes: mysql-test < %{srv_vers}
%endif
%endif
%description test
This package contains the test scripts and data for MariaDB.
To run the testsuite, run %{_datadir}/mysql-test/suse-test-run.
%package tools
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-client:%{_bindir}/perror
Provides: mysql:%{_bindir}/mysqlhotcopy
Conflicts: otherproviders(mysql-tools)
%if "%{name}" != mysql
Provides: mysql-tools = %{srv_vers}
%endif
%if 0%{?use_extra_provides} > 0
Provides: %{extra_provides}-tools = %{version}
Obsoletes: %{extra_provides}-tools < %{version}
%endif
%if 0%{?preferred} > 0
%if "%{name}" != mysql
Obsoletes: mysql-tools < %{srv_vers}
%endif
%endif
%description tools
A set of scripts for administering a MariaDB or developing
applications with MariaDB.
%prep
%setup -q -n mariadb-%{version} -D -a 9
cp %{_sourcedir}/README.SUSE .
cp %{_sourcedir}/suse-test-run .
# apply patches from series
mysql-patches/tools/quilt-setup.sh "%{SOURCE12}"
mysql-patches/tools/apply-series.sh "%{SOURCE12}"
# remove unneeded manpages ('make install' basically installs everything under
# man/*)
rm -f man/mysqlman.1 # dummy fallback manpage
[ \! -f man/CMakeLists.txt ] || sed -i 's|mysqlman.1||' man/CMakeLists.txt
rm -f man/mysql.server.1 # init script, not installed in our rpm
[ \! -f man/CMakeLists.txt ] || sed -i 's|mysql.server.1||' man/CMakeLists.txt
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@|%{_localstatedir}/log|' support-files/mysql-log-rotate.sh
%if 0%{preferred} < 1
for i in `grep -Rl mysqlclient .`; do
sed -i 's|mysqlclient|mysqlclient|g' $i
sed -i 's|-libmysqlclient-symbols.patch|-libmysqlclient-symbols.patch|g' $i
done
%endif
# Broken test that needs sources
rm -f mysql-test/t/file_contents.test mysql-test/r/file_contents.result
# Specify perl path on shebangs
for i in `grep -Rl '^#!@PERL@$' .`; do
sed -i 's|@PERL@|%{_bindir}/perl|' $i
done
%build
%{expand:%(cat %{_sourcedir}/build.inc)}
%install
%{expand:%(cat %{_sourcedir}/install.inc)}
%pre
%{_sbindir}/groupadd -r mysql >/dev/null 2>/dev/null || :
%{_sbindir}/useradd -r -o -g mysql -u 60 -c "MySQL database admin" \
-s /bin/false -d %{_localstatedir}/lib/mysql mysql 2> /dev/null || :
%{_sbindir}/usermod -g mysql -s /bin/false mysql 2> /dev/null || :
%service_add_pre mysql.service
%pre client
%{_sbindir}/groupadd -r mysql >/dev/null 2>/dev/null || :
%{_sbindir}/useradd -r -o -g mysql -u 60 -c "MySQL database admin" \
-s /bin/false -d %{_localstatedir}/lib/mysql mysql 2> /dev/null || :
%{_sbindir}/usermod -g mysql -s /bin/false mysql 2> /dev/null || :
%post
%service_add_post mysql.service
#######################################################################
# preun and posttran takes care of restart #
#######################################################################
%preun
[ $1 = 1 ] || %{_sbindir}/rcmysql stop || true
%posttrans
%if 0%{have_info} > 0
[ -z "`ls %{_infodir}/mysql.info.* 2> /dev/null`" ] || \
%install_info --info-dir=%{_infodir} %{_infodir}/mysql.info.*
%endif
rm -f %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}
for in in protected tmp; do
rmdir %{_localstatedir}/lib/mysql/.$i 2>/dev/null || :
done
# During package rename, there might be config file move
if [ -f /etc/my.cnf.rpmsave ]; then
mv /etc/my.cnf{,.rpmnew}
mv /etc/my.cnf{.rpmsave,}
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
WARNING: /etc/my.cnf.rpmsave file detected!
This probably means that you are upgrading from different variant of MySQL.
Your original configuration file was restored. If it is not a case, you can
find your original /etc/my.cnf as /etc/my.cnf.rpmnew
EOF
fi
# warn on first run
if [ -x %{_bindir}/my_print_defaults ]; then
datadir="`%{_bindir}/my_print_defaults mysqld mysql_server | sed -n 's|--datadir=||p'`"
fi
[ -n "$datadir" ] || datadir="%{_localstatedir}/lib/mysql"
if [ -d "$datadir/mysql" ]; then
touch "$datadir/.run-mysql_upgrade"
fi
for in in protected tmp; do
rmdir "$datadir"/.$i 2>/dev/null || :
done
if [ \! -f "$datadir/mysql_upgrade_info" ]; then
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
%(cat %{_sourcedir}/README.install)
EOF
else
MYSQLVER="`echo %{version} | sed 's|\.[0-9]\+$||'`"
if [ -f "$datadir/mysql_upgrade_info" ] && \
[ -z "`grep "^$MYSQLVER" "$datadir/mysql_upgrade_info" 2> /dev/null`" ]; then
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
WARNING: You are upgrading from different stable version of MySQL!
Your database will be migrated automatically during next restart of MySQL.
Before you do that make sure you have up to date backup of your data. It
should be mainly in $datadir directory.
EOF
fi
fi
# start mysql again if it should run - migration from old setup
if [ -d %{_rundir}/mysql/restart ]; then
[ -x %{_sbindir}/rcmysql ] && %{_sbindir}/rcmysql start
# Might not be there, so ignoring errors
rmdir %{_rundir}/mysql/restart 2> /dev/null
fi
#######################################################################
# Various ldconfig post scripts #
#######################################################################
%post -n libmysqlclient18 -p /sbin/ldconfig
%postun -n libmysqlclient18 -p /sbin/ldconfig
%post -n libmysqlclient_r18 -p /sbin/ldconfig
%postun -n libmysqlclient_r18 -p /sbin/ldconfig
%if 0%{preferred} > 0
%post -n libmysqld18 -p /sbin/ldconfig
%postun -n libmysqld18 -p /sbin/ldconfig
%endif
%postun
if [ $1 = 0 ]; then
%if 0%{have_info} > 0
%install_info_delete --info-dir=%{_infodir} %{_infodir}/mysql.info.*
%endif
%insserv_cleanup
rm -f "%{_localstatedir}/lib/systemd/migrated/mysql.service"
if [ -x %{_bindir}/systemctl ]; then
%{_bindir}/systemctl daemon-reload >/dev/null 2>&1 || :
fi
fi
#######################################################################
# Files section #
#######################################################################
%files -f mysql.files
%defattr(-, root, root)
%config(noreplace) %attr(0640, root, mysql) %{_sysconfdir}/my.cnf
%dir %attr(0750, root, mysql) %{_sysconfdir}/my.cnf.d
%config(noreplace) %attr(0640, root, mysql) %{_sysconfdir}/my.cnf.d/*
%config %{_sysconfdir}/logrotate.d/mysql
%doc %{_defaultdocdir}/%{name}
%if 0%{have_info} > 0
%doc %{_infodir}/mysql.info.*
%endif
%dir %{_libexecdir}/mysql
%{_libexecdir}/mysql/rcmysql
%{_libexecdir}/systemd/system/mysql.service
%{_sbindir}/rcmysql
%dir %{_datadir}/%{name}
%dir %{_datadir}/mysql
%{_datadir}/%{name}/charsets/
%{_datadir}/%{name}/*.sql
%dir %{_libdir}/mysql
%{_libdir}/mysql/mysqld.sym
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/mysql
%dir %{_libdir}/mysql/plugin
%{_libdir}/mysql/plugin/[!d]*.so
%files errormessages -f errormessages.files
%defattr(-, root, root)
%{_datadir}/%{name}/*/errmsg.sys
%files client -f mysql-client.files
%defattr(-, root, root)
%if 0%{preferred} > 0
%files -n libmysqlclient-devel -f libmysqlclient-devel.files
%defattr(-, root, root)
%{_includedir}/mysql
%{_libdir}/libmysqlclient.so
%{_libdir}/libmysqlclient_r.so
%dir %{_datadir}/aclocal
%{_datadir}/aclocal/mysql.m4
%files -n libmysqld-devel
%defattr(-,root,root)
%{_libdir}/libmysqld.a
%{_libdir}/libmysqld.so
%files -n libmysqld18
%defattr(-,root,root)
%{_libdir}/libmysqld.so.*
%endif
%files -n libmysqlclient18
%defattr(-, root, root)
%{_libdir}/libmysqlclient.so.*
%files -n libmysqlclient_r18
%defattr(-, root, root)
%{_libdir}/libmysqlclient_r.so.*
%files bench -f mysql-bench.files
%defattr(-, root, root)
%{_datadir}/sql-bench
%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*
%{_datadir}/mysql-test/valgrind.supp
%dir %attr(755, root, root)%{_datadir}/mysql-test
%{_datadir}/mysql-test/[^v]*
%dir %attr(755, mysql, mysql) %{_datadir}/mysql-test/var
%files tools -f mysql-tools.files
%defattr(-, root, root)
%{_bindir}/mysqlrepair
%{_bindir}/mysqlanalyze
%{_bindir}/mysqloptimize
%changelog