#6 Align the RHEL mysql spec with Fedora community-mysql spec
Opened 8 months ago by ljavorsk. Modified 8 months ago
rpms/ ljavorsk/community-mysql rawhide  into  rawhide

file modified
+298 -31
@@ -2,6 +2,10 @@ 

  #   So the beaviour will be the same also in F31 nad F32

  %undefine __cmake_in_source_build

  

+ # SCL stuff

+ %{?scl:%scl_package mysql}

+ %{!?scl:%global pkg_name %{name}}

+ 

  # Name of the package without any prefixes

  %global pkg_name %{name}

  %global pkgnamepatch community-mysql
@@ -28,6 +32,9 @@ 

  %global _pkgdocdirname %{pkg_name}%{!?_pkgdocdir:-%{version}}

  %{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{pkg_name}-%{version}}

  

+ # Define macro on systems on which it is unknown

+ %{!?build_ldflags:%global build_ldflags -Wl,-z,relro,-z,now}

+ 

  # By default, patch(1) creates backup files when chunks apply with offsets.

  # Turn that off to ensure such files don't get included in RPMs (cf bz#884755).

  %global _default_patch_flags --no-backup-if-mismatch
@@ -35,7 +42,11 @@ 

  %global skiplist platform-specific-tests.list

  

  # For some use cases we do not need some parts of the package

+ %if 0%{?scl:1}

+ %bcond_with clibrary

+ %else

  %bcond_without clibrary

+ %endif

  %bcond_without devel

  %bcond_without client

  %bcond_without common
@@ -45,23 +56,75 @@ 

  # 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

+ %if 0%{?scl:1}

+ %bcond_without config

+ %else

  %bcond_with config

+ %endif

  

  # For deep debugging we need to build binaries with extra debug info

  %bcond_with debug

  

  %global boost_bundled_version 1.73.0

  

- # Include files for systemd

- %global daemon_name mysqld

+ %if 0%{?fedora}

+ %bcond_with bundled_icu

+ %else

+ %bcond_without bundled_icu

+ %endif

+ %global icu_bundled_version 65.1.0

+ 

+ %if 0%{?fedora} >= 26 || 0%{?rhel} > 7

+ %bcond_with bundled_protobuf

+ %else

+ %bcond_without bundled_protobuf

+ %endif

+ %global protobuf_bundled_version 3.11.4

+ 

+ # Mysql 8.0.21 needs libevent version >2.1 and rhel-7 provides 2.0

+ # Also since Mysql 8.0.18, libzstd is required, but it's not in rhel until version 8

+ # thus we need to use bundled libraries

+ %if 0%{?scl:1} || 0%{?rhel} <= 7

+ %bcond_without bundled_libevent

+ %bcond_without bundled_zstd

+ %else

+ %bcond_with bundled_libevent

+ %bcond_with bundled_zstd

+ %endif

+ %global zstd_bundled_version 1.4.3

+ %global libevent_bundled_version 2.1.11

+ 

+ # Include files for SysV init or systemd

+ %if 0%{?fedora} >= 15 || 0%{?rhel} >= 7

+ %bcond_without init_systemd

+ %bcond_with init_sysv

+ %global daemondir %{_unitdir}

+ %else

+ %bcond_with init_systemd

+ %bcond_without init_sysv

+ %global daemondir %{_sysconfdir}/rc.d/init.d

+ %endif

+ %global daemon_name %{?scl_prefix}mysqld

  %global daemon_no_prefix mysqld

  

+ %{?scl:%global se_daemon_source %{_unitdir}/mysqld}

+ 

  # Directory for storing pid file

+ %if 0%{?rhel} == 6

+ %global pidfiledir %{_localstatedir}/run/%{daemon_name}

+ %else

  %global pidfiledir %{_rundir}/%{daemon_name}

+ %endif

  

  # We define some system's well known locations here so we can use them easily

  # later when building to another location (like SCL)

+ %if 0%{?scl:1}

+ %global logrotateddir %{_root_sysconfdir}/logrotate.d

+ %global selinux_packages_dir %{_root_datadir}/selinux/packages

+ %else

  %global logrotateddir %{_sysconfdir}/logrotate.d

