91a063
Name:           galera
b0b44b
Version:        25.3.34
b0b44b
Release:        4%{?dist}
91a063
Summary:        Synchronous multi-master wsrep provider (replication engine)
91a063
91a063
License:        GPLv2
91a063
URL:            http://galeracluster.com/
91a063
91a063
# Actually, the truth is, we do use galera source tarball provided by MariaDB on
91a063
# following URL (without macros):
b0b44b
#   https://archive.mariadb.org/mariadb-10.3.32/galera-25.3.34/src/galera-25.3.34.tar.gz
91a063
91a063
Source0:        http://releases.galeracluster.com/source/%{name}-%{version}.tar.gz
91a063
91a063
Source1:        garbd.service
91a063
Source2:        garbd-wrapper
91a063
b0b44b
Patch0:         cmake_paths.patch
91a063
b0b44b
BuildRequires:  boost-devel check-devel openssl-devel cmake systemd gcc-c++ asio-devel
b0b44b
Requires(pre):  /usr/sbin/useradd
91a063
Requires:       nmap-ncat
b0b44b
Requires:       procps-ng
91a063
91a063
91a063
Requires(post): systemd
91a063
Requires(preun): systemd
91a063
Requires(postun): systemd
91a063
91a063
91a063
%description
91a063
Galera is a fast synchronous multi-master wsrep provider (replication engine)
91a063
for transactional databases and similar applications. For more information
91a063
about wsrep API see http://launchpad.net/wsrep. For a description of Galera
91a063
replication engine see http://www.codership.com.
91a063
91a063
91a063
%prep
91a063
%setup -q
91a063
%patch0 -p1
91a063
91a063
%build
d09808
%{set_build_flags}
d09808
b0b44b
%cmake . \
b0b44b
       -DCMAKE_BUILD_TYPE="%{?with_debug:Debug}%{!?with_debug:RelWithDebInfo}" \
b0b44b
       -DINSTALL_LAYOUT=RPM \
b0b44b
       -DCMAKE_RULE_MESSAGES:BOOL=OFF \
b0b44b
       \
b0b44b
       -DBUILD_SHARED_LIBS:BOOL=OFF \
b0b44b
       \
b0b44b
       -DINSTALL_DOCDIR="share/doc/%{name}/" \
b0b44b
       -DINSTALL_GARBD="sbin" \
b0b44b
       -DINSTALL_GARBD-SYSTEMD="share/doc/galera" \
b0b44b
       -DINSTALL_CONFIGURATION="/etc/sysconfig/" \
b0b44b
       -DINSTALL_SYSTEMD_SERVICE="share/doc/galera" \
b0b44b
       -DINSTALL_LIBDIR="%{_lib}/galera" \
b0b44b
       -DINSTALL_MANPAGE="share/man/man8"
