diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..32ab765 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/galera-26.4.7.tar.gz diff --git a/.rh-mariadb105-galera.metadata b/.rh-mariadb105-galera.metadata new file mode 100644 index 0000000..bcf1650 --- /dev/null +++ b/.rh-mariadb105-galera.metadata @@ -0,0 +1 @@ +88296dbfb7f63bb1179ed735492742400dfb3374 SOURCES/galera-26.4.7.tar.gz diff --git a/SOURCES/galera-init-start.patch b/SOURCES/galera-init-start.patch new file mode 100644 index 0000000..0facc6f --- /dev/null +++ b/SOURCES/galera-init-start.patch @@ -0,0 +1,19 @@ +Service start reported failure even in case of proper start. It was probably +caused by race condition when the forked process was not ready yet. +Giving an extra second should do the same trick as in case of debian start +script (see different branch in the same function). + +RHBZ: #1466473 + +diff -up galera-3-25.3.12/garb/files/garb.sh.pstart galera-3-25.3.12/garb/files/garb.sh +--- galera-3-25.3.12/garb/files/garb.sh.pstart 2017-07-18 12:41:43.411222266 +0200 ++++ galera-3-25.3.12/garb/files/garb.sh 2017-07-18 12:41:19.559168772 +0200 +@@ -55,6 +55,8 @@ program_start() { + echo -n $"Starting $prog: " + daemon --user nobody $prog "$@" >/dev/null + rcode=$? ++ # Hack: sleep a bit to give garbd some time to fork ++ sleep 2 + if [ $rcode -eq 0 ]; then + pidof $prog > $PIDFILE || rcode=$? + fi diff --git a/SOURCES/galera-paths.patch b/SOURCES/galera-paths.patch new file mode 100644 index 0000000..c2ddaab --- /dev/null +++ b/SOURCES/galera-paths.patch @@ -0,0 +1,90 @@ +diff -up galera-26.4.6/garb/files/garb.service.p2 galera-26.4.6/garb/files/garb.service +--- galera-26.4.6/garb/files/garb.service.p2 2021-01-04 16:45:52.260966357 +0100 ++++ galera-26.4.6/garb/files/garb.service 2021-01-04 16:46:50.010572463 +0100 +@@ -12,7 +12,7 @@ Alias=garbd.service + + [Service] + User=nobody +-ExecStart=/usr/bin/garb-systemd start ++ExecStart=@bindir@/garb-systemd start + + # Use SIGINT because with the default SIGTERM + # garbd fails to reliably transition to 'destroyed' state +diff -up galera-26.4.6/garb/files/garb.sh.p2 galera-26.4.6/garb/files/garb.sh +--- galera-26.4.6/garb/files/garb.sh.p2 2020-10-22 12:19:37.000000000 +0200 ++++ galera-26.4.6/garb/files/garb.sh 2021-01-04 16:42:19.943738004 +0100 +@@ -5,7 +5,7 @@ + # init.d script for garbd + # + # chkconfig: - 99 01 +-# config: /etc/sysconfig/garb | /etc/default/garb ++# config: @sysconfdir@/sysconfig/garb | @sysconfdir@/default/garb + + ### BEGIN INIT INFO + # Provides: garb +@@ -25,10 +25,10 @@ + if [ -f /etc/redhat-release ]; then + . /etc/init.d/functions + . /etc/sysconfig/network +- config=/etc/sysconfig/garb ++ config=@sysconfdir@/sysconfig/garb + else + . /lib/lsb/init-functions +- config=/etc/default/garb ++ config=@sysconfdir@/default/garb + fi + + log_failure() { +@@ -41,9 +41,9 @@ log_failure() { + fi + } + +-PIDFILE=/var/run/garbd ++PIDFILE=/var/run/@scl_prefix@garbd + +-prog=$(which garbd) ++prog="$(scl enable @scl@ -- which garbd)" + + program_start() { + local rcode +@@ -150,6 +150,19 @@ restart() { + start + } + ++# We have to re-enable SCL environment, because /sbin/service ++# clears almost all environment variables. ++# Since X_SCLS is cleared as well, we lose information about other ++# collections enabled. ++source @scl_scripts@/garbd-service-environment ++source scl_source enable $@scl_upper@_SCLS_ENABLED ++ ++# we want start daemon only inside "scl enable" invocation ++if ! scl_enabled @scl@ ; then ++ echo "Collection @scl@ has to be listed in @scl_scripts@/garbd-service-environment" ++ exit 1 ++fi ++ + # See how we were called. + case "$1" in + start) +diff -up galera-26.4.6/garb/files/garb-systemd.p2 galera-26.4.6/garb/files/garb-systemd +--- galera-26.4.6/garb/files/garb-systemd.p2 2021-01-04 16:42:19.943738004 +0100 ++++ galera-26.4.6/garb/files/garb-systemd 2021-01-04 16:44:07.793869930 +0100 +@@ -4,7 +4,7 @@ + if [[ -f /etc/debian_version ]]; then + config=/etc/default/garb + else +- config=/etc/sysconfig/garb ++ config=@sysconfdir@/sysconfig/garb + fi + + log_failure() { +@@ -13,7 +13,7 @@ log_failure() { + + program_start() { + echo "Starting garbd" +- /usr/bin/garbd "$@" ++ scl enable @scl@ -- @bindir@/garbd "$@" + } + + start() { diff --git a/SOURCES/galera-python3.patch b/SOURCES/galera-python3.patch new file mode 100644 index 0000000..59bb4f1 --- /dev/null +++ b/SOURCES/galera-python3.patch @@ -0,0 +1,17 @@ +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 new file mode 100644 index 0000000..6635416 --- /dev/null +++ b/SPECS/galera.spec @@ -0,0 +1,271 @@ +%global scl rh-mariadb105 +%{?scl:%scl_package galera} +%{!?scl:%global pkg_name %{name}} + +%if 0%{?scl:1} +%global scl_upper %{lua:print(string.upper(string.gsub(rpm.expand("%{scl}"), "-", "_")))} +%endif + +%global daemon_name %{?scl_prefix}garbd + +Name: %{?scl_prefix}galera +Version: 26.4.7 +Release: 1%{?dist} +Summary: Synchronous multi-master wsrep provider (replication engine) + +License: GPLv2 +URL: http://galeracluster.com/ +Source0: http://releases.galeracluster.com/source/%{pkg_name}-%{version}.tar.gz +# Actually, the truth is, we do use patched galera source tarball provided by MariaDB on +# following URL (without macros): +# https://mirror.vpsfree.cz/mariadb/mariadb-10.4.11/galera-26.4.3/src/galera-26.4.3.tar.gz + +Patch1: galera-paths.patch +Patch2: galera-init-start.patch +Patch3: galera-python3.patch + +BuildRequires: boost-devel +BuildRequires: check-devel openssl-devel scons + +Requires: nmap-ncat +%{?systemd_requires} + +%description +Galera is a fast synchronous multi-master wsrep provider (replication engine) +for transactional databases and similar applications. For more information +about wsrep API see http://launchpad.net/wsrep. For a description of Galera +replication engine see http://www.codership.com. + +%prep +%setup -q -n %{pkg_name}-%{version} +%patch1 -p1 -b .p2 +%patch2 -p1 +%patch3 -p1 + +%build +for f in garb/files/garb.sh garb/files/garb.service garb/files/garb-systemd ; do + sed -i -e "s|@bindir@|%{_bindir}|g" \ + -e "s|@sbindir@|%{_sbindir}|g" \ + -e "s|@sysconfdir@|%{_sysconfdir}|g" \ + $f +%if 0%{?scl:1} + sed -i -e "s|@scl@|%{scl}|g" \ + -e "s|@scl_prefix@|%{scl_prefix}|g" \ + -e "s|@scl_scripts@|%{?_scl_scripts}|g" \ + -e "s|@scl_upper@|%{scl_upper}|g" \ + $f +%endif +done + +%{?scl:scl enable %{scl} - << "EOF"} +set -xe +export CPPFLAGS="%{optflags}" +scons %{?_smp_mflags} strict_build_flags=0 extra_sysroot=%{_prefix} \ +%if 0%{?rhel} < 7 + bpostatic=%{_libdir}/libboost_program_options.so +%endif + +%{?scl:EOF} + +%install +%{?scl:scl enable %{scl} - << "EOF"} +set -xe +install -D -m 644 garb/files/garb.service %{buildroot}%{_unitdir}/%{daemon_name}.service +install -D -m 755 garb/files/garb-systemd %{buildroot}%{_bindir}/garb-systemd +install -D -m 755 garb/garbd %{buildroot}%{_bindir}/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 +%{?scl:EOF} + +%if 0%{?scl:1} +# generate a configuration file for daemon +cat << EOF | tee -a %{buildroot}%{?_scl_scripts}/garbd-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}/garbd-service-environment. +%{scl_upper}_SCLS_ENABLED="%{scl}" +EOF +%endif #scl + + +%post +/sbin/ldconfig +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +%systemd_post %{daemon_name}.service +%else +/sbin/chkconfig --add %{daemon_name} +%endif + + +%preun +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +%systemd_preun %{daemon_name}.service +%else +if [ "$1" -eq 0 ]; then + /sbin/service %{daemon_name} stop >/dev/null 2>&1 + /sbin/chkconfig --del %{daemon_name} +fi +%endif + + +%postun +/sbin/ldconfig +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +%systemd_postun_with_restart %{daemon_name}.service +%else +if [ "$1" -ge 1 ]; then + /sbin/service %{daemon_name} condrestart >/dev/null 2>&1 || : +fi +%endif + +%files +%config(noreplace,missingok) %{_sysconfdir}/sysconfig/garb +%dir %{_docdir}/galera +%dir %{_libdir}/galera +%{_bindir}/garbd +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +%{_bindir}/garb-systemd +%{_unitdir}/%{daemon_name}.service +%else +%{?scl:%_root_sysconfdir}%{!?scl:%_sysconfdir}/rc.d/init.d/%{daemon_name} +%endif +%if 0%{?scl:1} +%{?_scl_scripts}/garbd-service-environment +%endif +%{_libdir}/galera/libgalera_smm.so +%doc %{_docdir}/galera/COPYING +%doc %{_docdir}/galera/LICENSE.asio +%doc %{_docdir}/galera/README +%doc %{_docdir}/galera/README-MySQL + +%changelog +* Fri Mar 26 2021 Michal Schorm - 26.4.7-1 +- Rebase to 26.4.7 + +* Mon Jan 04 2021 Honza Horak - 26.4.6-1 +- Update to 26.4.6 + Related: #1903659 + +* Wed Nov 04 2020 Michal Schorm - 25.3.31-1 +- Rebase to 25.3.31 + +* Tue Nov 03 2020 Michal Schorm - 25.3.30-1 +- Rebase to 25.3.30 + +* Fri May 15 2020 Michal Schorm - 25.3.29-1 +- Rebase to 25.3.29 + +* Thu Apr 25 2019 Michal Schorm - 25.3.25-1 +- Rebase to 25.3.25 + +* Tue Jan 08 2019 Honza Horak - 25.3.23-2 +- Rebuild for buildroot change + +* Mon Dec 17 2018 Honza Horak - 25.3.23-1 +- Update to 25.3.23 + +* Wed Aug 09 2017 Honza Horak - 25.3.20-3 +- Fix wrong failure reporting during init script start + Related: #1415720 + +* Mon Jun 26 2017 Honza Horak - 25.3.20-2 +- Fix paths in garpd init script and turn on SCL there + Related: #1415720 +- Include garbd-service-environment because the one from mariadb-server + does not need to be installed + +* Mon Jun 19 2017 Honza Horak - 25.3.20-1 +- Rebase to 25.3.20 + +* Thu Apr 21 2016 Honza Horak +- Build with system boost in RHEL-7 + Resolves: #1329175 + +* Thu Feb 11 2016 Honza Horak - 25.3.12-8 +- Rebuild with newer scl-utils + +* Tue Feb 09 2016 Honza Horak - 25.3.12-7 +- Change sysconfdir for scls + +* Tue Feb 09 2016 Honza Horak - 25.3.12-6 +- Fix typo in _syconfig macro + +* Tue Feb 09 2016 Honza Horak - 25.3.12-5 +- Prefix service name with SCL + +* Wed Feb 03 2016 Fedora Release Engineering - 25.3.12-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Fri Jan 15 2016 Jonathan Wakely - 25.3.12-3 +- Rebuilt for Boost 1.60 + +* Wed Sep 30 2015 Marcin Juszkiewicz - 25.3.12-2 +- Remove use of -mtune=native which breaks build on secondary architectures + +* Fri Sep 25 2015 Richard W.M. Jones - 25.3.12-1 +- Update to 25.3.12. +- Should fix the build on 32 bit ARM (RHBZ#1241164). +- Remove ExcludeArch (should have read the BZ more closely). + +* Thu Aug 27 2015 Jonathan Wakely - 25.3.10-5 +- Rebuilt for Boost 1.59 + +* Wed Jul 29 2015 Fedora Release Engineering - 25.3.10-4 +- Rebuilt for https://fedoraproject.org/wiki/Changes/F23Boost159 + +* Wed Jul 22 2015 David Tardon - 25.3.10-3 +- rebuild for Boost 1.58 + +* Wed Jul 08 2015 Ryan O'Hara - 25.3.10-2 +- Disable ARM builds (#1241164, #1239516) + +* Mon Jul 06 2015 Ryan O'Hara - 25.3.10-1 +- Update to version 25.3.10 + +* Wed Jun 17 2015 Fedora Release Engineering - 25.3.5-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon Jan 26 2015 Petr Machata - 25.3.5-10 +- Rebuild for boost 1.57.0 + +* Thu Nov 27 2014 Richard W.M. Jones - 25.3.5-9 +- Add aarch64 support. + +* Sat Aug 16 2014 Fedora Release Engineering - 25.3.5-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 25.3.5-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Fri May 23 2014 Petr Machata - 25.3.5-6 +- Rebuild for boost 1.55.0 + +* Wed Apr 30 2014 Dan HorĂ¡k - 25.3.5-5 +- set ExclusiveArch + +* Thu Apr 24 2014 Ryan O'Hara - 25.3.5-4 +- Use strict_build_flags=0 to avoid -Werror +- Remove unnecessary clean section + +* Thu Apr 24 2014 Ryan O'Hara - 25.3.5-3 +- Include galera directories in file list +- Set CPPFLAGS to optflags + +* Wed Apr 23 2014 Ryan O'Hara - 25.3.5-2 +- Fix client certificate verification (#1090604) + +* Thu Mar 27 2014 Ryan O'Hara - 25.3.5-1 +- Update to version 25.3.5 + +* Mon Mar 24 2014 Ryan O'Hara - 25.3.3-2 +- Add systemd service + +* Sun Mar 09 2014 Ryan O'Hara - 25.3.3-1 +- Initial build