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