diff --git a/.galera.metadata b/.galera.metadata index bcf1650..26b3560 100644 --- a/.galera.metadata +++ b/.galera.metadata @@ -1 +1 @@ -88296dbfb7f63bb1179ed735492742400dfb3374 SOURCES/galera-26.4.7.tar.gz +3c9925963811319563163a5364c36871ca25c556 SOURCES/galera-26.4.9.tar.gz diff --git a/.gitignore b/.gitignore index 32ab765..ee20991 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/galera-26.4.7.tar.gz +SOURCES/galera-26.4.9.tar.gz diff --git a/SOURCES/cmake_paths.patch b/SOURCES/cmake_paths.patch new file mode 100644 index 0000000..e341b09 --- /dev/null +++ b/SOURCES/cmake_paths.patch @@ -0,0 +1,112 @@ +1) Documentation files + +--- galera-26.4.8/CMakeLists.txt 2021-04-08 08:05:44.000000000 +0200 ++++ galera-26.4.8/CMakeLists.txt_patched 2021-06-10 01:40:26.886770832 +0200 +@@ -106,14 +106,19 @@ add_subdirectory(galera) + add_subdirectory(scripts/packages) + add_subdirectory(wsrep/tests) + ++# Make the intall destination for documentation files configurable ++if(NOT DEFINED INSTALL_DOCDIR) ++ set(INSTALL_DOCDIR "doc" CACHE STRING "path to install documentaion to") ++endif() ++ + if (NOT ${CMAKE_SYSTEM_NAME} MATCHES ".*BSD") + install(FILES + ${CMAKE_SOURCE_DIR}/AUTHORS + ${CMAKE_SOURCE_DIR}/COPYING + ${CMAKE_SOURCE_DIR}/README +- DESTINATION doc) ++ DESTINATION ${INSTALL_DOCDIR} ) + install(FILES ${CMAKE_SOURCE_DIR}/asio/LICENSE_1_0.txt +- DESTINATION doc ++ DESTINATION ${INSTALL_DOCDIR} + RENAME LICENSE.asio) + endif() + + + +2) Configuration file +3) Executable files +4) Systemd service file + +--- galera-26.4.8/garb/CMakeLists.txt 2021-06-10 03:54:55.482520883 +0200 ++++ galera-26.4.8/garb/CMakeLists.txt_patched 2021-06-10 03:54:41.070274710 +0200 +@@ -31,14 +31,51 @@ target_compile_options(garbd + target_link_libraries(garbd gcs4garb gcomm gcache + ${Boost_PROGRAM_OPTIONS_LIBRARIES}) + +-install(TARGETS garbd DESTINATION bin) ++# Make the install destination for garbd binary configurable ++if(NOT DEFINED INSTALL_GARBD) ++ set(INSTALL_GARBD "bin" CACHE STRING "path to install garbd binary to") ++endif() ++ ++install(TARGETS garbd ++ DESTINATION ${INSTALL_GARBD}) ++ + if (NOT ${CMAKE_SYSTEM_NAME} MATCHES ".*BSD") ++ ++ # Make the install destination for garbd-systemd wrapper script configurable ++ if(NOT DEFINED INSTALL_GARBD-SYSTEMD) ++ set(INSTALL_GARBD-SYSTEMD "share" CACHE STRING "path to install garbd-systemd wrapper script to") ++ endif() ++ ++ install(FILES ++ ${CMAKE_CURRENT_SOURCE_DIR}/files/garb-systemd ++ DESTINATION ${INSTALL_GARBD-SYSTEMD}) ++ ++ # Make the install destination for garbd configuration file configurable ++ if(NOT DEFINED INSTALL_CONFIGURATION) ++ set(INSTALL_CONFIGURATION "share" CACHE STRING "path to install garbd configuration to") ++ endif() ++ + install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/files/garb.cnf ++ DESTINATION ${INSTALL_CONFIGURATION} ++ RENAME garb) ++ ++ # Make the install destination for garbd systemd service file configurable ++ if(NOT DEFINED INSTALL_SYSTEMD_SERVICE) ++ set(INSTALL_SYSTEMD_SERVICE "share" CACHE STRING "path to install garbd Systemd service to") ++ endif() ++ ++ install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/files/garb.service +- ${CMAKE_CURRENT_SOURCE_DIR}/files/garb-systemd +- DESTINATION share) ++ DESTINATION ${INSTALL_SYSTEMD_SERVICE}) ++ ++ # Make the install destination for manpage configurable ++ if(NOT DEFINED INSTALL_MANPAGE) ++ set(INSTALL_MANPAGE "man/man8" CACHE STRING "path to install manpage to") ++ endif() ++ + install(FILES + ${CMAKE_SOURCE_DIR}/man/garbd.8 +- DESTINATION man/man8) ++ DESTINATION ${INSTALL_MANPAGE}) ++ + endif() + + + +5) Shared library path + +--- galera-26.4.8/galera/src/CMakeLists.txt 2021-06-10 03:13:05.465005845 +0200 ++++ galera-26.4.8/galera/src/CMakeLists.txt_patched 2021-06-10 03:16:53.388699046 +0200 +@@ -112,7 +112,12 @@ endif() + + target_link_libraries(galera_smm galera ${GALERA_LINK_OPTIONS}) + +-install(TARGETS galera_smm DESTINATION lib) ++# Make the install destination for garbd binary configurable ++if(NOT DEFINED INSTALL_LIBDIR) ++ set(INSTALL_LIBDIR "lib" CACHE STRING "path to install shared libraries to") ++endif() ++ ++install(TARGETS galera_smm DESTINATION ${INSTALL_LIBDIR}) + + # The following checks are guaranteed to work only + # Linux platform, we skip them on others. + diff --git a/SOURCES/galera-python3.patch b/SOURCES/galera-python3.patch deleted file mode 100644 index 59bb4f1..0000000 --- a/SOURCES/galera-python3.patch +++ /dev/null @@ -1,17 +0,0 @@ -Upstream PR: -https://github.com/codership/galera/pull/512 - -diff -up galera-25.3.23/SConstruct.bak galera-25.3.23/SConstruct ---- galera-25.3.23/SConstruct.bak 2018-07-13 15:14:49.059835554 +0200 -+++ galera-25.3.23/SConstruct 2018-07-13 15:19:07.717967794 +0200 -@@ -194,8 +194,8 @@ if link != 'default': - env.Replace(LINK = link) - - # Get compiler name/version, CXX may be set to "c++" which may be clang or gcc --cc_version = str(read_first_line(env['CC'].split() + ['--version'])) --cxx_version = str(read_first_line(env['CXX'].split() + ['--version'])) -+cc_version = str(read_first_line(env['CC'].split() + ['--version']).decode()) -+cxx_version = str(read_first_line(env['CXX'].split() + ['--version']).decode()) - - print('Using C compiler executable: ' + env['CC']) - print('C compiler version is: ' + cc_version) diff --git a/SPECS/galera.spec b/SPECS/galera.spec index bad1079..df741ba 100644 --- a/SPECS/galera.spec +++ b/SPECS/galera.spec @@ -1,6 +1,6 @@ Name: galera -Version: 26.4.7 -Release: 1%{?dist} +Version: 26.4.9 +Release: 4%{?dist} Summary: Synchronous multi-master wsrep provider (replication engine) License: GPLv2 @@ -15,10 +15,12 @@ Source0: http://releases.galeracluster.com/source/%{name}-%{version}.tar. Source1: garbd.service Source2: garbd-wrapper -Patch0: galera-python3.patch +Patch0: cmake_paths.patch -BuildRequires: boost-devel check-devel openssl-devel python3-scons systemd gcc-c++ asio-devel +BuildRequires: boost-devel check-devel openssl-devel cmake systemd gcc-c++ asio-devel +Requires(pre): /usr/sbin/useradd Requires: nmap-ncat +Requires: procps-ng %{?systemd_requires} @@ -37,35 +39,77 @@ replication engine see http://www.codership.com. %build %{set_build_flags} -# Print help: -# scons-3 --help -# scons-3 -H +%cmake . \ + -DCMAKE_BUILD_TYPE="%{?with_debug:Debug}%{!?with_debug:RelWithDebInfo}" \ + -DINSTALL_LAYOUT=RPM \ + -DCMAKE_RULE_MESSAGES:BOOL=OFF \ + \ + -DBUILD_SHARED_LIBS:BOOL=OFF \ + \ + -DINSTALL_DOCDIR="share/doc/%{name}/" \ + -DINSTALL_GARBD="sbin" \ + -DINSTALL_GARBD-SYSTEMD="share/doc/galera" \ + -DINSTALL_CONFIGURATION="/etc/sysconfig/" \ + -DINSTALL_SYSTEMD_SERVICE="share/doc/galera" \ + -DINSTALL_LIBDIR="%{_lib}/galera" \ + -DINSTALL_MANPAGE="share/man/man8" -# Possibly usefull arguments: -# --debug=findlibs -# --debug=stacktrace -# --warn=all -# debug=0 +cmake -B %_vpath_builddir -LAH + +%cmake_build -# Update for 26.4.6: The strict_build_flags FTBFS on armv7hl and i686; fails to find check.h on RHEL -# Update for 26.4.7: The strict_build_flags FTBFS ppc64le, failing tests -%ifarch i686 ppc64le -scons-3 %{?_smp_mflags} strict_build_flags=0 -%else -scons-3 %{?_smp_mflags} strict_build_flags=1 -%endif %install +%cmake_install + +# PATCH 1: +# Change the Systemd service name from "garb" to "garbd" +# +# The Galera upstream uses name "garb" for the service while providing "garbd" alias +# Fedora downstream packaging historically used "garbd" name for the service. +# +# Let's stick with the Fedora legacy naming, AND provide an alias to the Galera upstream name +mv %{buildroot}/usr/share/doc/galera/garb.service %{buildroot}/usr/share/doc/galera/garbd.service +sed -i 's/Alias=garbd.service/Alias=garb.service/g' %{buildroot}/usr/share/doc/galera/garbd.service + +# PATCH 2: +# Fix the hardcoded paths +# In the Systemd service file: +sed -i 's;/usr/bin/garb-systemd;/usr/sbin/garb-systemd;g' %{buildroot}/usr/share/doc/galera/garbd.service +# In the wrapper script: +sed -i 's;/usr/bin/garbd;/usr/sbin/garbd;g' %{buildroot}/usr/share/doc/galera/garb-systemd + +# PATCH 4: +# Use a dedicated user for the Systemd service +# To fix an security issue reported by Systemd: +# +## systemd[1]: /usr/lib/systemd/system/garb.service:14: Special user nobody configured, this is not safe! +## Subject: Special user nobody configured, this is not safe! +## Defined-By: systemd +## Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel +## Documentation: https://systemd.io/UIDS-GIDS +## +## The unit garb.service is configured to use User=nobody. +## +## This is not safe. The nobody user's main purpose on Linux-based +## operating systems is to be the owner of files that otherwise cannot be mapped +## to any local user. It's used by the NFS client and Linux user namespacing, +## among others. By running a unit's processes under the identity of this user +## they might possibly get read and even write access to such files that cannot +## otherwise be mapped. +## +## It is strongly recommended to avoid running services under this user identity, +## in particular on systems using NFS or running containers. Allocate a user ID +## specific to this service, either statically via systemd-sysusers or dynamically +## via the DynamicUser= service setting. +sed -i 's/User=nobody/User=garb/g' %{buildroot}/usr/share/doc/galera/garbd.service + +# Install old service and wrapper to maintain compatibility install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/garbd.service install -D -m 755 %{SOURCE2} %{buildroot}%{_sbindir}/garbd-wrapper -install -D -m 755 garb/garbd %{buildroot}%{_sbindir}/garbd -install -D -m 755 libgalera_smm.so %{buildroot}%{_libdir}/galera/libgalera_smm.so -install -D -m 644 garb/files/garb.cnf %{buildroot}%{_sysconfdir}/sysconfig/garb -install -D -m 644 COPYING %{buildroot}%{_docdir}/galera/COPYING -install -D -m 644 asio/LICENSE_1_0.txt %{buildroot}%{_docdir}/galera/LICENSE.asio -install -D -m 644 scripts/packages/README %{buildroot}%{_docdir}/galera/README -install -D -m 644 scripts/packages/README-MySQL %{buildroot}%{_docdir}/galera/README-MySQL +%pre +/usr/sbin/useradd -M -r -d /dev/null -s /sbin/nologin -c "Galera Arbitrator Daemon" garb >/dev/null 2>&1 || : %post /sbin/ldconfig @@ -81,19 +125,48 @@ install -D -m 644 scripts/packages/README-MySQL %{buildroot}%{_docdir}/galera/RE %files %config(noreplace,missingok) %{_sysconfdir}/sysconfig/garb + %dir %{_docdir}/galera %dir %{_libdir}/galera + %{_sbindir}/garbd %{_sbindir}/garbd-wrapper + +# PATCH 3: +# Make sure the wrapper script is executable +%attr(755, -, -) %{_docdir}/galera/garb-systemd + +%{_mandir}/man8/garbd.8* + %{_unitdir}/garbd.service +%{_docdir}/galera/garbd.service + %{_libdir}/galera/libgalera_smm.so + +%doc %{_docdir}/galera/AUTHORS %doc %{_docdir}/galera/COPYING %doc %{_docdir}/galera/LICENSE.asio %doc %{_docdir}/galera/README -%doc %{_docdir}/galera/README-MySQL +#%doc %{_docdir}/galera/README-MySQL %changelog +* Fri Jan 28 2022 Lukas Javorsky - 26.4.9-4 +- Use downstream garbd-wrapper and garbd.service to ensure compatibility +- Add upstream versions of garbd-wrapper (called garbd-systemd) and garbd.service + in case user want's to use them + +* Wed Jan 19 2022 Lukas Javorsky - 26.4.9-3 +- Explicitly require the 'procps-ng' package +- Otherwise it will not require it in the lightweight systems (e.g. containers) +- and Galera won't work properly + +* Wed Jan 19 2022 Michal Schorm - 26.4.9-2 +- Switch from SCONS build tooling to CMAKE build tooling + +* Wed Jan 19 2022 Lukas Javorsky - 26.4.9-1 +- Rebase to 26.4.9 + * Mon Mar 22 2021 Michal Schorm - 26.4.7-1 - Rebase to 26.4.7