afe0d5
# RPMs are split as follows:
afe0d5
# * booth:
afe0d5
#   - envelope package serving as a syntactic shortcut to install
afe0d5
#     booth-site (with architecture reliably preserved)
afe0d5
# * booth-core:
afe0d5
#   - package serving as a base for booth-{arbitrator,site},
afe0d5
#     carrying also basic documentation, license, etc.
afe0d5
# * booth-arbitrator:
afe0d5
#   - package to be installed at a machine accessible within HA cluster(s),
afe0d5
#     but not (necessarily) a member of any, hence no dependency
afe0d5
#     on anything from cluster stack is required
afe0d5
# * booth-site:
afe0d5
#   - package to be installed at a cluster member node
afe0d5
#     (requires working cluster environment to be useful)
afe0d5
# * booth-test:
afe0d5
#   - files for testing booth
afe0d5
#
afe0d5
# TODO:
afe0d5
# wireshark-dissector.lua currently of no use (rhbz#1259623), but if/when
afe0d5
# this no longer persists, add -wireshark package (akin to libvirt-wireshark)
afe0d5
afe0d5
%bcond_with html_man
afe0d5
%bcond_with glue
deb2a6
%bcond_with run_build_tests
8ba43c
%bcond_without include_unit_test
deb2a6
deb2a6
# set following to the result of  `git describe --abbrev=128 $commit`
deb2a6
# This will be used to fill booth_ver, booth_numcomm and booth_sha1.
deb2a6
# It is important to keep abbrev to get full length sha1! When updating source use
deb2a6
# `spectool -g booth.spec` to download source.
8ba43c
%global git_describe_str v1.0-283-g9d4029aa14323a7f3b496215d25e40bd14f33632
deb2a6
deb2a6
# Set this to 1 when rebasing (changing git_describe_str) and increase otherwise
8ba43c
%global release 1
deb2a6
deb2a6
# Run shell script to parse git_describe str into version, numcomm and sha1 hash
deb2a6
%global booth_ver %(s=%{git_describe_str}; vver=${s%%%%-*}; echo ${vver:1})
deb2a6
%global booth_numcomm %(s=%{git_describe_str}; t=${s#*-}; echo ${t%%%%-*})
deb2a6
%global booth_sha1 %(s=%{git_describe_str}; t=${s##*-}; echo ${t:1})
deb2a6
%global booth_short_sha1 %(s=%{booth_sha1}; echo ${s:0:7})
deb2a6
%global booth_archive_name %{name}-%{booth_ver}-%{booth_numcomm}-%{booth_short_sha1}
afe0d5
67e109
## User and group to use for nonprivileged services (should be in sync with pacemaker)
67e109
%global uname hacluster
67e109
%global gname haclient
67e109
afe0d5
# Disable automatic compilation of Python files in extra directories
afe0d5
%global _python_bytecompile_extra 0
afe0d5
afe0d5
%global github_owner ClusterLabs
afe0d5
afe0d5
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}}
afe0d5
# https://fedoraproject.org/wiki/EPEL:Packaging?rd=Packaging:EPEL#The_.25license_tag
afe0d5
%{!?_licensedir:%global license %doc}
afe0d5
afe0d5
%global test_path   %{_datadir}/booth/tests
afe0d5
afe0d5
Name:           booth
deb2a6
Version:        %{booth_ver}
abb4a9
Release:        %{booth_numcomm}.%{release}.%{booth_short_sha1}.git%{?dist}
afe0d5
Summary:        Ticket Manager for Multi-site Clusters
afe0d5
License:        GPLv2+
afe0d5
Url:            https://github.com/%{github_owner}/%{name}
deb2a6
Source0:        https://github.com/%{github_owner}/%{name}/archive/%{booth_short_sha1}/%{booth_archive_name}.tar.gz
8ba43c
Patch0:         rhel-specific-0001-config-Add-enable-authfile-option.patch
afe0d5
afe0d5
# direct build process dependencies
afe0d5
BuildRequires:  autoconf
afe0d5
BuildRequires:  automake
afe0d5
BuildRequires:  coreutils
afe0d5
BuildRequires:  make
afe0d5
## ./autogen.sh
afe0d5
BuildRequires:  /bin/sh
afe0d5
# general build dependencies
afe0d5
BuildRequires:  asciidoc
afe0d5
BuildRequires:  gcc
afe0d5
BuildRequires:  pkgconfig
afe0d5
# linking dependencies
afe0d5
BuildRequires:  libgcrypt-devel
afe0d5
BuildRequires:  libxml2-devel
afe0d5
## just for <pacemaker/crm/services.h> include
afe0d5
BuildRequires:  pacemaker-libs-devel
afe0d5
BuildRequires:  pkgconfig(glib-2.0)
afe0d5
BuildRequires:  zlib-devel
afe0d5
## logging provider
afe0d5
BuildRequires:  pkgconfig(libqb)
afe0d5
## random2range provider
afe0d5
BuildRequires:  pkgconfig(glib-2.0)
afe0d5
## nametag provider
afe0d5
BuildRequires:  pkgconfig(libsystemd)
afe0d5
# check scriptlet (for hostname and killall respectively)
afe0d5
BuildRequires:  hostname psmisc
afe0d5
BuildRequires:  python3-devel
67e109
# For generating tests
67e109
BuildRequires:  sed
afe0d5
# spec file specifics
afe0d5
## for _unitdir, systemd_requires and specific scriptlet macros
afe0d5
BuildRequires:  systemd
afe0d5
## for autosetup
afe0d5
BuildRequires:  git
deb2a6
%if 0%{?with_run_build_tests}
67e109
# check scriptlet (for perl and netstat)
67e109
BuildRequires:  perl-interpreter net-tools
deb2a6
%endif
afe0d5
afe0d5
# this is for a composite-requiring-its-components arranged
afe0d5
# as an empty package (empty files section) requiring subpackages
afe0d5
# (_isa so as to preserve the architecture)
afe0d5
Requires:       %{name}-core%{?_isa}
afe0d5
Requires:       %{name}-site
afe0d5
%files
8ba43c
%license COPYING
8ba43c
%dir %{_datadir}/pkgconfig
8ba43c
%{_datadir}/pkgconfig/booth.pc
afe0d5
afe0d5
%description
afe0d5
Booth manages tickets which authorize cluster sites located
afe0d5
in geographically dispersed locations to run resources.
afe0d5
It facilitates support of geographically distributed
afe0d5
clustering in Pacemaker.
afe0d5
afe0d5
# SUBPACKAGES #
afe0d5
afe0d5
%package        core
afe0d5
Summary:        Booth core files (executables, etc.)
afe0d5
# for booth-keygen (chown, dd)
afe0d5
Requires:       coreutils
afe0d5
# deal with pre-split arrangement
afe0d5
Conflicts:      %{name} < 1.0-1
afe0d5
afe0d5
%description    core
afe0d5
Core files (executables, etc.) for Booth, ticket manager for
afe0d5
multi-site clusters.
afe0d5
afe0d5
%package        arbitrator
afe0d5
Summary:        Booth support for running as an arbitrator
afe0d5
BuildArch:      noarch
afe0d5
Requires:       %{name}-core = %{version}-%{release}
afe0d5
%{?systemd_requires}
afe0d5
# deal with pre-split arrangement
afe0d5
Conflicts:      %{name} < 1.0-1
afe0d5
afe0d5
%description    arbitrator
afe0d5
Support for running Booth, ticket manager for multi-site clusters,
afe0d5
as an arbitrator.
afe0d5
afe0d5
%post arbitrator
8ba43c
%systemd_post booth-arbitrator.service
afe0d5
afe0d5
%preun arbitrator
8ba43c
%systemd_preun booth-arbitrator.service
afe0d5
afe0d5
%postun arbitrator
8ba43c
%systemd_postun_with_restart booth-arbitrator.service
afe0d5
afe0d5
%package        site
afe0d5
Summary:        Booth support for running as a full-fledged site
afe0d5
BuildArch:      noarch
afe0d5
Requires:       %{name}-core = %{version}-%{release}
afe0d5
# for crm_{resource,simulate,ticket} utilities
afe0d5
Requires:       pacemaker >= 1.1.8
afe0d5
# for ocf-shellfuncs and other parts of OCF shell-based environment
afe0d5
Requires:       resource-agents
afe0d5
# deal with pre-split arrangement
afe0d5
Conflicts:      %{name} < 1.0-1
afe0d5
afe0d5
%description    site
afe0d5
Support for running Booth, ticket manager for multi-site clusters,
afe0d5
as a full-fledged site.
afe0d5
afe0d5
%package        test
afe0d5
Summary:        Test scripts for Booth
afe0d5
BuildArch:      noarch
afe0d5
# runtests.py suite (for hostname and killall respectively)
afe0d5
Requires:       hostname psmisc
afe0d5
# any of the following internal dependencies will pull -core package
afe0d5
## for booth@booth.service
afe0d5
Requires:       %{name}-arbitrator = %{version}-%{release}
afe0d5
## for booth-site and service-runnable scripts
afe0d5
## (and /usr/lib/ocf/resource.d/booth)
afe0d5
Requires:       %{name}-site = %{version}-%{release}
afe0d5
Requires:       gdb
afe0d5
Requires:       %{__python3}
8ba43c
%if 0%{?with_include_unit_test}
afe0d5
Requires:       python3-pexpect
8ba43c
%endif
67e109
# runtests.py suite (for perl and netstat)
67e109
Requires:       perl-interpreter net-tools
afe0d5
afe0d5
%description    test
afe0d5
Automated tests for running Booth, ticket manager for multi-site clusters.
afe0d5
afe0d5
# BUILD #
afe0d5
afe0d5
%prep
deb2a6
%autosetup -n %{name}-%{booth_sha1} -S git_am
afe0d5
afe0d5
%build
afe0d5
./autogen.sh
afe0d5
%{configure} \
afe0d5
        --with-initddir=%{_initrddir} \
afe0d5
        --docdir=%{_pkgdocdir} \
afe0d5
        --enable-user-flags \
deb2a6
        %{?with_html_man:--with-html_man} \
67e109
        %{!?with_glue:--without-glue} \
67e109
        PYTHON=%{__python3}
afe0d5
%{make_build}
afe0d5
afe0d5
%install
afe0d5
%{make_install}
afe0d5
mkdir -p %{buildroot}/%{_unitdir}
afe0d5
cp -a -t %{buildroot}/%{_unitdir} \
afe0d5
        -- conf/booth@.service conf/booth-arbitrator.service
afe0d5
install -D -m 644 -t %{buildroot}/%{_mandir}/man8 \
afe0d5
        -- docs/boothd.8
afe0d5
ln -s boothd.8 %{buildroot}/%{_mandir}/man8/booth.8
afe0d5
cp -a -t %{buildroot}/%{_pkgdocdir} \
afe0d5
        -- ChangeLog README-testing conf/booth.conf.example
afe0d5
# drop what we don't package anyway (COPYING added via tarball-relative path)
afe0d5
rm -rf %{buildroot}/%{_initrddir}/booth-arbitrator
afe0d5
rm -rf %{buildroot}/%{_pkgdocdir}/README.upgrade-from-v0.1
afe0d5
rm -rf %{buildroot}/%{_pkgdocdir}/COPYING
afe0d5
# tests
afe0d5
mkdir -p %{buildroot}/%{test_path}
67e109
# Copy tests from tarball
afe0d5
cp -a -t %{buildroot}/%{test_path} \
8ba43c
        -- conf test
8ba43c
%if 0%{?with_include_unit_test}
8ba43c
cp -a -t %{buildroot}/%{test_path} \
8ba43c
        -- unit-tests script/unit-test.py
8ba43c
%endif
afe0d5
chmod +x %{buildroot}/%{test_path}/test/booth_path
afe0d5
chmod +x %{buildroot}/%{test_path}/test/live_test.sh
afe0d5
mkdir -p %{buildroot}/%{test_path}/src
afe0d5
ln -s -t %{buildroot}/%{test_path}/src \
afe0d5
        -- %{_sbindir}/boothd
67e109
# Generate runtests.py and boothtestenv.py
67e109
sed -e 's#PYTHON_SHEBANG#%{__python3} -Es#g' \
67e109
    -e 's#TEST_SRC_DIR#%{test_path}/test#g' \
67e109
    -e 's#TEST_BUILD_DIR#%{test_path}/test#g' \
67e109
    %{buildroot}/%{test_path}/test/runtests.py.in > %{buildroot}/%{test_path}/test/runtests.py
67e109
67e109
chmod +x %{buildroot}/%{test_path}/test/runtests.py
67e109
67e109
sed -e 's#PYTHON_SHEBANG#%{__python3} -Es#g' \
67e109
    -e 's#TEST_SRC_DIR#%{test_path}/test#g' \
67e109
    -e 's#TEST_BUILD_DIR#%{test_path}/test#g' \
67e109
    %{buildroot}/%{test_path}/test/boothtestenv.py.in > %{buildroot}/%{test_path}/test/boothtestenv.py
afe0d5
afe0d5
# https://fedoraproject.org/wiki/Packaging:Python_Appendix#Manual_byte_compilation
afe0d5
%py_byte_compile %{__python3} %{buildroot}/%{test_path}
afe0d5
afe0d5
%check
afe0d5
# alternatively: test/runtests.py
deb2a6
%if 0%{?with_run_build_tests}
afe0d5
VERBOSE=1 make check
deb2a6
%endif
afe0d5
afe0d5
%files          core
afe0d5
%license COPYING
afe0d5
%doc %{_pkgdocdir}/AUTHORS
afe0d5
%doc %{_pkgdocdir}/ChangeLog
afe0d5
%doc %{_pkgdocdir}/README
afe0d5
%doc %{_pkgdocdir}/booth.conf.example
afe0d5
# core command(s) + man pages
afe0d5
%{_sbindir}/booth*
afe0d5
%{_mandir}/man8/booth*.8*
afe0d5
# configuration
afe0d5
%dir %{_sysconfdir}/booth
afe0d5
%exclude %{_sysconfdir}/booth/booth.conf.example
afe0d5
67e109
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/booth/
67e109
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/booth/cores
67e109
deb2a6
# Generated html docs
deb2a6
%if 0%{?with_html_man}
deb2a6
%{_pkgdocdir}/booth-keygen.8.html
deb2a6
%{_pkgdocdir}/boothd.8.html
deb2a6
%endif
deb2a6
afe0d5
%files          arbitrator
afe0d5
%{_unitdir}/booth@.service
afe0d5
%{_unitdir}/booth-arbitrator.service
afe0d5
afe0d5
%files          site
afe0d5
# OCF (agent + a helper)
afe0d5
## /usr/lib/ocf/resource.d/pacemaker provided by pacemaker
67e109
%{_usr}/lib/ocf/resource.d/pacemaker/booth-site
67e109
%dir %{_usr}/lib/ocf/lib/booth
67e109
     %{_usr}/lib/ocf/lib/booth/geo_attr.sh
afe0d5
# geostore (command + OCF agent)
afe0d5
%{_sbindir}/geostore
afe0d5
%{_mandir}/man8/geostore.8*
afe0d5
## /usr/lib/ocf/resource.d provided by resource-agents
67e109
%dir %{_usr}/lib/ocf/resource.d/booth
67e109
     %{_usr}/lib/ocf/resource.d/booth/geostore
afe0d5
# helper (possibly used in the configuration hook)
afe0d5
%dir %{_datadir}/booth
afe0d5
     %{_datadir}/booth/service-runnable
afe0d5
deb2a6
# Generated html docs
deb2a6
%if 0%{?with_html_man}
deb2a6
%{_pkgdocdir}/geostore.8.html
deb2a6
%endif
deb2a6
afe0d5
%files          test
afe0d5
%doc %{_pkgdocdir}/README-testing
afe0d5
# /usr/share/booth provided by -site
afe0d5
%{test_path}
afe0d5
# /usr/lib/ocf/resource.d/booth provided by -site
67e109
%{_usr}/lib/ocf/resource.d/booth/sharedrsc
afe0d5
afe0d5
%changelog
8ba43c
* Mon Nov 21 2022 Jan Friesse <jfriesse@redhat.com> - 1.0-283.1.9d4029a.git
8ba43c
- Resolves: rhbz#2135865
8ba43c
8ba43c
- Update to current snapshot (commit 9d4029a) (rhbz#2135865)
8ba43c
abb4a9
* Wed Aug 03 2022 Jan Friesse <jfriesse@redhat.com> - 1.0-199.2.ac1d34c.git
abb4a9
- Resolves: rhbz#2111668
e024f4
e024f4
- Fix authfile directive handling in booth config file
e024f4
  (fixes CVE-2022-2553)
e024f4
- Add enable-authfile option
e024f4
deb2a6
* Thu Oct 15 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-199.1.ac1d34c.git
deb2a6
- Resolves: rhbz#1873948
deb2a6
- Resolves: rhbz#1768172
deb2a6
deb2a6
- Fix versioning scheme to handle updates better
deb2a6
- Handle updated exit code of crm_ticket
deb2a6
67e109
* Wed Jun 3 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-6.ac1d34c.git.2
67e109
- Related: rhbz#1835831
67e109
67e109
- Do not link with the pcmk libraries
67e109
- Generate runtests.py and boothtestenv.py with -Es as make check does
67e109
67e109
* Tue Jun 2 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-6.ac1d34c.git.1
67e109
- Resolves: rhbz#1602455
67e109
- Resolves: rhbz#1682122
67e109
- Resolves: rhbz#1768369
67e109
- Resolves: rhbz#1835831
67e109
67e109
- Update to current snapshot (commit ac1d34c) to fix test suite,
67e109
  build warnings and build with gcc10
67e109
- Fix hardcoded-library-path
67e109
- Package /var/lib/booth where booth can chroot
67e109
- Add '?dist' macro to release field
67e109
- Pass full path of Python3 to configure
67e109
- Add CI tests
67e109
- Enable gating
67e109
afe0d5
* Wed Sep 19 2018 Tomas Orsava <torsava@redhat.com> - 1.0-5.f2d38ce.git
afe0d5
- Require the Python interpreter directly instead of using the package name
afe0d5
- Related: rhbz#1619153
afe0d5
afe0d5
* Thu Jul 19 2018 Jan Pokorný <jpokorny+rpm-booth@redhat.com> - 1.0-4.f2d38ce.git
afe0d5
- revert back to using asciidoc instead of asciidoctor for generating man pages
afe0d5
  (rhbz#1603119)
afe0d5
- fix some issues in the shell scripts (rhbz#1602455)
afe0d5
afe0d5
* Mon Jul 16 2018 Jan Pokorný <jpokorny+rpm-booth@redhat.com> - 1.0-3.f2d38ce.git
afe0d5
- update for another, current snapshot beyond booth-1.0
afe0d5
  (commit f2d38ce), including:
afe0d5
  . support for solely manually managed tickets (9a365f9)
afe0d5
  . use asciidoctor instead of asciidoc for generating man pages (65e6a6b)
afe0d5
- switch to using Python 3 for the tests instead of Python 2
afe0d5
  (behind unversioned "python" references; rhbz#1590856)
afe0d5
afe0d5
* Thu Jun 21 2018 Troy Dawson <tdawson@redhat.com> - 1.0-2.570876d.git.3
afe0d5
- Fix python shebangs (#1580601)
afe0d5
afe0d5
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-2.570876d.git.2
afe0d5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
afe0d5
afe0d5
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-2.570876d.git.1
afe0d5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
afe0d5
afe0d5
* Wed May 25 2016 Jan Pokorný <jpokorny+rpm-booth@fedoraproject.org> - 1.0-3.570876d.git
afe0d5
- update per the changesets recently accepted by the upstream
afe0d5
  (memory/resource leaks fixes, patches previously attached separately
afe0d5
  that make unit test pass, internal cleanups, etc.)
afe0d5
afe0d5
* Thu May 05 2016 Jan Pokorný <jpokorny+rpm-booth@fedoraproject.org> - 1.0-2.eb4256a.git
afe0d5
- update a subset of out-of-tree patches per
afe0d5
  https://github.com/ClusterLabs/booth/pull/22#issuecomment-216936987
afe0d5
- pre-inclusion cleanups in the spec (apply systemd scriptlet operations
afe0d5
  with booth-arbitrator, avoid overloading file implicitly considered %%doc
afe0d5
  as %%license)
afe0d5
  Resolves: rhbz#1314865
afe0d5
  Related: rhbz#1333509
afe0d5
afe0d5
* Thu Apr 28 2016 Jan Pokorný <jpokorny+rpm-booth@fedoraproject.org> - 1.0-1.eb4256a.git
afe0d5
- initial build