Reformating spec and removing unnecessary snippets

This commit is contained in:
Honza Horak 2014-07-22 00:34:41 +02:00
parent 8d19c178ae
commit 4bc1433e50

View File

@ -1,6 +1,14 @@
# Regression tests may take a long time (many cores recommended), skip them by
# passing --nocheck to rpmbuild or by setting runselftest to 0 if defining
# --nocheck is not possible (e.g. in koji build)
%{!?runselftest:%global runselftest 1}
# In f20+ use unversioned docdirs, otherwise the old versioned one
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
# use Full RELRO for all binaries (RHBZ#1092548)
%global _hardened_build 1
# When there is already another package that ships /etc/my.cnf,
# rather include it than ship the file again, since conflicts between
# those files may create issues
@ -34,16 +42,10 @@
%bcond_with pcre
%endif
# use Full RELRO for all binaries (RHBZ#1092548)
%global _hardened_build 1
# The evr of mysql we want to obsolete
%global obsoleted_mysql_evr 5.6-0
%global obsoleted_mysql_case_evr 5.5.30-5
# Regression tests take a long time, you can skip 'em with this
%{!?runselftest:%global runselftest 1}
# When replacing mysql by mariadb these packages are not upated, but rather
# installed and uninstalled. Thus we loose information about mysqld service
# enablement. To address this we use a file to store that information within
@ -55,7 +57,7 @@
Name: mariadb
Version: 10.0.12
Release: 3%{?dist}
Release: 4%{?dist}
Epoch: 1
Summary: A community developed branch of MySQL
@ -106,22 +108,32 @@ Patch14: mariadb-ssltest.patch
Patch15: mariadb-mysql_config.patch
Patch16: mariadb-scripts.patch
BuildRequires: perl, readline-devel, openssl-devel
BuildRequires: cmake, ncurses-devel, zlib-devel, libaio-devel
BuildRequires: systemd, systemtap-sdt-devel
# make test requires time and ps
BuildRequires: time procps
BuildRequires: cmake
BuildRequires: libaio-devel
BuildRequires: readline-devel
BuildRequires: openssl-devel
BuildRequires: ncurses-devel
BuildRequires: perl
BuildRequires: systemtap-sdt-devel
BuildRequires: zlib-devel
# auth_pam.so plugin will be build if pam-devel is installed
BuildRequires: pam-devel
%{?with_pcre:BuildRequires: pcre-devel >= 8.35}
# perl modules needed to run regression tests
BuildRequires: perl(Socket), perl(Time::HiRes)
BuildRequires: perl(Data::Dumper), perl(Test::More), perl(Env)
# Tests requires time and ps and some perl modules
BuildRequires: procps
BuildRequires: time
BuildRequires: perl(Env)
BuildRequires: perl(Data::Dumper)
BuildRequires: perl(Socket)
BuildRequires: perl(Test::More)
BuildRequires: perl(Time::HiRes)
BuildRequires: systemd
Requires: grep, fileutils, bash
Requires: bash
Requires: fileutils
Requires: grep
Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release}
%{?systemd_requires: %systemd_requires}
# MySQL (with caps) is upstream's spelling of their own RPMs for mysql
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL < %{obsoleted_mysql_case_evr}}
@ -129,6 +141,8 @@ Conflicts: community-mysql
# MariaDB replaces mysql packages
Provides: mysql = %{epoch}:%{version}-%{release}
Provides: mysql%{?_isa} = %{epoch}:%{version}-%{release}
Provides: mysql-compat-client = %{epoch}:%{version}-%{release}
Provides: mysql-compat-client%{?_isa} = %{epoch}:%{version}-%{release}
%{?obsoleted_mysql_evr:Obsoletes: mysql < %{obsoleted_mysql_evr}}
# Filtering: https://fedoraproject.org/wiki/Packaging:AutoProvidesAndRequiresFiltering
@ -152,6 +166,7 @@ It is a client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. The base package
contains the standard MariaDB/MySQL client programs and generic MySQL files.
%package libs
Summary: The shared libraries required for MariaDB/MySQL clients
@ -168,6 +183,7 @@ MariaDB/MySQL client program or interface. You will need to install this
package to use any other MariaDB package or any clients that need to connect
to a MariaDB/MySQL server. MariaDB is a community developed branch of MySQL.
%package common
Summary: The shared files required by server and client
@ -180,6 +196,7 @@ Requires: %{_sysconfdir}/my.cnf
The package provides the essential shared files for any MariaDB program.
You will need to install this package to use any other MariaDB package.
%package errmsg
Summary: The error messages files required by server and embedded
@ -191,11 +208,14 @@ The package provides error messages files for the MariaDB daemon and the
embedded server. You will need to install this package to use any of those
MariaDB packages.
%package server
Summary: The MariaDB server and related files
Group: Applications/Databases
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
# note: no version here = %{version}-%{release}
Requires: mysql-compat-client%{?_isa}
Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}-errmsg%{?_isa} = %{epoch}:%{version}-%{release}
Requires: sh-utils
@ -204,18 +224,18 @@ Requires(pre): /usr/sbin/useradd
Requires: systemd
# Make sure it's there when scriptlets run, too
Requires(pre): systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Requires(posttrans): systemd
%{?systemd_requires: %systemd_requires}
# mysqlhotcopy needs DBI/DBD support
Requires: perl-DBI, perl-DBD-MySQL
Requires: perl-DBI
Requires: perl-DBD-MySQL
Provides: mysql-server = %{epoch}:%{version}-%{release}
Provides: mysql-server%{?_isa} = %{epoch}:%{version}-%{release}
Provides: mysql-compat-server = %{epoch}:%{version}-%{release}
Provides: mysql-compat-server%{?_isa} = %{epoch}:%{version}-%{release}
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-server < %{obsoleted_mysql_case_evr}}
Conflicts: community-mysql-server
Conflicts: mariadb-galera-server
%{?obsoleted_mysql_evr:Obsoletes: mysql-server < %{obsoleted_mysql_evr}}
%description server
@ -225,6 +245,7 @@ and many different client programs and libraries. This package contains
the MariaDB server and some accompanying files and directories.
MariaDB is a community developed branch of MySQL.
%if %{with oqgraph}
%package oqgraph
@ -232,7 +253,8 @@ Summary: The Open Query GRAPH engine for MariaDB
Group: Applications/Databases
Requires: %{name}-server%{?_isa} = %{epoch}:%{version}-%{release}
# boost and Judy required for oograph
BuildRequires: boost-devel, Judy-devel
BuildRequires: boost-devel
BuildRequires: Judy-devel
%description oqgraph
The package provides Open Query GRAPH engine (OQGRAPH) as plugin for MariaDB
@ -242,6 +264,7 @@ tree structures and friend-of-a-friend style searches can now be done using
standard SQL syntax, and results joined onto other tables.
%endif
%package devel
Summary: Files for development of MariaDB/MySQL applications
@ -251,8 +274,8 @@ Requires: openssl-devel%{?_isa}
Provides: mysql-devel = %{epoch}:%{version}-%{release}
Provides: mysql-devel%{?_isa} = %{epoch}:%{version}-%{release}
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-devel < %{obsoleted_mysql_case_evr}}
Conflicts: community-mysql-devel
%{?obsoleted_mysql_evr:Obsoletes: mysql-devel < %{obsoleted_mysql_evr}}
Conflicts: community-mysql-devel
%description devel
MariaDB is a multi-user, multi-threaded SQL database server. This
@ -260,6 +283,7 @@ package contains the libraries and header files that are needed for
developing MariaDB/MySQL client applications.
MariaDB is a community developed branch of MySQL.
%package embedded
Summary: MariaDB as an embeddable library
@ -277,6 +301,7 @@ package contains a version of the MariaDB server that can be embedded
into a client application instead of running as a separate process.
MariaDB is a community developed branch of MySQL.
%package embedded-devel
Summary: Development files for MariaDB as an embeddable library
@ -295,6 +320,7 @@ package contains files needed for developing and testing with
the embedded version of the MariaDB server.
MariaDB is a community developed branch of MySQL.
%package bench
Summary: MariaDB benchmark scripts and data
@ -312,6 +338,7 @@ package contains benchmark scripts and data for use when benchmarking
MariaDB.
MariaDB is a community developed branch of MySQL.
%package test
Summary: The test suite distributed with MariaD
@ -324,8 +351,11 @@ Provides: mysql-test%{?_isa} = %{epoch}:%{version}-%{release}
Conflicts: community-mysql-test
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-test < %{obsoleted_mysql_case_evr}}
%{?obsoleted_mysql_evr:Obsoletes: mysql-test < %{obsoleted_mysql_evr}}
Requires: perl(Socket), perl(Time::HiRes)
Requires: perl(Data::Dumper), perl(Test::More), perl(Env)
Requires: perl(Env)
Requires: perl(Data::Dumper)
Requires: perl(Socket)
Requires: perl(Test::More)
Requires: perl(Time::HiRes)
%description test
MariaDB is a multi-user, multi-threaded SQL database server. This
@ -383,10 +413,10 @@ cp %{SOURCE2} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} \
# fail quickly and obviously if user tries to build as root
%if %runselftest
if [ x"`id -u`" = x0 ]; then
echo "mariadb's regression tests fail if run as root."
if [ x"$(id -u)" = "x0" ]; then
echo "mysql's regression tests 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."
echo "--nocheck to skip the regression tests."
exit 1
fi
%endif
@ -416,7 +446,6 @@ export LDFLAGS
# The INSTALL_xxx macros have to be specified relative to CMAKE_INSTALL_PREFIX
# so we can't use %%{_datadir} and so forth here.
cmake . -DBUILD_CONFIG=mysql_release \
-DFEATURE_SET="community" \
-DINSTALL_LAYOUT=RPM \
@ -424,11 +453,11 @@ cmake . -DBUILD_CONFIG=mysql_release \
-DRPM="%{?rhel:rhel%{rhel}}%{!?rhel:fedora%{fedora}}" \
-DCMAKE_INSTALL_PREFIX="%{_prefix}" \
%if 0%{?fedora} >= 20
-DINSTALL_DOCDIR=share/doc/%{name} \
-DINSTALL_DOCREADMEDIR=share/doc/%{name} \
-DINSTALL_DOCDIR="share/doc/%{name}" \
-DINSTALL_DOCREADMEDIR="share/doc/%{name}" \
%else
-DINSTALL_DOCDIR=share/doc/%{name}-%{version} \
-DINSTALL_DOCREADMEDIR=share/doc/%{name}-%{version} \
-DINSTALL_DOCDIR="share/doc/%{name}-%{version}" \
-DINSTALL_DOCREADMEDIR="share/doc/%{name}-%{version}" \
%endif
-DINSTALL_INCLUDEDIR=include/mysql \
-DINSTALL_INFODIR=share/info \
@ -466,49 +495,9 @@ for e in innobase xtradb ; do
done
done
%check
%if %runselftest
# hack to let 32- and 64-bit tests run concurrently on same build machine
case `uname -m` in
ppc64 | ppc64p7 | s390x | x86_64 | sparc64 )
MTR_BUILD_THREAD=7
;;
*)
MTR_BUILD_THREAD=11
;;
esac
export MTR_BUILD_THREAD
export MTR_PARALLEL=1
make test VERBOSE=1
# The cmake build scripts don't provide any simple way to control the
# options for mysql-test-run, so ignore the make target and just call it
# manually. Nonstandard options chosen are:
# --force to continue tests after a failure
# no retries please
# test SSL with --ssl
# skip tests that are listed in rh-skipped-tests.list
# avoid redundant test runs with --binlog-format=mixed
# increase timeouts to prevent unwanted failures during mass rebuilds
(
cd mysql-test
perl ./mysql-test-run.pl --force --retry=0 --ssl \
--skip-test-list=rh-skipped-tests.list \
--suite-timeout=720 --testcase-timeout=30 \
--mysqld=--binlog-format=mixed --force-restart \
--shutdown-timeout=60 --max-test-fail=0
# cmake build scripts will install the var cruft if left alone :-(
rm -rf var
)
%endif
%install
make DESTDIR=%{buildroot} install
# List the installed tree for RPM package maintenance purposes.
find %{buildroot} -print | sed "s|^%{buildroot}||" | sort > ROOTFILES
# cmake generates some completely wacko references to -lprobes_mysql when
# building with dtrace support. Haven't found where to shut that off,
# so resort to this blunt instrument. While at it, let's not reference
@ -518,7 +507,7 @@ sed -e 's/-lprobes_mysql//' -e 's/-lmysqlclient_r/-lmysqlclient/' \
cp -p -f mysql_config.tmp %{buildroot}%{_bindir}/mysql_config
chmod 755 %{buildroot}%{_bindir}/mysql_config
# multilib header hacks
# multilib header support
# we only apply this to known Red Hat multilib arches, per bug #181335
unamei=$(uname -i)
%ifarch %{arm}
@ -549,16 +538,14 @@ ln -s %{_localstatedir}/log/%{name}/%{name}.log %{buildroot}%{_localstatedir}/lo
# as well because users can have od settings in their /etc/my.cnf
mkdir -p %{buildroot}%{_localstatedir}/run/mysqld
mkdir -p %{buildroot}%{_localstatedir}/run/%{name}
install -m 0755 -d %{buildroot}%{_localstatedir}/lib/mysql
install -p -m 0755 -d %{buildroot}%{_localstatedir}/lib/mysql
mkdir -p %{buildroot}%{_sysconfdir}
%if %{ship_my_cnf}
install -p -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/
install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/my.cnf
%endif
# install systemd unit files and scripts for handling server startup
mkdir -p %{buildroot}%{_unitdir}
install -p -m 644 scripts/mariadb.service %{buildroot}%{_unitdir}/%{name}.service
install -D -p -m 644 scripts/mariadb.service %{buildroot}%{_unitdir}/%{name}.service
%if %{?with_mysqld_unit}
install -p -m 644 scripts/mysqld.service %{buildroot}%{_unitdir}/mysqld.service
%endif
@ -567,8 +554,7 @@ install -p -m 755 scripts/mariadb-wait-ready %{buildroot}%{_libexecdir}/mariadb-
install -p -m 755 scripts/mariadb-check-socket %{buildroot}%{_libexecdir}/mariadb-check-socket
install -p -m 644 scripts/mariadb-scripts-common %{buildroot}%{_libexecdir}/mariadb-scripts-common
mkdir -p %{buildroot}%{_tmpfilesdir}
install -p -m 0644 scripts/mariadb.tmpfiles.d %{buildroot}%{_tmpfilesdir}/%{name}.conf
install -D -p -m 0644 scripts/mariadb.tmpfiles.d %{buildroot}%{_tmpfilesdir}/%{name}.conf
# Remove libmysqld.a
rm -f %{buildroot}%{_libdir}/mysql/libmysqld.a
@ -626,6 +612,35 @@ rm -f %{buildroot}%{_sysconfdir}/logrotate.d/mysql
# remove solaris files
rm -rf %{buildroot}%{_datadir}/%{name}/solaris/
%check
%if %runselftest
make test VERBOSE=1
# hack to let 32- and 64-bit tests run concurrently on same build machine
export MTR_PARALLEL=1
# builds might happen at the same host, avoid collision
export MTR_BUILD_THREAD=%{__isa_bits}
# The cmake build scripts don't provide any simple way to control the
# options for mysql-test-run, so ignore the make target and just call it
# manually. Nonstandard options chosen are:
# --force to continue tests after a failure
# no retries please
# test SSL with --ssl
# skip tests that are listed in rh-skipped-tests.list
# avoid redundant test runs with --binlog-format=mixed
# increase timeouts to prevent unwanted failures during mass rebuilds
(
cd mysql-test
perl ./mysql-test-run.pl --force --retry=0 --ssl \
--skip-test-list=rh-skipped-tests.list \
--suite-timeout=720 --testcase-timeout=30 \
--mysqld=--binlog-format=mixed --force-restart \
--shutdown-timeout=60 --max-test-fail=0
# cmake build scripts will install the var cruft if left alone :-(
rm -rf var
)
%endif
%pre server
/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
/usr/sbin/useradd -M -N -g mysql -o -r -d %{_localstatedir}/lib/mysql -s /sbin/nologin \
@ -866,8 +881,6 @@ fi
%{_mandir}/man1/mysql_config.1*
%files embedded
%doc README COPYING COPYING.LESSER README.mysql-license
%doc storage/innobase/COPYING.Percona storage/innobase/COPYING.Google
%{_libdir}/mysql/libmysqld.so.*
%files embedded-devel
@ -884,10 +897,12 @@ fi
%{_bindir}/mysql_client_test
%{_bindir}/my_safe_process
%attr(-,mysql,mysql) %{_datadir}/mysql-test
%{_mandir}/man1/mysql_client_test.1*
%changelog
* Mon Jul 21 2014 Honza Horak <hhorak@redhat.com> - 1:10.0.12-4
- Reformating spec and removing unnecessary snippets
* Tue Jul 15 2014 Honza Horak <hhorak@redhat.com> - 1:10.0.12-3
- Enable OQGRAPH engine and package it as a sub-package
- Add support for TokuDB engine for x86_64 (currently still disabled)