+ %global selinux_packages_dir %{_datadir}/selinux/packages

+ %endif

  %global logfiledir %{_localstatedir}/log/mysql

  %global logfile %{logfiledir}/%{daemon_no_prefix}.log

  
@@ -72,12 +135,21 @@ 

  %global mysqluserhome /var/lib/mysql

  

  # Provide mysql names for compatibility

+ %if 0%{?scl:1}

+ %bcond_with mysql_names

+ %bcond_with conflicts

+ %else

  %bcond_without mysql_names

  %bcond_without conflicts

+ %endif

  

  # Make long macros shorter

  %global sameevr   %{?epoch:%{epoch}:}%{version}-%{release}

  

+ %if 0%{?scl:1}

+ %global scl_upper %{lua:print(string.upper(string.gsub(rpm.expand("%{scl}"), "-", "_")))}

+ %endif

+ 

  Name:             community-mysql

  Version:          8.0.24

  Release:          1%{?with_debug:.debug}%{?dist}
@@ -130,15 +202,21 @@ 

  Patch115: boost-1.58.0-pool.patch

  Patch125: boost-1.57.0-mpl-print.patch

  

- BuildRequires:    cmake

+ # mysql 8.0.17 and newer requires cmake 3.5.1 and higher, so we can use cmake from llvm scl

+ %if 0%{?rhel} == 7 && 0%{?scl:1}

+ %global llvm llvm-toolset-7.0

+ %endif

+ BuildRequires:    %{?llvm:%llvm-}cmake

  BuildRequires:    gcc-c++

  BuildRequires:    libaio-devel

  BuildRequires:    libedit-devel

  BuildRequires:    libevent-devel

+ %if %{without bundled_icu}

  BuildRequires:    libicu-devel

- BuildRequires:    lz4

- BuildRequires:    lz4-devel

- BuildRequires:    mecab-devel

+ %endif

+ BuildRequires:    %{?scl_prefix}lz4

+ BuildRequires:    %{?scl_prefix}lz4-devel

+ BuildRequires:    %{?scl_prefix}mecab-devel

  BuildRequires:    bison

  BuildRequires:    libzstd-devel

  BuildRequires:    libcurl-devel
@@ -147,15 +225,17 @@ 

  %endif

  BuildRequires:    openssl

  BuildRequires:    openssl-devel

- %if 0%{?fedora} || 0%{?rhel} > 7

+ %if 0%{?fedora} > 24 || 0%{?rhel} > 7

  BuildRequires:    perl-interpreter

  BuildRequires:    perl-generators

  %endif

- %if 0%{?fedora} || 0%{?rhel} > 7

+ %if 0%{?fedora} > 27 || 0%{?rhel} > 7

  BuildRequires:    rpcgen

  BuildRequires:    libtirpc-devel

  %endif

+ %if %{without bundled_protobuf}

  BuildRequires:    protobuf-lite-devel

+ %endif

  BuildRequires:    rapidjson-devel

  BuildRequires:    zlib

  BuildRequires:    zlib-devel
@@ -203,11 +283,33 @@ 

  BuildRequires:    perl(warnings)

  BuildRequires:    systemd

  BuildRequires:    make

+ %{?with_init_systemd:BuildRequires: systemd}

+ # libzstd

+ %{!?with_bundled_zstd:BuildRequires: libzstd-devel}

+ # libevent

+ %{?with_bundled_libevent:Provides: bundled(libevent) = %{libevent_bundled_version}}

+ %{!?with_bundled_libevent:BuildRequires: libevent-devel}

+ 

+ # aarch64 requires newer gcc

+ %if 0%{?rhel} == 7 && 0%{?scl:1}

+ %global dts devtoolset-7

+ BuildRequires:    %{dts}-gcc-c++

+ %endif

  

  Requires:         bash coreutils grep

  Requires:         %{name}-common%{?_isa} = %{sameevr}

+ %{?scl:Requires:%scl_runtime}

  

  Provides:         bundled(boost) = %{boost_bundled_version}

+ %if %{with bundled_protobuf}

+ Provides:         bundled(protobuf) = %{protobuf_bundled_version}

+ %endif

+ %if %{with bundled_icu}

