Apply demodularization

This commit is contained in:
Lukas Javorsky 2024-02-04 21:28:59 +00:00
parent 859da9f619
commit 59a230df60

View File

@ -1,7 +1,13 @@
# Name of the package without any prefixes
%global pkg_name %{name}
%global pkg_name mysql
%global package_version 8.0.36
%define pkg_version %(echo %{package_version} | cut -d'.' -f1-2 )
%global pkgnamepatch mysql
# Set if this package will be the default one in distribution
%{!?mysql_default:%global mysql_default 1}
# 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)
@ -76,9 +82,9 @@
# Make long macros shorter
%global sameevr %{?epoch:%{epoch}:}%{version}-%{release}
Name: mysql8.0
Version: 8.0.36
Release: 2%{?with_debug:.debug}%{?dist}
Name: %{pkg_name}%{pkg_version}
Version: %{package_version}
Release: 3%{?with_debug:.debug}%{?dist}
Summary: MySQL client programs and shared libraries
URL: http://www.mysql.com
@ -130,6 +136,15 @@ Patch112: boost-1.57.0-mpl-print.patch
# Patches taken from boost 1.76
Patch113: boost-1.76.0-fix_multiprecision_issue_419-ppc64le.patch
# This macro is used for package/sub-package names in the entire specfile
%if %?mysql_default
%global pkgname %{pkg_name}
%package -n %{pkgname}
Summary: MySQL client programs and shared libraries
%else
%global pkgname %{name}
%endif
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: libaio-devel
@ -204,7 +219,7 @@ BuildRequires: make
BuildRequires: libfido2-devel
Requires: bash coreutils grep
Requires: %{name}-common = %{sameevr}
Requires: %{pkgname}-common = %{sameevr}
Provides: bundled(boost) = %{boost_bundled_version}
@ -215,22 +230,51 @@ Provides: bundled(boost) = %{boost_bundled_version}
%{?with_provides_community_mysql:Provides: community-mysql%{?_isa} = %community_mysql_version}
%{?with_obsoletes_community_mysql:Obsoletes: community-mysql <= %obsolete_community_mysql_version}
%define conflict_with_other_streams() %{expand:\
Provides: %{pkg_name}%{?1:-%{1}}-any\
Conflicts: %{pkg_name}%{?1:-%{1}}-any\
}
# Provide also mysqlX.X if default
%if %?mysql_default
%define mysqlX_if_default() %{expand:\
Provides: mysql%{pkg_version}%{?1:-%{1}} = %{sameevr}\
Provides: mysql%{pkg_version}%{?1:-%{1}}%{?_isa} = %{sameevr}\
}
%else
%define mysqlX_if_default() %{nil}
%endif
%define add_metadata() %{expand:\
%conflict_with_other_streams %{**}\
%mysqlX_if_default %{**}\
}
%add_metadata
%description
MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. The base package
contains the standard MySQL client programs and generic MySQL files.
%description -n %{pkgname}
MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. The base package
contains the standard MySQL client programs and generic MySQL files.
%if %{with clibrary}
%package libs
%package -n %{pkgname}-libs
Summary: The shared libraries required for MySQL clients
Requires: %{name}-common = %{sameevr}
Requires: %{pkgname}-common = %{sameevr}
%{?with_provides_community_mysql:Provides: community-mysql-libs = %community_mysql_version}
%{?with_provides_community_mysql:Provides: community-mysql-libs%{?_isa}= %community_mysql_version}
%{?with_obsoletes_community_mysql:Obsoletes: community-mysql-libs <= %obsolete_community_mysql_version}
%description libs
%add_metadata libs
%description -n %{pkgname}-libs
The mysql-libs package provides the essential shared libraries for any
MySQL client program or interface. You will need to install this package
to use any other MySQL package or any clients that need to connect to a
@ -239,13 +283,15 @@ MySQL server.
%if %{with config}
%package config
%package -n %{pkgname}-config
Summary: The config files required by server and client
%{?with_provides_community_mysql:Provides: community-mysql-config = %community_mysql_version}
%{?with_provides_community_mysql:Provides: community-mysql-config%{?_isa} = %community_mysql_version}
%{?with_obsoletes_community_mysql:Obsoletes: community-mysql-config <= %obsolete_community_mysql_version}
%description config
%add_metadata config
%description -n %{pkgname}-config
The package provides the config file my.cnf and my.cnf.d directory used by any
MariaDB or MySQL program. You will need to install this package to use any
other MariaDB or MySQL package if the config files are not provided in the
@ -254,14 +300,17 @@ package itself.
%if %{with common}
%package common
%package -n %{pkgname}-common
Summary: The shared files required for MySQL server and client
BuildArch: noarch
Requires: %{_sysconfdir}/my.cnf
%{?with_provides_community_mysql:Provides: community-mysql-common = %community_mysql_version}
%{?with_obsoletes_community_mysql:Obsoletes: community-mysql-common <= %obsolete_community_mysql_version}
%description common
# As this package is noarch, it can't use the %%{?_isa} RPM macro
%conflict_with_other_streams common
%description -n %{pkgname}-common
The mysql-common package provides the essential shared files for any
MySQL program. You will need to install this package to use any other
MySQL package.
@ -269,27 +318,30 @@ MySQL package.
%if %{with errmsg}
%package errmsg
%package -n %{pkgname}-errmsg
Summary: The error messages files required by MySQL server
BuildArch: noarch
Requires: %{name}-common = %{sameevr}
Requires: %{pkgname}-common = %{sameevr}
%{?with_provides_community_mysql:Provides: community-mysql-errmsg = %community_mysql_version}
%{?with_obsoletes_community_mysql:Obsoletes: community-mysql-errmsg <= %obsolete_community_mysql_version}
%description errmsg
# As this package is noarch, it can't use the %%{?_isa} RPM macro
%conflict_with_other_streams errmsg
%description -n %{pkgname}-errmsg
The package provides error messages files for the MySQL daemon
%endif
%package server
%package -n %{pkgname}-server
Summary: The MySQL server and related files
Requires: %{name}%{?_isa}
Requires: %{pkgname}%{?_isa} = %{sameevr}
Requires: %{name}-common = %{sameevr}
Requires: %{pkgname}-common = %{sameevr}
Requires: %{_sysconfdir}/my.cnf
Requires: %{_sysconfdir}/my.cnf.d
Requires: %{name}-errmsg = %{sameevr}
Requires: %{pkgname}-errmsg = %{sameevr}
%{?mecab:Requires: mecab-ipadic}
Requires: coreutils
Requires(pre): /usr/sbin/useradd
@ -317,7 +369,9 @@ Requires: (mysql-selinux if selinux-policy-targeted)
%{?with_provides_community_mysql:Provides: community-mysql-server%{?_isa} = %community_mysql_version}
%{?with_obsoletes_community_mysql:Obsoletes: community-mysql-server <= %obsolete_community_mysql_version}
%description server
%add_metadata server
%description -n %{pkgname}-server
MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. This package contains
@ -325,9 +379,9 @@ the MySQL server and some accompanying files and directories.
%if %{with devel}
%package devel
%package -n %{pkgname}-devel
Summary: Files for development of MySQL applications
%{?with_clibrary:Requires: %{name}-libs%{?_isa} = %{sameevr}}
%{?with_clibrary:Requires: %{pkgname}-libs%{?_isa} = %{sameevr}}
Requires: openssl-devel
Requires: zlib-devel
Requires: libzstd-devel
@ -337,18 +391,20 @@ Requires: libzstd-devel
%{?with_provides_community_mysql:Provides: community-mysql-devel%{?_isa} = %community_mysql_version}
%{?with_obsoletes_community_mysql:Obsoletes: community-mysql-devel <= %obsolete_community_mysql_version}
%description devel
%add_metadata devel
%description -n %{pkgname}-devel
MySQL is a multi-user, multi-threaded SQL database server. This
package contains the libraries and header files that are needed for
developing MySQL client applications.
%endif
%if %{with test}
%package test
%package -n %{pkgname}-test
Summary: The test suite distributed with MySQL
Requires: %{name}%{?_isa} = %{sameevr}
Requires: %{name}-common = %{sameevr}
Requires: %{name}-server%{?_isa} = %{sameevr}
Requires: %{pkgname}%{?_isa} = %{sameevr}
Requires: %{pkgname}-common = %{sameevr}
Requires: %{pkgname}-server%{?_isa} = %{sameevr}
Requires: gzip
Requires: lz4
Requires: openssl
@ -375,7 +431,9 @@ Requires: perl(Time::HiRes)
%{?with_provides_community_mysql:Provides: community-mysql-test%{?_isa} = %community_mysql_version}
%{?with_obsoletes_community_mysql:Obsoletes: community-mysql-test <= %obsolete_community_mysql_version}
%description test
%add_metadata test
%description -n %{pkgname}-test
MySQL is a multi-user, multi-threaded SQL database server. This
package contains the regression test suite distributed with
the MySQL sources.
@ -677,27 +735,27 @@ popd
%pre server
%pre -n %{pkgname}-server
/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
/usr/sbin/useradd -M -N -g mysql -o -r -d %{dbdatadir} -s /sbin/nologin \
-c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :
%post server
%post -n %{pkgname}-server
%systemd_post %{daemon_name}.service
if [ ! -e "%{logfile}" -a ! -h "%{logfile}" ] ; then
install /dev/null -m0640 -omysql -gmysql "%{logfile}"
fi
%preun server
%preun -n %{pkgname}-server
%systemd_preun %{daemon_name}.service
%postun server
%postun -n %{pkgname}-server
%systemd_postun_with_restart %{daemon_name}.service
%if %{with client}
%files
%files -n %{pkgname}
%{_bindir}/mysql
%{_bindir}/mysql_config_editor
%{_bindir}/mysqladmin
@ -722,14 +780,14 @@ fi
%endif
%if %{with clibrary}
%files libs
%files -n %{pkgname}-libs
%dir %{_libdir}/mysql
%{_libdir}/mysql/libmysqlclient*.so.*
%config(noreplace) %{_sysconfdir}/ld.so.conf.d/*
%endif
%if %{with config}
%files config
%files -n %{pkgname}-config
# although the default my.cnf contains only server settings, we put it in the
# common package because it can be used for client settings too.
%dir %{_sysconfdir}/my.cnf.d
@ -737,7 +795,7 @@ fi
%endif
%if %{with common}
%files common
%files -n %{pkgname}-common
%license LICENSE
%doc README README.mysql-license README.mysql-docs
%doc storage/innobase/COPYING.Percona storage/innobase/COPYING.Google
@ -746,7 +804,7 @@ fi
%endif
%if %{with errmsg}
%files errmsg
%files -n %{pkgname}-errmsg
%{_datadir}/%{pkg_name}/messages_to_error_log.txt
%{_datadir}/%{pkg_name}/messages_to_clients.txt
%{_datadir}/%{pkg_name}/english
@ -775,7 +833,7 @@ fi
%lang(uk) %{_datadir}/%{pkg_name}/ukrainian
%endif
%files server
%files -n %{pkgname}-server
%{_bindir}/ibd2sdi
%{_bindir}/myisamchk
%{_bindir}/myisam_ftdump
@ -878,7 +936,7 @@ fi
%config(noreplace) %{logrotateddir}/%{daemon_name}
%if %{with devel}
%files devel
%files -n %{pkgname}-devel
%{_bindir}/mysql_config*
%exclude %{_bindir}/mysql_config_editor
%{_includedir}/mysql
@ -892,7 +950,7 @@ fi
%endif
%if %{with test}
%files test
%files -n %{pkgname}-test
%{_bindir}/mysql_client_test
%{_bindir}/mysql_keyring_encryption_test
%{_bindir}/mysqltest
@ -994,6 +1052,11 @@ fi
%endif
%changelog
* Mon Feb 05 2024 Lukas Javorsky <ljavorsk@redhat.com> - 8.0.36-3
- Apply demodularization
- the default stream builds mysql.rpm
- the non-default stream builds mysqlX.XX.rpm
* Wed Jan 31 2024 Honza Horak <hhorak@redhat.com> - 8.0.36-2
- Use signal to flush logs when rotating