91a063
b0b44b
cmake -B %_vpath_builddir -LAH
91a063
b0b44b
%cmake_build
8850f4
8850f4
91a063
%install
b0b44b
%cmake_install
b0b44b
b0b44b
# PATCH 1:
b0b44b
#   Change the Systemd service name from "garb" to "garbd"
b0b44b
#
b0b44b
#   The Galera upstream uses name "garb" for the service while providing "garbd" alias
b0b44b
#   Fedora downstream packaging historically used "garbd" name for the service.
b0b44b
#
b0b44b
#   Let's stick with the Fedora legacy naming, AND provide an alias to the Galera upstream name
b0b44b
mv %{buildroot}/usr/share/doc/galera/garb.service %{buildroot}/usr/share/doc/galera/garbd.service
b0b44b
sed -i 's/Alias=garbd.service/Alias=garb.service/g' %{buildroot}/usr/share/doc/galera/garbd.service
b0b44b
b0b44b
# PATCH 2:
b0b44b
#   Fix the hardcoded paths
b0b44b
#     In the Systemd service file:
b0b44b
sed -i 's;/usr/bin/garb-systemd;/usr/sbin/garb-systemd;g' %{buildroot}/usr/share/doc/galera/garbd.service
b0b44b
#     In the wrapper script:
b0b44b
sed -i 's;/usr/bin/garbd;/usr/sbin/garbd;g' %{buildroot}/usr/share/doc/galera/garb-systemd
b0b44b
b0b44b
# PATCH 4:
b0b44b
#  Use a dedicated user for the Systemd service
b0b44b
#  To fix an security issue reported by Systemd:
b0b44b
#
b0b44b
## systemd[1]: /usr/lib/systemd/system/garb.service:14: Special user nobody configured, this is not safe!
b0b44b
##   Subject: Special user nobody configured, this is not safe!
b0b44b
##   Defined-By: systemd
b0b44b
##   Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
b0b44b
##   Documentation: https://systemd.io/UIDS-GIDS
b0b44b
##
b0b44b
##   The unit garb.service is configured to use User=nobody.
b0b44b
##
b0b44b
##   This is not safe. The nobody user's main purpose on Linux-based
b0b44b
##   operating systems is to be the owner of files that otherwise cannot be mapped
b0b44b
##   to any local user. It's used by the NFS client and Linux user namespacing,
b0b44b
##   among others. By running a unit's processes under the identity of this user
b0b44b
##   they might possibly get read and even write access to such files that cannot
b0b44b
##   otherwise be mapped.
b0b44b
##
b0b44b
##   It is strongly recommended to avoid running services under this user identity,
b0b44b
##   in particular on systems using NFS or running containers. Allocate a user ID
b0b44b
##   specific to this service, either statically via systemd-sysusers or dynamically
b0b44b
##   via the DynamicUser= service setting.
b0b44b
sed -i 's/User=nobody/User=garb/g' %{buildroot}/usr/share/doc/galera/garbd.service
b0b44b
b0b44b
# Install old service and wrapper to maintain compatibility
91a063
install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/garbd.service
91a063
install -D -m 755 %{SOURCE2} %{buildroot}%{_sbindir}/garbd-wrapper
91a063
b0b44b
%pre
b0b44b
/usr/sbin/useradd -M -r -d /dev/null -s /sbin/nologin -c "Galera Arbitrator Daemon" garb >/dev/null 2>&1 || :
91a063
91a063
%post
91a063
/sbin/ldconfig
91a063
%systemd_post garbd.service
91a063
91a063
%preun
91a063
%systemd_preun garbd.service
91a063
91a063
%postun
91a063
/sbin/ldconfig
91a063
%systemd_postun_with_restart garbd.service
91a063
91a063
91a063
%files
91a063
%config(noreplace,missingok) %{_sysconfdir}/sysconfig/garb
b0b44b
91a063
%dir %{_docdir}/galera
91a063
%dir %{_libdir}/galera
b0b44b
91a063
%{_sbindir}/garbd
91a063
%{_sbindir}/garbd-wrapper
b0b44b
b0b44b
# PATCH 3:
b0b44b
#   Make sure the wrapper script is executable
b0b44b
%attr(755, -, -) %{_docdir}/galera/garb-systemd
b0b44b
b0b44b
%{_mandir}/man8/garbd.8*
b0b44b
91a063
%{_unitdir}/garbd.service
b0b44b
%{_docdir}/galera/garbd.service
b0b44b
91a063
%{_libdir}/galera/libgalera_smm.so
b0b44b
b0b44b
%doc %{_docdir}/galera/AUTHORS
91a063
%doc %{_docdir}/galera/COPYING
91a063
%doc %{_docdir}/galera/LICENSE.asio
91a063
%doc %{_docdir}/galera/LICENSE.chromium
91a063
%doc %{_docdir}/galera/README
b0b44b
#%doc %{_docdir}/galera/README-MySQL
91a063
91a063
91a063
%changelog
b0b44b
* Thu Feb 03 2022 Lukas Javorsky <ljavorsk@redhat.com> - 25.3.34-4
b0b44b
- Explicitly require the 'procps-ng' package
b0b44b
- Otherwise it will not require it in the lightweight systems (e.g. containers)
b0b44b
- and Galera won't work properly
b0b44b
b0b44b
* Fri Jan 28 2022 Lukas Javorsky <ljavorsk@redhat.com> - 25.3.34-3
b0b44b
- Use downstream garbd-wrapper and garbd.service to ensure compatibility
b0b44b
- Add upstream versions of garbd-wrapper (called garbd-systemd) and garbd.service
b0b44b
  in case user want's to use them
b0b44b
b0b44b
* Wed Jan 19 2022 Michal Schorm <mschorm@redhat.com> -  25.3.34-2
b0b44b
- Switch from SCONS build tooling to CMAKE build tooling
b0b44b
b0b44b
* Wed Jan 19 2022 Zuzana Miklankova <zmiklank@redhat.com> - 25.3.34-1
b0b44b
- Rebase to 25.3.34
b0b44b
  Resolves: #2042298
b0b44b
  
29ac8f
* Tue Mar 23 2021 Michal Schorm <mschorm@redhat.com> - 25.3.32-1
29ac8f
- Rebase to 25.3.32
29ac8f
8850f4
* Tue Nov 10 2020 Michal Schorm <mschorm@redhat.com> - 25.3.31-1
8850f4
- Rebase to 25.3.31
8850f4
  Resolves: #1731289, #1856812
8850f4
d09808
* Thu Jul 18 2019 Michal Schorm <mschorm@redhat.com> - 25.3.26-1
d09808
- Rebase to 25.3.26
d09808
  Resolves: #1687879
d09808
  Resolves: #1657220
