Rework usage of macros and remove some compatibility artefacts

This commit is contained in:
Honza Horak 2014-12-06 09:00:06 +01:00
parent 83886dc4bb
commit 8a5dc2e718
2 changed files with 25 additions and 90 deletions

View File

@ -1,7 +1,7 @@
diff -up mariadb-10.0.15/scripts/CMakeLists.txt.systemd mariadb-10.0.15/scripts/CMakeLists.txt
--- mariadb-10.0.15/scripts/CMakeLists.txt.systemd 2014-11-27 15:06:24.670736998 +0100
+++ mariadb-10.0.15/scripts/CMakeLists.txt 2014-11-27 15:04:26.252530666 +0100
@@ -374,6 +374,34 @@ ELSE()
@@ -374,6 +374,32 @@ ELSE()
COMPONENT ${${file}_COMPONENT}
)
ENDFOREACH()
@ -17,8 +17,6 @@ diff -up mariadb-10.0.15/scripts/CMakeLists.txt.systemd mariadb-10.0.15/scripts/
+ mysql-scripts-common
+ mysql_config_multilib
+ mysql.init
+ mysql-compat.service
+ mysql-compat.conf
+ my.cnf
+ )
+ FOREACH(file ${SYSTEMD_SCRIPTS})

View File

@ -1,5 +1,4 @@
# Name of the package without any prefixes
%global pkgname mariadb
# Prefix that is used for patches
%global pkgnamepatch mariadb
# Regression tests may take a long time (many cores recommended), skip them by
@ -10,7 +9,7 @@
# In f20+ use unversioned docdirs, otherwise the old versioned one
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
# use Full RELRO for all binaries (RHBZ#1092548)
# Use Full RELRO for all binaries (RHBZ#1092548)
%global _hardened_build 1
# By default, patch(1) creates backup files when chunks apply with offsets.
@ -63,9 +62,6 @@
%bcond_without init_systemd
%bcond_with init_sysv
%global daemon_name %{name}
# Provide temporary service file name that will be removed after some time
# (Fedora 22?)
%global mysqld_unit mysqld
%else
%bcond_with init_systemd
%bcond_without init_sysv
@ -85,9 +81,9 @@
%global logrotateddir %{_sysconfdir}/logrotate.d
%global logfiledir %{_localstatedir}/log/%{daemon_name}
%global logfile %{logfiledir}/%{daemon_name}.log
%if 0%{?fedora} >= 20
%global old_logfile %{_localstatedir}/log/mysqld.log
%endif
# Defining where database data live
%global dbdatadir %{_localstatedir}/lib/mysql
# Home directory of mysql user should be same for all packages that create it
%global mysqluserhome /var/lib/mysql
@ -98,24 +94,16 @@
# Provide mysql names for compatibility
%bcond_without mysql_names
# 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
# the transaction. Basically the file is created when mysqld is enabled in
# the beginning of the transaction and mysqld is enabled again in the end
# of the transaction in case this flag file exists.
%global mysqld_enabled_flag_file %{_localstatedir}/lib/rpm-state/mysqld_enabled
%global mysqld_running_flag_file %{_localstatedir}/lib/rpm-state/mysqld_running
%bcond_without conflicts
# Make long macros shorter
%global sameevr %{epoch}:%{version}-%{release}
%global compatver 10.0
%global bugfixver 15
Name: %{pkgname}
Name: mariadb
Version: %{compatver}.%{bugfixver}
Release: 1%{?with_debug:.debug}%{?dist}
Release: 2%{?with_debug:.debug}%{?dist}
Epoch: 1
Summary: A community developed branch of MySQL
@ -140,8 +128,6 @@ Source13: mysql-wait-ready.sh
Source14: mysql-check-socket.sh
Source15: mysql-scripts-common.sh
Source16: mysql-check-upgrade.sh
Source17: mysql-compat.service.in
Source18: mysql-compat.conf.in
Source19: mysql.init.in
Source50: rh-skipped-tests-base.list
Source51: rh-skipped-tests-intel.list
@ -167,7 +153,6 @@ Patch31: %{pkgnamepatch}-string-overflow.patch
Patch32: %{pkgnamepatch}-basedir.patch
Patch33: %{pkgnamepatch}-covscan-signexpr.patch
Patch34: %{pkgnamepatch}-covscan-stroverflow.patch
Patch35: %{pkgnamepatch}-config.patch
Patch36: %{pkgnamepatch}-ssltest.patch
BuildRequires: cmake
@ -212,7 +197,7 @@ Provides: mysql-compat-client%{?_isa} = %{sameevr}
# MySQL (with caps) is upstream's spelling of their own RPMs for mysql
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL < %{obsoleted_mysql_case_evr}}
%{?obsoleted_mysql_evr:Obsoletes: mysql < %{obsoleted_mysql_evr}}
Conflicts: community-mysql
%{?with_conflicts:Conflicts: community-mysql}
# Filtering: https://fedoraproject.org/wiki/Packaging:AutoProvidesAndRequiresFiltering
%if 0%{?fedora} > 14 || 0%{?rhel} > 6
@ -325,8 +310,8 @@ Provides: mysql-compat-server = %{sameevr}
Provides: mysql-compat-server%{?_isa} = %{sameevr}
%endif
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-server < %{obsoleted_mysql_case_evr}}
Conflicts: community-mysql-server
Conflicts: mariadb-galera-server
%{?with_conflicts:Conflicts: community-mysql-server}
%{?with_conflicts:Conflicts: mariadb-galera-server}
%{?obsoleted_mysql_evr:Obsoletes: mysql-server < %{obsoleted_mysql_evr}}
%description server
@ -382,7 +367,7 @@ Provides: mysql-devel%{?_isa} = %{sameevr}
%endif
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-devel < %{obsoleted_mysql_case_evr}}
%{?obsoleted_mysql_evr:Obsoletes: mysql-devel < %{obsoleted_mysql_evr}}
Conflicts: community-mysql-devel
%{?with_conflicts:Conflicts: community-mysql-devel}
%description devel
MariaDB is a multi-user, multi-threaded SQL database server. This
@ -421,7 +406,7 @@ Requires: %{name}-devel%{?_isa} = %{sameevr}
Provides: mysql-embedded-devel = %{sameevr}
Provides: mysql-embedded-devel%{?_isa} = %{sameevr}
%endif
Conflicts: community-mysql-embedded-devel
%{?with_conflicts:Conflicts: community-mysql-embedded-devel}
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-embedded-devel < %{obsoleted_mysql_case_evr}}
%{?obsoleted_mysql_evr:Obsoletes: mysql-embedded-devel < %{obsoleted_mysql_evr}}
@ -442,7 +427,7 @@ Requires: %{name}%{?_isa} = %{sameevr}
Provides: mysql-bench = %{sameevr}
Provides: mysql-bench%{?_isa} = %{sameevr}
%endif
Conflicts: community-mysql-bench
%{?with_conflicts:Conflicts: community-mysql-bench}
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-bench < %{obsoleted_mysql_case_evr}}
%{?obsoleted_mysql_evr:Obsoletes: mysql-bench < %{obsoleted_mysql_evr}}
@ -472,7 +457,7 @@ Requires: perl(Socket)
Requires: perl(Sys::Hostname)
Requires: perl(Test::More)
Requires: perl(Time::HiRes)
Conflicts: community-mysql-test
%{?with_conflicts:Conflicts: community-mysql-test}
%if %{with mysql_names}
Provides: mysql-test = %{sameevr}
Provides: mysql-test%{?_isa} = %{sameevr}
@ -503,7 +488,6 @@ MariaDB is a community developed branch of MySQL.
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
# removing bundled cmd-line-utils
@ -539,7 +523,7 @@ cat %{SOURCE55} >> mysql-test/rh-skipped-tests.list
%endif
cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} \
%{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE17} %{SOURCE18} %{SOURCE19} \
%{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE19} \
scripts
%build
@ -585,13 +569,8 @@ export LDFLAGS
-DFEATURE_SET="community" \
-DINSTALL_LAYOUT=RPM \
-DDAEMON_NAME="%{daemon_name}" \
%if 0%{?mysqld_unit:1}
-DDAEMON_NAME_COMPAT="%{mysqld_unit}" \
%endif
-DLOG_LOCATION="%{logfile}" \
-DLOG_LOCATION_COMPAT="%{old_logfile}" \
-DPID_FILE_DIR="%{_localstatedir}/run/%{daemon_name}" \
-DPID_FILE_DIR_COMPAT="%{_localstatedir}/run/%{mysqld_unit}" \
-DNICE_PROJECT_NAME="MariaDB" \
-DRPM="%{?rhel:rhel%{rhel}}%{!?rhel:fedora%{fedora}}" \
-DCMAKE_INSTALL_PREFIX="%{_prefix}" \
@ -615,8 +594,8 @@ export LDFLAGS
-DINSTALL_SCRIPTDIR=bin \
-DINSTALL_SQLBENCHDIR=share \
-DINSTALL_SUPPORTFILESDIR=share/%{name} \
-DMYSQL_DATADIR="%{_localstatedir}/lib/mysql" \
-DMYSQL_UNIX_ADDR="%{_localstatedir}/lib/mysql/mysql.sock" \
-DMYSQL_DATADIR="%{dbdatadir}" \
-DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \
-DENABLED_LOCAL_INFILE=ON \
-DENABLE_DTRACE=ON \
-DWITH_EMBEDDED_SERVER=ON \
@ -680,16 +659,12 @@ rm -rf %{buildroot}%{_pkgdocdir}/MariaDB-server-%{version}/
mkdir -p %{buildroot}%{logfiledir}
chmod 0750 %{buildroot}%{logfiledir}
touch %{buildroot}%{logfile}
%if 0%{?old_logfile:1}
ln -s %{logfile} %{buildroot}%{old_logfile}
%endif
# current setting in my.cnf is to use /var/run/mariadb for creating pid file,
# however since my.cnf is not updated by RPM if changed, we need to create mysqld
# as well because users can have odd settings in their /etc/my.cnf
%{?mysqld_unit:mkdir -p %{buildroot}%{_localstatedir}/run/%{mysqld_unit}}
mkdir -p %{buildroot}%{_localstatedir}/run/%{daemon_name}
install -p -m 0755 -d %{buildroot}%{_localstatedir}/lib/mysql
install -p -m 0755 -d %{buildroot}%{dbdatadir}
%if %{with config}
install -D -p -m 0644 scripts/my.cnf %{buildroot}%{_sysconfdir}/my.cnf
@ -704,13 +679,6 @@ install -D -p -m 644 scripts/mysql.service %{buildroot}%{_unitdir}/%{daemon_name
install -D -p -m 0644 scripts/mysql.tmpfiles.d %{buildroot}%{_tmpfilesdir}/%{name}.conf
%endif
# install alternative systemd unit file for compatibility reasons
%if 0%{?mysqld_unit:1}
install -p -m 644 scripts/mysql-compat.service %{buildroot}%{_unitdir}/%{mysqld_unit}.service
mkdir -p %{buildroot}%{_unitdir}/%{daemon_name}.service.d
install -p -m 644 scripts/mysql-compat.conf %{buildroot}%{_unitdir}/%{daemon_name}.service.d/mysql-compat.conf
%endif
# install SysV init script
%if %{with init_sysv}
install -D -p -m 755 scripts/mysql.init %{buildroot}%{_initddir}/%{daemon_name}
@ -874,34 +842,6 @@ export MTR_BUILD_THREAD=%{__isa_bits}
/usr/sbin/useradd -M -N -g mysql -o -r -d %{mysqluserhome} -s /sbin/nologin \
-c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :
%if %{with init_systemd}
# Explicitly enable mysqld if it was enabled in the beginning
# of the transaction. Otherwise mysqld is disabled always when
# replacing mysql with mariadb, because it is not recognized
# as updating, but rather as removal and install.
if /bin/systemctl is-enabled mysqld.service >/dev/null 2>&1 ; then
touch %mysqld_enabled_flag_file >/dev/null 2>&1 || :
fi
# Since mysqld.service became a symlink to mariadb.service, turning off
# the running mysqld service doesn't work fine (BZ#1002996). As a work-around
# we explicitly stop mysqld before upgrade and start after it again.
if [ ! -L %{_unitdir}/mysqld.service ] && /bin/systemctl is-active mysqld.service &>/dev/null ; then
touch %mysqld_running_flag_file >/dev/null 2>&1 || :
/bin/systemctl stop mysqld.service >/dev/null 2>&1 || :
fi
%posttrans server
if [ -f %mysqld_enabled_flag_file ] ; then
/bin/systemctl enable %{daemon_name}.service >/dev/null 2>&1 || :
rm -f %mysqld_enabled_flag_file >/dev/null 2>&1 || :
fi
if [ -f %mysqld_running_flag_file ] ; then
/bin/systemctl start %{daemon_name}.service >/dev/null 2>&1 || :
rm -f %mysqld_running_flag_file >/dev/null 2>&1 || :
fi
%endif
%if %{with clibrary}
%post libs -p /sbin/ldconfig
%endif
@ -919,7 +859,7 @@ if [ $1 = 1 ]; then
/sbin/chkconfig --add %{daemon_name}
fi
%endif
/bin/chmod 0755 %{_localstatedir}/lib/mysql
/bin/chmod 0755 %{dbdatadir}
%preun server
%if %{with init_systemd}
@ -1129,8 +1069,6 @@ fi
%{?with_mroonga:%{_datadir}/%{name}/mroonga/uninstall.sql}
%{_datadir}/%{name}/my-*.cnf
%{?mysqld_unit:%{_unitdir}/%{mysqld_unit}.service}
%{?mysqld_unit:%{_unitdir}/%{daemon_name}.service.d/mysql-compat.conf}
%{?with_init_systemd:%{_unitdir}/%{daemon_name}.service}
%{?with_init_sysv:%{_initddir}/%{daemon_name}}
%{_libexecdir}/mysql-prepare-db-dir
@ -1140,14 +1078,10 @@ fi
%{_libexecdir}/mysql-scripts-common
%{?with_init_systemd:%{_tmpfilesdir}/%{name}.conf}
%{?mysqld_unit:%attr(0755,mysql,mysql) %dir %{_localstatedir}/run/%{mysqld_unit}}
%attr(0755,mysql,mysql) %dir %{_localstatedir}/run/%{daemon_name}
%attr(0755,mysql,mysql) %dir %{_localstatedir}/lib/mysql
%attr(0755,mysql,mysql) %dir %{dbdatadir}
%attr(0750,mysql,mysql) %dir %{logfiledir}
%attr(0640,mysql,mysql) %config %ghost %verify(not md5 size mtime) %{logfile}
%if 0%{?old_logfile:1}
%config %ghost %verify(not md5 size mtime) %{old_logfile}
%endif
%config(noreplace) %{logrotateddir}/%{daemon_name}
%if %{with oqgraph}
@ -1199,6 +1133,9 @@ fi
%endif
%changelog
* Fri Dec 05 2014 Honza Horak <hhorak@redhat.com> - 1:10.0.15-2
- Rework usage of macros and remove some compatibility artefacts
* Thu Nov 27 2014 Jakub Dorňák <jdornak@redhat.com> - 1:10.0.15-1
- Update to 10.0.15