+ Provides:         bundled(icu) = %{icu_bundled_version}

+ %endif

+ %if %{with bundled_zstd}

+ Provides:         bundled(zstd) = %{zstd_bundled_version}

+ %endif

  

  %if %{with mysql_names}

  Provides:         mysql = %{sameevr}
@@ -219,8 +321,14 @@ 

  %{?with_conflicts:Conflicts:        mariadb}

  

  # Filtering: https://fedoraproject.org/wiki/Packaging:AutoProvidesAndRequiresFiltering

+ %if 0%{?fedora} > 14 || 0%{?rhel} > 6

  %global __requires_exclude ^perl\\((hostnames|lib::mtr|lib::v1|mtr_|My::)

  %global __provides_exclude_from ^(%{_datadir}/(mysql|mysql-test)/.*|%{_libdir}/mysql/plugin/.*\\.so)$

+ %else

+ %filter_from_requires /perl(\(hostnames\|lib::mtr\|lib::v1\|mtr_\|My::\)/d

+ %filter_provides_in -P (%{_datadir}/(mysql|mysql-test)/.*|%{_libdir}/mysql/plugin/.*\.so)

+ %filter_setup

+ %endif

  

  %description

  MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
@@ -233,6 +341,7 @@ 

  %package          libs

  Summary:          The shared libraries required for MySQL clients

  Requires:         %{name}-common%{?_isa} = %{sameevr}

+ %{?scl:Requires:%scl_runtime}

  %if %{with mysql_names}

  Provides:         mysql-libs = %{sameevr}

  Provides:         mysql-libs%{?_isa} = %{sameevr}
@@ -249,6 +358,7 @@ 

  %if %{with config}

  %package          config

  Summary:          The config files required by server and client

+ %{?scl:Requires:%scl_runtime}

  

  %description      config

  The package provides the config file my.cnf and my.cnf.d directory used by any
@@ -262,6 +372,7 @@ 

  %package          common

  Summary:          The shared files required for MySQL server and client

  Requires:         %{_sysconfdir}/my.cnf

+ %{?scl:Requires:%scl_runtime}

  

  %description      common

  The mysql-common package provides the essential shared files for any
@@ -274,6 +385,7 @@ 

  %package          errmsg

  Summary:          The error messages files required by MySQL server

  Requires:         %{name}-common%{?_isa} = %{sameevr}

+ %{?scl:Requires:%scl_runtime}

  

  %description      errmsg

  The package provides error messages files for the MySQL daemon
@@ -284,24 +396,33 @@ 

  Summary:          The MySQL server and related files

  

  # Require any mysql client, but prefer community-mysql client for community-mysql server

+ %if 0%{?fedora} || 0%{?rhel} > 7

  Suggests:         %{name}%{?_isa} = %{sameevr}

- Requires:         mysql%{?_isa}

+ %endif

+ Requires:         %{?scl_prefix}mysql%{?_isa}

+ 

  

  Requires:         %{name}-common%{?_isa} = %{sameevr}

  Requires:         %{_sysconfdir}/my.cnf

  Requires:         %{_sysconfdir}/my.cnf.d

  Requires:         %{name}-errmsg%{?_isa} = %{sameevr}

- %{?mecab:Requires: mecab-ipadic}

+ %{?mecab:Requires: %{?scl_prefix}mecab-ipadic}

  Requires:         coreutils

  Requires(pre):    /usr/sbin/useradd

+ %if %{with init_systemd}

  # We require this to be present for %%{_tmpfilesdir}

  Requires:         systemd

  # Make sure it's there when scriptlets run, too

  %{?systemd_requires: %systemd_requires}

- # SYS_NICE capabilities; #1540946

- Recommends:       libcap

  # semanage

+ %if 0%{?fedora} >= 26 || 0%{?rhel} > 7

  Requires(post):   policycoreutils-python-utils

+ %else

+ Requires(post):   policycoreutils-python

+ %endif

+ %{?scl:Requires:%scl_runtime}

+ %{?scl:BuildRequires: scl-utils-build-helpers}

+ %endif

  

  # Aditional SELinux rules (common for MariaDB & MySQL) shipped in a separate package

  # For cases, where we want to fix a SELinux issues in MySQL sooner than patched selinux-policy-targeted package is released
@@ -331,8 +452,10 @@ 

  %{?with_clibrary:Requires:         %{name}-libs%{?_isa} = %{sameevr}}

  Requires:         openssl-devel

  Requires:         zlib-devel

- Requires:         libzstd-devel

+ 

+ %{!?with_bundled_zstd:Requires:     libzstd-devel}

  %{?with_conflicts:Conflicts:        mariadb-devel}

+ %{?scl:Requires:%scl_runtime}

  

  %description      devel

  MySQL is a multi-user, multi-threaded SQL database server. This
@@ -347,7 +470,7 @@ 

  Requires:         %{name}-common%{?_isa} = %{sameevr}

  Requires:         %{name}-server%{?_isa} = %{sameevr}

  Requires:         gzip

- Requires:         lz4

+ Requires:         %{?scl_prefix}lz4

  Requires:         openssl

  Requires:         perl(Digest::file)

  Requires:         perl(Digest::MD5)
@@ -367,6 +490,7 @@ 

  Requires:         perl(Test::More)

  Requires:         perl(Time::HiRes)

  %{?with_conflicts:Conflicts:        mariadb-test}

+ %{?scl:Requires:%scl_runtime}

  %if %{with mysql_names}

  Provides:         mysql-test = %{sameevr}

  Provides:         mysql-test%{?_isa} = %{sameevr}
@@ -378,6 +502,11 @@ 

  the MySQL sources.

  %endif

  

+ %if 0%{?scl:1}

+ %scl_syspaths_package -d

+ %scl_syspaths_package config -d

+ %scl_syspaths_package server -d

+ %endif

  

  %prep

  %setup -q -n mysql-%{version}
@@ -399,7 +528,12 @@ 

  %patch125 -p1

  popd

  

- 

+ # check that we have correct versions in bundled(*) Provides above (boost checked with pushd above)

+ # Let's check the version in Provides even if we build without bundled, to keep SPEC valid generally

+ test "$(grep -e '^#define ZSTD_VERSION_\(MAJOR\|MINOR\|RELEASE\)' extra/zstd/lib/zstd.h | awk '{print $3}' | xargs | sed -e 's/ /./g')" == "%{zstd_bundled_version}"

+ test "$(grep -e '^#define U_ICU_VERSION_\(MAJOR\|MINOR\|PATCHLEVEL_NUM\)' extra/icu/source/common/unicode/uvernum.h| awk '{print $3}' | xargs | sed -e 's/ /./g')" == "%{icu_bundled_version}"

+ test -f extra/protobuf/protobuf-%{protobuf_bundled_version}/src/google/protobuf/port_def.inc

+ test -f extra/libevent/libevent-%{libevent_bundled_version}-stable/CMakeLists.txt

  

  # generate a list of tests that fail, but are not disabled by upstream

  cat %{SOURCE50} | tee -a mysql-test/%{skiplist}
@@ -438,6 +572,8 @@ 

      fi

  %endif

  

+ %{?scl:scl enable %{scl} %{?dts} %{?llvm} - << \EOF}

+ 

  # The INSTALL_xxx macros have to be specified relative to CMAKE_INSTALL_PREFIX

  # so we can't use %%{_datadir} and so forth here.

  %cmake \
@@ -446,6 +582,11 @@ 

           -DINSTALL_LAYOUT=RPM \

           -DDAEMON_NAME="%{daemon_name}" \

           -DDAEMON_NO_PREFIX="%{daemon_no_prefix}" \

+ %if 0%{?scl:1}

+          -DSCL_NAME="%{?scl}" \

+          -DSCL_NAME_UPPER="%{?scl_upper}" \

+          -DSCL_SCRIPTS="%{?_scl_scripts}" \

+ %endif

           -DLOG_LOCATION="%{logfile}" \

           -DPID_FILE_DIR="%{pidfiledir}" \

           -DNICE_PROJECT_NAME="MySQL" \
@@ -468,9 +609,11 @@ 

           -DMYSQL_DATADIR="%{dbdatadir}" \

           -DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \

           -DENABLED_LOCAL_INFILE=ON \

+ %if %{with init_systemd}

           -DWITH_SYSTEMD=1 \

           -DSYSTEMD_SERVICE_NAME="%{daemon_name}" \

           -DSYSTEMD_PID_DIR="%{pidfiledir}" \

+ %endif

           -DWITH_INNODB_MEMCACHED=ON \

  %ifnarch aarch64 %{arm} s390 s390x

           -DWITH_NUMA=ON \
@@ -478,10 +621,22 @@ 

  %ifarch s390 s390x armv7hl

           -DUSE_LD_GOLD=OFF \

  %endif

-          -DWITH_ROUTER=OFF \

           -DWITH_SYSTEM_LIBS=ON \

+ %if %{with bundled_icu}

+          -DWITH_ICU=bundled \

+ %endif

+ %if %{with bundled_protobuf}

+          -DWITH_PROTOBUF=bundled \

+ %endif

+          -DWITH_ROUTER=OFF \

           -DWITH_MECAB=system \

           -DWITH_BOOST=boost \

+  %if %{with bundled_zstd}

+          -DWITH_ZSTD="bundled" \

+ %endif

+ %if %{with bundled_libevent}

+          -DWITH_LIBEVENT="bundled" \

+ %endif

           -DREPRODUCIBLE_BUILD=OFF \

           -DCMAKE_C_FLAGS="%{optflags}%{?with_debug: -fno-strict-overflow -Wno-unused-result -Wno-unused-function -Wno-unused-but-set-variable}" \

           -DCMAKE_CXX_FLAGS="%{optflags}%{?with_debug: -fno-strict-overflow -Wno-unused-result -Wno-unused-function -Wno-unused-but-set-variable}" \
@@ -521,15 +676,27 @@ 

  install -p -m 0750 -d %{buildroot}%{_localstatedir}/lib/mysql-files

  install -p -m 0700 -d %{buildroot}%{_localstatedir}/lib/mysql-keyring

  

+ # create directory for socket

+ %{?scl:install -p -m 0755 -d %{buildroot}/var/lib/mysql}

+ 

  %if %{with config}

  install -D -p -m 0644 %{_vpath_builddir}/scripts/my.cnf %{buildroot}%{_sysconfdir}/my.cnf

  %endif

  

  # install systemd unit files and scripts for handling server startup

- install -D -p -m 644 %{_vpath_builddir}/scripts/mysql.service %{buildroot}%{_unitdir}/%{daemon_name}.service

- install -D -p -m 644 %{_vpath_builddir}/scripts/mysql@.service %{buildroot}%{_unitdir}/%{daemon_name}@.service

+ %if %{with init_systemd}

+ install -D -p -m 644 %{_vpath_builddir}/scripts/mysql.service %{buildroot}%{daemondir}/%{daemon_name}.service

+ install -D -p -m 644 %{_vpath_builddir}/scripts/mysql@.service %{buildroot}%{daemondir}/%{daemon_name}@.service

  install -D -p -m 0644 %{_vpath_builddir}/scripts/mysql.tmpfiles.d %{buildroot}%{_tmpfilesdir}/%{daemon_name}.conf

  rm -r %{buildroot}%{_tmpfilesdir}/mysql.conf

+ %endif

+ 

+ # install SysV init script

+ %if %{with init_sysv}

+ install -D -p -m 755 scripts/mysql.init %{buildroot}%{daemondir}/%{daemon_name}

+ install -p -m 755 scripts/mysql-wait-ready %{buildroot}%{_libexecdir}/mysql-wait-ready

+ %endif

+ 

  

  # helper scripts for service starting

  install -D -p -m 755 %{_vpath_builddir}/scripts/mysql-prepare-db-dir %{buildroot}%{_libexecdir}/mysql-prepare-db-dir
@@ -546,14 +713,21 @@ 

  mv %{buildroot}%{_datadir}/%{pkg_name}/mysql-log-rotate %{buildroot}%{logrotateddir}/%{daemon_name}

  chmod 644 %{buildroot}%{logrotateddir}/%{daemon_name}

  

+ # Add collection prefix to the packageconfig provides

+ %if 0%{?scl:1}

+ mv %{buildroot}%{_libdir}/pkgconfig/mysqlclient.pc %{buildroot}%{_libdir}/pkgconfig/%{?scl_prefix}mysqlclient.pc

+ %endif

+ 

+ %if %{with clibrary} && 0%{!?scl:1}

  mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d

  echo "%{_libdir}/mysql" > %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf

+ %endif

  

  # for back-ward compatibility and SELinux, let's keep the mysqld in libexec

  # and just create a symlink in /usr/sbin

  mv %{buildroot}%{_bindir}/mysqld %{buildroot}%{_libexecdir}/mysqld

  mkdir -p %{buildroot}%{_sbindir}

- ln -s ../libexec/mysqld %{buildroot}%{_sbindir}/mysqld

+ ln -s %{_libexecdir}/mysqld %{buildroot}%{_sbindir}/mysqld

  

  %if %{with debug}

  mv %{buildroot}%{_bindir}/mysqld-debug %{buildroot}%{_libexecdir}/mysqld
@@ -569,14 +743,16 @@ 

  %if %{without clibrary}

  unlink %{buildroot}%{_libdir}/mysql/libmysqlclient.so

  rm -r %{buildroot}%{_libdir}/mysql/libmysqlclient*.so.*

+ %if 0%{!?scl:1}

  rm -r %{buildroot}%{_sysconfdir}/ld.so.conf.d

  %endif

+ %endif

  

  %if %{without devel}

  rm %{buildroot}%{_bindir}/mysql_config*

  rm -r %{buildroot}%{_includedir}/mysql

  rm %{buildroot}%{_datadir}/aclocal/mysql.m4

- rm %{buildroot}%{_libdir}/pkgconfig/mysqlclient.pc

+ rm %{buildroot}%{_libdir}/pkgconfig/%{?scl_prefix}mysqlclient.pc

  rm %{buildroot}%{_libdir}/mysql/libmysqlclient*.so

  rm %{buildroot}%{_mandir}/man1/mysql_config.1*

  %endif
@@ -612,9 +788,59 @@ 

  rm -r %{buildroot}%{_datadir}/mysql-test

  %endif

  

+ %{?scl:EOF}

+ 

+ %if 0%{?scl:1}

+ # generate a configuration file for daemon

+ cat << EOF | tee -a %{buildroot}%{?_scl_scripts}/service-environment

+ # Services are started in a fresh environment without any influence of user's

+ # environment (like environment variable values). As a consequence,

+ # information of all enabled collections will be lost during service start up.

+ # If user needs to run a service under any software collection enabled, this

+ # collection has to be written into %{scl_upper}_SCLS_ENABLED variable

+ # in %{?_scl_scripts}/service-environment.

+ %{scl_upper}_SCLS_ENABLED="%{scl}"

+ EOF

+ 

+ # Creating syspath without prefix for mysql-config package

+ %scl_syspaths_install_wrapper -n mysql-config -m link %{_sysconfdir}/my.cnf %{_root_sysconfdir}/%{scl_prefix}my.cnf

+ %scl_syspaths_install_wrapper -n mysql-config -m link %{_sysconfdir}/my.cnf.d %{_root_sysconfdir}/%{scl_prefix}my.cnf.d

  

+ # Creating syspath without prefix for mysql package

+ mysql_binaries='mysql mysql_config_editor mysqladmin mysqlbinlog mysqlcheck mysqldump

+ mysqlimport mysqlpump mysqlshow mysqlslap'

+ 

+ %scl_syspaths_install_wrappers -n mysql -m script -p bin $mysql_binaries

+ 

+ mans= ; for bin in $mysql_binaries; do mans+=" man1/$bin.1.gz" ; done

+ %scl_syspaths_install_wrappers -n mysql -m link -p man $mans

+ 

+ # Creating syspath without prefix for mysql-server package

+ mysql_server_binaries='ibd2sdi innochecksum my_print_defaults myisam_ftdump

+ myisamchk myisamlog myisampack mysql_secure_installation mysql_ssl_rsa_setup

+ mysql_tzinfo_to_sql mysql_upgrade mysqldumpslow perror'

+ 

+ %scl_syspaths_install_wrappers -n mysql-server -m script -p bin $mysql_server_binaries

+ 

+ mans= ; for bin in $mysql_server_binaries; do mans+=" man1/$bin.1.gz" ; done

+ %scl_syspaths_install_wrappers -n mysql-server -m link -p man $mans

+ 

+ %scl_syspaths_install_wrapper -n mysql-server -m link %{logfiledir} %{_root_localstatedir}/log/%{scl_prefix}mysql

+ %scl_syspaths_install_wrapper -n mysql-server -m link %{dbdatadir} %{_root_localstatedir}/lib/%{scl_prefix}mysql

+ 

+ %if %{with init_systemd}

+ %scl_syspaths_install_wrapper -n mysql-server -m link %{daemondir}/%{daemon_name}.service %{daemondir}/%{daemon_no_prefix}.service

+ %scl_syspaths_install_wrapper -n mysql-server -m link %{daemondir}/%{daemon_name}@.service %{daemondir}/%{daemon_no_prefix}@.service

+ %endif

+ 

+ %if %{with init_sysv}

+ %scl_syspaths_install_wrapper -n mysql-server -m link %{daemondir}/%{daemon_name} %{daemondir}/%{daemon_no_prefix}

+ %endif

+ %endif #scl

  

  %check

+ %{?scl:scl enable %{scl} %{?dts} - << \EOF}

+ 

  %if %{with test}

  %if %runselftest

  pushd %_vpath_builddir
@@ -663,7 +889,7 @@ 

  %endif

  %endif

  

- 

+ %{?scl:EOF}

  

  %pre server

  /usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
@@ -671,18 +897,38 @@ 

    -c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :

  

  %post server

+ %if %{with init_systemd}

  %systemd_post %{daemon_name}.service

+ %endif

+ %if %{with init_sysv}

+ if [ $1 = 1 ]; then

+     /sbin/chkconfig --add %{daemon_name}

+ fi

+ %endif

  if [ ! -e "%{logfile}" -a ! -h "%{logfile}" ] ; then

      install /dev/null -m0640 -omysql -gmysql "%{logfile}"

  fi

  

  %preun server

+ %if %{with init_systemd}

  %systemd_preun %{daemon_name}.service

+ %endif

+ %if %{with init_sysv}

+ if [ $1 = 0 ]; then

+     /sbin/service %{daemon_name} stop >/dev/null 2>&1

+     /sbin/chkconfig --del %{daemon_name}

+ fi

+ %endif

  

  %postun server

+ %if %{with init_systemd}

  %systemd_postun_with_restart %{daemon_name}.service

- 

- 

+ %endif

+ %if %{with init_sysv}

+ if [ $1 -ge 1 ]; then

+     /sbin/service %{daemon_name} condrestart >/dev/null 2>&1 || :

+ fi

+ %endif

  

  %if %{with client}

  %files
@@ -712,7 +958,7 @@ 

  %if %{with clibrary}

  %files libs

  %{_libdir}/mysql/libmysqlclient*.so.*

- %config(noreplace) %{_sysconfdir}/ld.so.conf.d/*

+ %{!?scl:%config(noreplace) %{_sysconfdir}/ld.so.conf.d/*}

  %endif

  

  %if %{with config}
@@ -775,16 +1021,24 @@ 

  %{_bindir}/mysql_ssl_rsa_setup

  %{_bindir}/mysql_tzinfo_to_sql

  %{_bindir}/mysql_upgrade

- %{_bindir}/mysqld_pre_systemd

+ %{_sbindir}/mysqld

+ # sys_nice capability required for rhbz#1628814

+ %caps(cap_sys_nice=ep) %{_libexecdir}/mysqld

+ %if %{with init_systemd}

+  %{_bindir}/mysqld_pre_systemd

+ %else

+ %{_bindir}/mysqld_multi

+ %{_bindir}/mysqld_safe

+ %endif

  %{_bindir}/mysqldumpslow

  %{_bindir}/innochecksum

  %{_bindir}/perror

  

  %config(noreplace) %{_sysconfdir}/my.cnf.d/%{pkg_name}-server.cnf

  

- %{_sbindir}/mysqld

- # sys_nice capability required for rhbz#1628814

- %caps(cap_sys_nice=ep) %{_libexecdir}/mysqld

+ %if %{with init_systemd} && 0%{?scl:1}

+ %{_libexecdir}/mysqld-scl-helper

+ %endif

  

  %{_libdir}/mysql/INFO_SRC

  %{_libdir}/mysql/INFO_BIN
@@ -826,6 +1080,11 @@ 

  %{_libdir}/mysql/plugin/validate_password.so

  %{_libdir}/mysql/plugin/version_token.so

  

+ %if %{with bundled_protobuf}

+ %{_libdir}/mysql/private/libprotobuf-lite.so.*

+ %{_libdir}/mysql/private/libprotobuf.so.*

+ %endif

+ 

  %{_mandir}/man1/ibd2sdi.1*

  %{_mandir}/man1/myisamchk.1*

  %{_mandir}/man1/myisamlog.1*
@@ -846,14 +1105,15 @@ 

  %{_datadir}/%{pkg_name}/dictionary.txt

  %{_datadir}/%{pkg_name}/*.sql

  

- %{_unitdir}/%{daemon_name}*

+ %{daemondir}/%{daemon_name}*

  %{_libexecdir}/mysql-prepare-db-dir

  %{_libexecdir}/mysql-wait-stop

  %{_libexecdir}/mysql-check-socket

  %{_libexecdir}/mysql-scripts-common

  

- %{_tmpfilesdir}/%{daemon_name}.conf

+ %{?with_init_systemd:%{_tmpfilesdir}/%{daemon_name}.conf}

  %attr(0755,mysql,mysql) %dir %{dbdatadir}

+ %{?scl:%attr(0755,mysql,mysql) %dir /var/lib/mysql}

  %attr(0750,mysql,mysql) %dir %{_localstatedir}/lib/mysql-files

  %attr(0700,mysql,mysql) %dir %{_localstatedir}/lib/mysql-keyring

  %attr(0755,mysql,mysql) %dir %{pidfiledir}
@@ -861,6 +1121,8 @@ 

  %attr(0640,mysql,mysql) %config %ghost %verify(not md5 size mtime) %{logfile}

  %config(noreplace) %{logrotateddir}/%{daemon_name}

  

+ %{?scl:%config(noreplace) %{?_scl_scripts}/service-environment}

+ 

  %if %{with devel}

  %files devel

  %{_bindir}/mysql_config*
@@ -870,7 +1132,7 @@ 

  %if %{with clibrary}

  %{_libdir}/mysql/libmysqlclient.so

  %endif

- %{_libdir}/pkgconfig/mysqlclient.pc

+ %{_libdir}/pkgconfig/%{?scl_prefix}mysqlclient.pc

  %{_mandir}/man1/mysql_config.1*

  %endif

  
@@ -887,6 +1149,11 @@ 

  %attr(-,mysql,mysql) %{_datadir}/mysql-test

  %{_mandir}/man1/zlib_decompress.1*

  

+ %if 0%{?scl:1}

+ %scl_syspaths_files -n mysql

+ %scl_syspaths_files -n mysql-config

+ %scl_syspaths_files -n mysql-server

+ %endif

  %dir %{_libdir}/mysql/plugin

  %{_libdir}/mysql/plugin/auth.so

  %{_libdir}/mysql/plugin/auth_test_plugin.so

It doesn't align them perfectly, however, all the lines we can safely align we should, so we have fewer diffs between these two spec files, and applying the Fedora patches to RHEL will be easier

16 new commits added

  • Align files phase with RHEL repo
  • Align server post, preun and postun phases with RHEL repo
  • Align install and check phase with RHEL repo
  • Align build phase with RHEL repo
  • Align check for correct versions of bundled libs with RHEL repo
  • Align scl syspaths with RHEL repo
  • Align test subpackage Requires with RHEL repo
  • Align devel subpackage Requires with RHEL repo
  • Align server subpackage Requires with RHEL repo
  • Align errmsg subpackage Requires with RHEL repo
  • Align common subpackage Requires with RHEL repo
  • Align config subpackage Requires with RHEL repo
  • Align libs subpackage Requires with RHEL repo
  • Align filtering with RHEL repo
  • Align package BuildRequires with RHEL repo
  • Align global variables in spec with RHEL repo
8 months ago
Metadata