d09808
91a063
* Mon Jul 16 2018 Honza Horak <hhorak@redhat.com> - 25.3.23-5
91a063
- Require asio also on rhel
91a063
91a063
* Fri Jul 13 2018 Honza Horak <hhorak@redhat.com> - 25.3.23-4
91a063
- Add explicit gcc-c++ BR
91a063
- Use python3-scons
91a063
91a063
* Fri Jul 13 2018 Honza Horak <hhorak@redhat.com> - 25.3.23-3
91a063
- Do not require asio on rhel
91a063
91a063
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 25.3.23-2
91a063
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
91a063
91a063
* Fri Feb 16 2018 Michal Schorm <mschorm@redhat.com> - 25.3.23-1
91a063
- Update to 25.3.23
91a063
91a063
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 25.3.22-2
91a063
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
91a063
91a063
* Fri Nov 24 2017 Honza Horak <hhorak@redhat.com> - 25.3.22-1
91a063
- Update to 25.3.22
91a063
91a063
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 25.3.16-6
91a063
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
91a063
91a063
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 25.3.16-5
91a063
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
91a063
91a063
* Mon Jul 03 2017 Jonathan Wakely <jwakely@redhat.com> - 25.3.16-4
91a063
- Rebuilt for Boost 1.64
91a063
91a063
* Mon May 15 2017 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 25.3.16-3
91a063
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild
91a063
91a063
* Sat Feb 18 2017 Jonathan Wakely <jwakely@redhat.com> - 25.3.16-2
91a063
- Use asio-devel instead of bundled asio library
91a063
91a063
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 25.3.16-2
91a063
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
91a063
91a063
* Wed Jun 22 2016 Mike Bayer <mbayer@redhat.com> - 25.3.16-1
91a063
- Update to 25.3.16
91a063
91a063
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 25.3.12-4
91a063
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
91a063
91a063
* Fri Jan 15 2016 Jonathan Wakely <jwakely@redhat.com> - 25.3.12-3
91a063
- Rebuilt for Boost 1.60
91a063
91a063
* Wed Sep 30 2015 Marcin Juszkiewicz <mjuszkiewicz@redhat.com> - 25.3.12-2
91a063
- Remove use of -mtune=native which breaks build on secondary architectures
91a063
91a063
* Fri Sep 25 2015 Richard W.M. Jones <rjones@redhat.com> - 25.3.12-1
91a063
- Update to 25.3.12.
91a063
- Should fix the build on 32 bit ARM (RHBZ#1241164).
91a063
- Remove ExcludeArch (should have read the BZ more closely).
91a063
91a063
* Thu Aug 27 2015 Jonathan Wakely <jwakely@redhat.com> - 25.3.10-5
91a063
- Rebuilt for Boost 1.59
91a063
91a063
* Wed Jul 29 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 25.3.10-4
91a063
- Rebuilt for https://fedoraproject.org/wiki/Changes/F23Boost159
91a063
91a063
* Wed Jul 22 2015 David Tardon <dtardon@redhat.com> - 25.3.10-3
91a063
- rebuild for Boost 1.58
91a063
91a063
* Wed Jul 08 2015 Ryan O'Hara <rohara@redhat.com> - 25.3.10-2
91a063
- Disable ARM builds (#1241164, #1239516)
91a063
91a063
* Mon Jul 06 2015 Ryan O'Hara <rohara@redhat.com> - 25.3.10-1
91a063
- Update to version 25.3.10
91a063
91a063
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 25.3.5-11
91a063
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
91a063
91a063
* Mon Jan 26 2015 Petr Machata <pmachata@redhat.com> - 25.3.5-10
91a063
- Rebuild for boost 1.57.0
91a063
91a063
* Thu Nov 27 2014 Richard W.M. Jones <rjones@redhat.com> - 25.3.5-9
91a063
- Add aarch64 support.
91a063
91a063
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 25.3.5-8
91a063
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
91a063
91a063
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 25.3.5-7
91a063
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
91a063
91a063
* Fri May 23 2014 Petr Machata <pmachata@redhat.com> - 25.3.5-6
91a063
- Rebuild for boost 1.55.0
91a063
91a063
* Wed Apr 30 2014 Dan HorĂ¡k <dan[at]danny.cz> - 25.3.5-5
91a063
- set ExclusiveArch
91a063
91a063
* Thu Apr 24 2014 Ryan O'Hara <rohara@redhat.com> - 25.3.5-4
91a063
- Use strict_build_flags=0 to avoid -Werror
91a063
- Remove unnecessary clean section
91a063
91a063
* Thu Apr 24 2014 Ryan O'Hara <rohara@redhat.com> - 25.3.5-3
91a063
- Include galera directories in file list
91a063
- Set CPPFLAGS to optflags
91a063
91a063
* Wed Apr 23 2014 Ryan O'Hara <rohara@redhat.com> - 25.3.5-2
91a063
- Fix client certificate verification (#1090604)
91a063
91a063
* Thu Mar 27 2014 Ryan O'Hara <rohara@redhat.com> - 25.3.5-1
91a063
- Update to version 25.3.5
91a063
91a063
* Mon Mar 24 2014 Ryan O'Hara <rohara@redhat.com> - 25.3.3-2
91a063
- Add systemd service
91a063
91a063
* Sun Mar 09 2014 Ryan O'Hara <rohara@redhat.com> - 25.3.3-1
91a063
- Initial build