Add possibility to not ship some sub-packages

This commit is contained in:
Honza Horak 2014-07-23 16:37:14 +02:00
parent ee2d0857de
commit 9084c83ebd
1 changed files with 110 additions and 1 deletions

View File

@ -34,6 +34,16 @@
# fashion; enabled by default # fashion; enabled by default
%bcond_without oqgraph %bcond_without oqgraph
# For some use cases we do not need some parts of the package
%bcond_without clibrary
%bcond_without embedded
%bcond_without devel
%bcond_without client
%bcond_without common
%bcond_without errmsg
%bcond_without bench
%bcond_without test
# Include files for SysV init or systemd # Include files for SysV init or systemd
%if 0%{?systemd_requires:1} %if 0%{?systemd_requires:1}
%bcond_without init_systemd %bcond_without init_systemd
@ -191,6 +201,7 @@ and many different client programs and libraries. The base package
contains the standard MariaDB/MySQL client programs and generic MySQL files. contains the standard MariaDB/MySQL client programs and generic MySQL files.
%if %{with clibrary}
%package libs %package libs
Summary: The shared libraries required for MariaDB/MySQL clients Summary: The shared libraries required for MariaDB/MySQL clients
@ -206,8 +217,9 @@ The mariadb-libs package provides the essential shared libraries for any
MariaDB/MySQL client program or interface. You will need to install this 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 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. to a MariaDB/MySQL server. MariaDB is a community developed branch of MySQL.
%endif
%if %{with common}
%package common %package common
Summary: The shared files required by server and client Summary: The shared files required by server and client
@ -219,8 +231,10 @@ Requires: %{_sysconfdir}/my.cnf
%description common %description common
The package provides the essential shared files for any MariaDB program. The package provides the essential shared files for any MariaDB program.
You will need to install this package to use any other MariaDB package. You will need to install this package to use any other MariaDB package.
%endif
%if %{with errmsg}
%package errmsg %package errmsg
Summary: The error messages files required by server and embedded Summary: The error messages files required by server and embedded
@ -231,6 +245,7 @@ Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release}
The package provides error messages files for the MariaDB daemon and the 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 embedded server. You will need to install this package to use any of those
MariaDB packages. MariaDB packages.
%endif
%package server %package server
@ -241,6 +256,10 @@ Group: Applications/Databases
# note: no version here = %{version}-%{release} # note: no version here = %{version}-%{release}
Requires: mysql-compat-client%{?_isa} Requires: mysql-compat-client%{?_isa}
Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release}
%if %{without common}
Requires: %{_sysconfdir}/my.cnf
Requires: %{_sysconfdir}/my.cnf.d
%endif
Requires: %{name}-errmsg%{?_isa} = %{epoch}:%{version}-%{release} Requires: %{name}-errmsg%{?_isa} = %{epoch}:%{version}-%{release}
Requires: sh-utils Requires: sh-utils
Requires(pre): /usr/sbin/useradd Requires(pre): /usr/sbin/useradd
@ -291,6 +310,7 @@ standard SQL syntax, and results joined onto other tables.
%endif %endif
%if %{with devel}
%package devel %package devel
Summary: Files for development of MariaDB/MySQL applications Summary: Files for development of MariaDB/MySQL applications
@ -308,8 +328,10 @@ MariaDB is a multi-user, multi-threaded SQL database server. This
package contains the libraries and header files that are needed for package contains the libraries and header files that are needed for
developing MariaDB/MySQL client applications. developing MariaDB/MySQL client applications.
MariaDB is a community developed branch of MySQL. MariaDB is a community developed branch of MySQL.
%endif
%if %{with embedded}
%package embedded %package embedded
Summary: MariaDB as an embeddable library Summary: MariaDB as an embeddable library
@ -345,8 +367,10 @@ MariaDB is a multi-user, multi-threaded SQL database server. This
package contains files needed for developing and testing with package contains files needed for developing and testing with
the embedded version of the MariaDB server. the embedded version of the MariaDB server.
MariaDB is a community developed branch of MySQL. MariaDB is a community developed branch of MySQL.
%endif
%if %{with bench}
%package bench %package bench
Summary: MariaDB benchmark scripts and data Summary: MariaDB benchmark scripts and data
@ -363,8 +387,10 @@ MariaDB is a multi-user, multi-threaded SQL database server. This
package contains benchmark scripts and data for use when benchmarking package contains benchmark scripts and data for use when benchmarking
MariaDB. MariaDB.
MariaDB is a community developed branch of MySQL. MariaDB is a community developed branch of MySQL.
%endif
%if %{with test}
%package test %package test
Summary: The test suite distributed with MariaD Summary: The test suite distributed with MariaD
@ -388,6 +414,7 @@ MariaDB is a multi-user, multi-threaded SQL database server. This
package contains the regression test suite distributed with package contains the regression test suite distributed with
the MariaDB sources. the MariaDB sources.
MariaDB is a community developed branch of MySQL. MariaDB is a community developed branch of MySQL.
%endif
%prep %prep
%setup -q -n mariadb-%{version} %setup -q -n mariadb-%{version}
@ -658,7 +685,60 @@ rm -f %{buildroot}%{logrotateddir}/mysql
# remove solaris files # remove solaris files
rm -rf %{buildroot}%{_datadir}/%{name}/solaris/ rm -rf %{buildroot}%{_datadir}/%{name}/solaris/
%if %{without clibrary}
rm -rf %{buildroot}%{_libdir}/mysql/libmysqlclient*.so.*
rm -rf %{buildroot}%{_sysconfdir}/ld.so.conf.d
%endif
%if %{without embedded}
rm -f %{buildroot}%{_libdir}/mysql/libmysqld.so*
rm -f %{buildroot}%{_bindir}/{mysql_client_test_embedded,mysqltest_embedded}
rm -f %{buildroot}%{_mandir}/man1/{mysql_client_test_embedded,mysqltest_embedded}.1*
%endif
%if %{without devel}
rm -f %{buildroot}%{_bindir}/mysql_config*
rm -rf %{buildroot}%{_includedir}/mysql
rm -f %{buildroot}%{_datadir}/aclocal/mysql.m4
rm -f %{buildroot}%{_libdir}/mysql/libmysqlclient*.so
rm -f %{buildroot}%{_mandir}/man1/mysql_config.1*
%endif
%if %{without client}
rm -f %{buildroot}%{_bindir}/{msql2mysql,mysql,mysql_find_rows,mysql_waitpid,\
mysqlaccess,mysqladmin,mysqlbinlog,mysqlcheck,mysqldump,tokuftdump,mysqlimport,\
mysqlshow,mysqlslap,my_print_defaults,aria_chk,aria_dump_log,aria_ftdump,\
aria_pack,aria_read_log}
rm -f %{buildroot}%{_mandir}/man1/{mysql,mysql_find_rows,mysql_waitpid,\
mysqlaccess,mysqladmin,mysqldump,mysqlshow,mysqlslap,\
my_print_defaults}.1*
rm -f %{buildroot}%{_sysconfdir}/my.cnf.d/{client,connect}.cnf
%endif
%if %{without common}
rm -f %{buildroot}%{_sysconfdir}/my.cnf
rm -f %{buildroot}%{_sysconfdir}/my.cnf.d/mysql-clients.cnf
rm -rf %{buildroot}%{_datadir}/%{name}/charsets
%endif
%if %{without errmsg}
rm -rf %{buildroot}%{_datadir}/%{name}/{english,czech,danish,dutch,estonian,\
french,german,greek,hungarian,italian,japanese,korean,norwegian,norwegian-ny,\
polish,portuguese,romanian,russian,serbian,slovak,spanish,swedish,ukrainian}
%endif
%if %{without bench}
rm -rf %{buildroot}%{_datadir}/sql-bench
%endif
%if %{without test}
rm -f %{buildroot}%{_bindir}/{mysql_client_test,my_safe_process}
rm -rf %{buildroot}%{_datadir}/mysql-test
rm -f %{buildroot}%{_mandir}/man1/mysql_client_test.1*
%endif
%check %check
%if %{with test}
%if %runselftest %if %runselftest
make test VERBOSE=1 make test VERBOSE=1
# hack to let 32- and 64-bit tests run concurrently on same build machine # hack to let 32- and 64-bit tests run concurrently on same build machine
@ -686,6 +766,7 @@ export MTR_BUILD_THREAD=%{__isa_bits}
rm -rf var rm -rf var
) )
%endif %endif
%endif
%pre server %pre server
/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || : /usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
@ -720,7 +801,9 @@ if [ -f %mysqld_running_flag_file ] ; then
fi fi
%endif %endif
%if %{with clibrary}
%post libs -p /sbin/ldconfig %post libs -p /sbin/ldconfig
%endif
%post server %post server
%if %{with init_systemd} %if %{with init_systemd}
@ -733,7 +816,9 @@ fi
%endif %endif
/bin/chmod 0755 %{_localstatedir}/lib/mysql /bin/chmod 0755 %{_localstatedir}/lib/mysql
%if %{with embedded}
%post embedded -p /sbin/ldconfig %post embedded -p /sbin/ldconfig
%endif
%preun server %preun server
%if %{with init_systemd} %if %{with init_systemd}
@ -746,7 +831,9 @@ if [ $1 = 0 ]; then
fi fi
%endif %endif
%if %{with clibrary}
%postun libs -p /sbin/ldconfig %postun libs -p /sbin/ldconfig
%endif
%postun server %postun server
%if %{with init_systemd} %if %{with init_systemd}
@ -758,11 +845,14 @@ if [ $1 -ge 1 ]; then
fi fi
%endif %endif
%if %{with embedded}
%postun embedded -p /sbin/ldconfig %postun embedded -p /sbin/ldconfig
%endif
%files %files
%doc README.mysql-docs %doc README.mysql-docs
%if %{with client}
%{_bindir}/msql2mysql %{_bindir}/msql2mysql
%{_bindir}/mysql %{_bindir}/mysql
%{_bindir}/mysql_find_rows %{_bindir}/mysql_find_rows
@ -795,12 +885,16 @@ fi
%config(noreplace) %{_sysconfdir}/my.cnf.d/client.cnf %config(noreplace) %{_sysconfdir}/my.cnf.d/client.cnf
%config(noreplace) %{_sysconfdir}/my.cnf.d/connect.cnf %config(noreplace) %{_sysconfdir}/my.cnf.d/connect.cnf
%endif
%if %{with clibrary}
%files libs %files libs
%dir %{_libdir}/mysql %dir %{_libdir}/mysql
%{_libdir}/mysql/libmysqlclient.so.* %{_libdir}/mysql/libmysqlclient.so.*
%{_sysconfdir}/ld.so.conf.d/* %{_sysconfdir}/ld.so.conf.d/*
%endif
%if %{with common}
%files common %files common
%doc README COPYING COPYING.LESSER README.mysql-license %doc README COPYING COPYING.LESSER README.mysql-license
%doc storage/innobase/COPYING.Percona storage/innobase/COPYING.Google %doc storage/innobase/COPYING.Percona storage/innobase/COPYING.Google
@ -813,7 +907,9 @@ fi
%endif %endif
%dir %{_datadir}/%{name} %dir %{_datadir}/%{name}
%{_datadir}/%{name}/charsets %{_datadir}/%{name}/charsets
%endif
%if %{with errmsg}
%files errmsg %files errmsg
%{_datadir}/%{name}/english %{_datadir}/%{name}/english
%lang(cs) %{_datadir}/%{name}/czech %lang(cs) %{_datadir}/%{name}/czech
@ -838,6 +934,7 @@ fi
%lang(es) %{_datadir}/%{name}/spanish %lang(es) %{_datadir}/%{name}/spanish
%lang(sv) %{_datadir}/%{name}/swedish %lang(sv) %{_datadir}/%{name}/swedish
%lang(uk) %{_datadir}/%{name}/ukrainian %lang(uk) %{_datadir}/%{name}/ukrainian
%endif
%files server %files server
%doc support-files/*.cnf README.mysql-cnf %doc support-files/*.cnf README.mysql-cnf
@ -874,6 +971,9 @@ fi
%{_libdir}/mysql/INFO_SRC %{_libdir}/mysql/INFO_SRC
%{_libdir}/mysql/INFO_BIN %{_libdir}/mysql/INFO_BIN
%if %{without common}
%dir %{_datadir}/%{name}
%endif
%{_libdir}/mysql/plugin %{_libdir}/mysql/plugin
%exclude %{_libdir}/mysql/plugin/ha_oqgraph.so %exclude %{_libdir}/mysql/plugin/ha_oqgraph.so
@ -943,6 +1043,7 @@ fi
%{_libdir}/mysql/plugin/ha_oqgraph.so %{_libdir}/mysql/plugin/ha_oqgraph.so
%endif %endif
%if %{with devel}
%files devel %files devel
%{_bindir}/mysql_config %{_bindir}/mysql_config
%{_bindir}/mysql_config-%{__isa_bits} %{_bindir}/mysql_config-%{__isa_bits}
@ -951,7 +1052,9 @@ fi
%{_libdir}/mysql/libmysqlclient.so %{_libdir}/mysql/libmysqlclient.so
%{_libdir}/mysql/libmysqlclient_r.so %{_libdir}/mysql/libmysqlclient_r.so
%{_mandir}/man1/mysql_config.1* %{_mandir}/man1/mysql_config.1*
%endif
%if %{with embedded}
%files embedded %files embedded
%{_libdir}/mysql/libmysqld.so.* %{_libdir}/mysql/libmysqld.so.*
@ -961,20 +1064,26 @@ fi
%{_bindir}/mysqltest_embedded %{_bindir}/mysqltest_embedded
%{_mandir}/man1/mysql_client_test_embedded.1* %{_mandir}/man1/mysql_client_test_embedded.1*
%{_mandir}/man1/mysqltest_embedded.1* %{_mandir}/man1/mysqltest_embedded.1*
%endif
%if %{with bench}
%files bench %files bench
%{_datadir}/sql-bench %{_datadir}/sql-bench
%endif
%if %{with test}
%files test %files test
%{_bindir}/mysql_client_test %{_bindir}/mysql_client_test
%{_bindir}/my_safe_process %{_bindir}/my_safe_process
%attr(-,mysql,mysql) %{_datadir}/mysql-test %attr(-,mysql,mysql) %{_datadir}/mysql-test
%{_mandir}/man1/mysql_client_test.1* %{_mandir}/man1/mysql_client_test.1*
%endif
%changelog %changelog
* Tue Jul 22 2014 Honza Horak <hhorak@redhat.com> - 1:10.0.12-5 * Tue Jul 22 2014 Honza Horak <hhorak@redhat.com> - 1:10.0.12-5
- Use variable for daemon unit name - Use variable for daemon unit name
- Include SysV init script if built on older system - Include SysV init script if built on older system
- Add possibility to not ship some sub-packages
* Mon Jul 21 2014 Honza Horak <hhorak@redhat.com> - 1:10.0.12-4 * Mon Jul 21 2014 Honza Horak <hhorak@redhat.com> - 1:10.0.12-4
- Reformating spec and removing unnecessary snippets - Reformating spec and removing unnecessary snippets