booth/booth.spec

346 lines
11 KiB
RPMSpec
Raw Permalink Normal View History

2023-11-17 17:31:46 +08:00
# RPMs are split as follows:
# * booth:
# - envelope package serving as a syntactic shortcut to install
# booth-site (with architecture reliably preserved)
# * booth-core:
# - package serving as a base for booth-{arbitrator,site},
# carrying also basic documentation, license, etc.
# * booth-arbitrator:
# - package to be installed at a machine accessible within HA cluster(s),
# but not (necessarily) a member of any, hence no dependency
# on anything from cluster stack is required
# * booth-site:
# - package to be installed at a cluster member node
# (requires working cluster environment to be useful)
# * booth-test:
# - files for testing booth
#
# TODO:
# wireshark-dissector.lua currently of no use (rhbz#1259623), but if/when
# this no longer persists, add -wireshark package (akin to libvirt-wireshark)
2020-11-05 17:58:26 +08:00
%bcond_with html_man
%bcond_with glue
2023-02-07 17:01:36 +08:00
%bcond_with run_build_tests
%bcond_with include_unit_test
2024-06-11 11:12:49 +08:00
%global release 6
2023-02-07 17:01:36 +08:00
2023-11-17 17:31:46 +08:00
## User and group to use for nonprivileged services (should be in sync with pacemaker)
%global uname hacluster
%global gname haclient
2023-02-07 17:01:36 +08:00
2020-11-05 17:58:26 +08:00
# Disable automatic compilation of Python files in extra directories
%global _python_bytecompile_extra 0
%global github_owner ClusterLabs
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}}
# https://fedoraproject.org/wiki/EPEL:Packaging?rd=Packaging:EPEL#The_.25license_tag
%{!?_licensedir:%global license %doc}
%global test_path %{_datadir}/booth/tests
Name: booth
2023-11-17 17:31:46 +08:00
Version: 1.1
2023-02-07 17:01:36 +08:00
Release: %{release}
2020-11-05 17:58:26 +08:00
Summary: Ticket Manager for Multi-site Clusters
2023-11-17 17:31:46 +08:00
License: GPL-2.0-or-later
2020-11-05 17:58:26 +08:00
Url: https://github.com/%{github_owner}/%{name}
2023-11-17 17:31:46 +08:00
Source0: https://github.com/%{github_owner}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz
2024-02-20 16:02:55 +08:00
Patch0: Remove-const-warning.patch
Patch1: pacemaker-Don-t-add-explicit-error-prefix-in-log.patch
Patch2: pacemaker-Use-long-format-for-crm_ticket-v.patch
2024-04-28 17:05:01 +08:00
Patch3: pacemaker-Check-snprintf-return-values.patch
2023-10-17 18:14:14 +08:00
2024-06-11 11:12:49 +08:00
Patch3000: backport-CVE-2024-3049.patch
2020-11-05 17:58:26 +08:00
# direct build process dependencies
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: coreutils
BuildRequires: make
2023-02-07 17:01:36 +08:00
## ./autogen.sh
2020-11-05 17:58:26 +08:00
BuildRequires: /bin/sh
2023-02-07 17:01:36 +08:00
# general build dependencies
2020-11-05 17:58:26 +08:00
BuildRequires: asciidoctor
BuildRequires: gcc
BuildRequires: pkgconfig
# linking dependencies
BuildRequires: libgcrypt-devel
BuildRequires: libxml2-devel
## just for <pacemaker/crm/services.h> include
BuildRequires: pacemaker-libs-devel
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: zlib-devel
## logging provider
BuildRequires: pkgconfig(libqb)
## random2range provider
BuildRequires: pkgconfig(glib-2.0)
## nametag provider
BuildRequires: pkgconfig(libsystemd)
# check scriptlet (for hostname and killall respectively)
BuildRequires: hostname psmisc
BuildRequires: python3-devel
2023-02-07 17:01:36 +08:00
# For generating tests
BuildRequires: sed
2020-11-05 17:58:26 +08:00
# spec file specifics
## for _unitdir, systemd_requires and specific scriptlet macros
BuildRequires: systemd
## for autosetup
BuildRequires: git
2023-11-17 17:31:46 +08:00
%if 0%{?with_run_build_tests}
2023-02-07 17:01:36 +08:00
# check scriptlet (for perl and ss)
BuildRequires: perl-interpreter iproute
2023-11-17 17:31:46 +08:00
%endif
2020-11-05 17:58:26 +08:00
# this is for a composite-requiring-its-components arranged
# as an empty package (empty files section) requiring subpackages
# (_isa so as to preserve the architecture)
2023-02-07 17:01:36 +08:00
Requires: %{name}-core
2020-11-05 17:58:26 +08:00
Requires: %{name}-site
%files
2023-02-07 17:01:36 +08:00
%license COPYING
%dir %{_datadir}/pkgconfig
%{_datadir}/pkgconfig/booth.pc
2020-11-05 17:58:26 +08:00
%description
Booth manages tickets which authorize cluster sites located
in geographically dispersed locations to run resources.
It facilitates support of geographically distributed
clustering in Pacemaker.
2023-02-07 17:01:36 +08:00
# SUBPACKAGES #
2020-11-05 17:58:26 +08:00
%package core
Summary: Booth core files (executables, etc.)
# for booth-keygen (chown, dd)
Requires: coreutils
# deal with pre-split arrangement
Conflicts: %{name} < 1.0-1
%description core
Core files (executables, etc.) for Booth, ticket manager for
multi-site clusters.
%package arbitrator
Summary: Booth support for running as an arbitrator
BuildArch: noarch
Requires: %{name}-core = %{version}-%{release}
%{?systemd_requires}
# deal with pre-split arrangement
Conflicts: %{name} < 1.0-1
%description arbitrator
Support for running Booth, ticket manager for multi-site clusters,
as an arbitrator.
%post arbitrator
2023-02-07 17:01:36 +08:00
%systemd_post booth-arbitrator.service
2020-11-05 17:58:26 +08:00
%preun arbitrator
%systemd_preun booth-arbitrator.service
2020-11-05 17:58:26 +08:00
%postun arbitrator
%systemd_postun_with_restart booth-arbitrator.service
2020-11-05 17:58:26 +08:00
%package site
Summary: Booth support for running as a full-fledged site
BuildArch: noarch
Requires: %{name}-core = %{version}-%{release}
# for crm_{resource,simulate,ticket} utilities
Requires: pacemaker >= 1.1.8
# for ocf-shellfuncs and other parts of OCF shell-based environment
Requires: resource-agents
# deal with pre-split arrangement
Conflicts: %{name} < 1.0-1
%description site
Support for running Booth, ticket manager for multi-site clusters,
as a full-fledged site.
%package test
Summary: Test scripts for Booth
BuildArch: noarch
# runtests.py suite (for hostname and killall respectively)
Requires: hostname psmisc
# any of the following internal dependencies will pull -core package
## for booth@booth.service
Requires: %{name}-arbitrator = %{version}-%{release}
## for booth-site and service-runnable scripts
## (and /usr/lib/ocf/resource.d/booth)
Requires: %{name}-site = %{version}-%{release}
Requires: gdb
2023-02-07 17:01:36 +08:00
Requires: %{__python3}
2023-11-17 17:31:46 +08:00
%if 0%{?with_include_unit_test}
2020-11-05 17:58:26 +08:00
Requires: python3-pexpect
2023-11-17 17:31:46 +08:00
%endif
2023-02-07 17:01:36 +08:00
# runtests.py suite (for perl and ss)
Requires: perl-interpreter iproute
2020-11-05 17:58:26 +08:00
%description test
Automated tests for running Booth, ticket manager for multi-site clusters.
# BUILD #
%prep
2024-02-20 16:02:55 +08:00
%autosetup -n %{name}-%{version} -S git_am -p 1
2020-11-05 17:58:26 +08:00
%build
./autogen.sh
%{configure} \
--with-initddir=%{_initrddir} \
--docdir=%{_pkgdocdir} \
--enable-user-flags \
2023-02-07 17:01:36 +08:00
%{?with_html_man:--with-html_man} \
%{!?with_glue:--without-glue} \
PYTHON=%{__python3}
2020-11-05 17:58:26 +08:00
%{make_build}
%install
%{make_install}
mkdir -p %{buildroot}/%{_unitdir}
cp -a -t %{buildroot}/%{_unitdir} \
-- conf/booth@.service conf/booth-arbitrator.service
install -D -m 644 -t %{buildroot}/%{_mandir}/man8 \
-- docs/boothd.8
ln -s boothd.8 %{buildroot}/%{_mandir}/man8/booth.8
cp -a -t %{buildroot}/%{_pkgdocdir} \
-- ChangeLog README-testing conf/booth.conf.example
# drop what we don't package anyway (COPYING added via tarball-relative path)
rm -rf %{buildroot}/%{_initrddir}/booth-arbitrator
rm -rf %{buildroot}/%{_pkgdocdir}/README.upgrade-from-v0.1
rm -rf %{buildroot}/%{_pkgdocdir}/COPYING
# tests
mkdir -p %{buildroot}/%{test_path}
2023-02-07 17:01:36 +08:00
# Copy tests from tarball
2020-11-05 17:58:26 +08:00
cp -a -t %{buildroot}/%{test_path} \
2023-11-17 17:31:46 +08:00
-- conf test
%if 0%{?with_include_unit_test}
cp -a -t %{buildroot}/%{test_path} \
-- unit-tests script/unit-test.py
%endif
2020-11-05 17:58:26 +08:00
chmod +x %{buildroot}/%{test_path}/test/booth_path
chmod +x %{buildroot}/%{test_path}/test/live_test.sh
mkdir -p %{buildroot}/%{test_path}/src
ln -s -t %{buildroot}/%{test_path}/src \
-- %{_sbindir}/boothd
2023-02-07 17:01:36 +08:00
# Generate runtests.py and boothtestenv.py
sed -e 's#PYTHON_SHEBANG#%{__python3} -Es#g' \
-e 's#TEST_SRC_DIR#%{test_path}/test#g' \
-e 's#TEST_BUILD_DIR#%{test_path}/test#g' \
%{buildroot}/%{test_path}/test/runtests.py.in > %{buildroot}/%{test_path}/test/runtests.py
chmod +x %{buildroot}/%{test_path}/test/runtests.py
sed -e 's#PYTHON_SHEBANG#%{__python3} -Es#g' \
-e 's#TEST_SRC_DIR#%{test_path}/test#g' \
-e 's#TEST_BUILD_DIR#%{test_path}/test#g' \
%{buildroot}/%{test_path}/test/boothtestenv.py.in > %{buildroot}/%{test_path}/test/boothtestenv.py
2020-11-05 17:58:26 +08:00
# https://fedoraproject.org/wiki/Packaging:Python_Appendix#Manual_byte_compilation
%py_byte_compile %{__python3} %{buildroot}/%{test_path}
%check
# alternatively: test/runtests.py
2023-11-17 17:31:46 +08:00
#%if 0%{?with_run_build_tests}
2020-11-05 17:58:26 +08:00
VERBOSE=1 make check
2023-11-17 17:31:46 +08:00
#%endif
2020-11-05 17:58:26 +08:00
%files core
%license COPYING
%doc %{_pkgdocdir}/AUTHORS
%doc %{_pkgdocdir}/ChangeLog
%doc %{_pkgdocdir}/README
%doc %{_pkgdocdir}/booth.conf.example
# core command(s) + man pages
%{_sbindir}/booth*
%{_mandir}/man8/booth*.8*
# configuration
%dir %{_sysconfdir}/booth
%exclude %{_sysconfdir}/booth/booth.conf.example
2023-02-07 17:01:36 +08:00
2023-03-17 10:38:53 +08:00
%dir %attr (755, root, root) %{_var}/lib/booth/
%dir %attr (755, root, root) %{_var}/lib/booth/cores
2020-11-05 17:58:26 +08:00
2023-11-17 17:31:46 +08:00
# Generated html docs
%if 0%{?with_html_man}
%{_pkgdocdir}/booth-keygen.8.html
%{_pkgdocdir}/boothd.8.html
%endif
2020-11-05 17:58:26 +08:00
%files arbitrator
%{_unitdir}/booth@.service
%{_unitdir}/booth-arbitrator.service
%files site
# OCF (agent + a helper)
## /usr/lib/ocf/resource.d/pacemaker provided by pacemaker
2023-02-07 17:01:36 +08:00
%{_usr}/lib/ocf/resource.d/pacemaker/booth-site
%dir %{_usr}/lib/ocf/lib/booth
%{_usr}/lib/ocf/lib/booth/geo_attr.sh
2020-11-05 17:58:26 +08:00
# geostore (command + OCF agent)
%{_sbindir}/geostore
%{_mandir}/man8/geostore.8*
## /usr/lib/ocf/resource.d provided by resource-agents
2023-02-07 17:01:36 +08:00
%dir %{_usr}/lib/ocf/resource.d/booth
%{_usr}/lib/ocf/resource.d/booth/geostore
2020-11-05 17:58:26 +08:00
# helper (possibly used in the configuration hook)
%dir %{_datadir}/booth
%{_datadir}/booth/service-runnable
2023-11-17 17:31:46 +08:00
# Generated html docs
%if 0%{?with_html_man}
%{_pkgdocdir}/geostore.8.html
%endif
2020-11-05 17:58:26 +08:00
%files test
%doc %{_pkgdocdir}/README-testing
# /usr/share/booth provided by -site
%{test_path}
# /usr/lib/ocf/resource.d/booth provided by -site
2023-02-07 17:01:36 +08:00
%{_usr}/lib/ocf/resource.d/booth/sharedrsc
2020-11-05 17:58:26 +08:00
%changelog
2024-06-11 11:12:49 +08:00
* Tue Jun 11 2024 xuchenchen <xuchenchen@kylinos.cn> -1.1-6
- Type:CVES
- ID:CVE-2024-3049
- SUG:NA
- DESC:fix CVE-2024-3049
2024-04-28 17:05:01 +08:00
* Sun Apr 28 2024 bizhiyuan <bizhiyuan@kylinos.cn> - 1.1-5
- pacemaker Check snprintf return values
* Thu Feb 29 2024 bizhiyuan <bizhiyuan@kylinos.cn> - 1.1-4
- pacemaker: Use long format for crm_ticket -v
* Thu Feb 29 2024 bizhiyuan <bizhiyuan@kylinos.cn> - 1.1-3
- pacemaker: Don't add explicit error prefix in log
2024-02-20 16:02:55 +08:00
* Tue Feb 20 2024 bizhiyuan <bizhiyuan@kylinos.cn> - 1.1-2
- pacemaker: Remove const warning
2023-11-17 17:31:46 +08:00
* Fri Nov 17 2023 bizhiyuan <bizhiyuan@kylinos.cn> - 1.1-1
- Update to version 1.1
2023-10-17 18:14:14 +08:00
* Tue Oct 17 2023 bizhiyuan <bizhiyuan@kylinos.cn> - 1.0-9
- Fix glib hash table is not NULL assert
2023-03-17 10:38:53 +08:00
* Fri Mar 17 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 1.0-8
- Modify folder permissions
* Tue Feb 28 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 1.0-7
- Delete the error macro
2023-02-07 17:01:36 +08:00
* Tue Feb 07 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 1.0-6
- Rebase to newest upstream snapshot
* Wed Mar 16 2022 jiangxinyu <jiangxinyu@kylinos.cn> - 1.0-5
- Package /var/lib/booth where booth can chroot
* Mon Feb 28 2022 jiangxinyu <jiangxinyu@kylinos.cn> - 1.0-4
- Fix booth@.service missing instance name.
2020-11-05 17:58:26 +08:00
* Fri Oct 30 2020 jiangxinyu <jiangxinyu@kylinos.cn> - 1.0-3
- Init booth project