24db9e
# RPMs are split as follows:
24db9e
# * booth:
24db9e
#   - envelope package serving as a syntactic shortcut to install
24db9e
#     booth-site (with architecture reliably preserved)
24db9e
# * booth-core:
24db9e
#   - package serving as a base for booth-{arbitrator,site},
24db9e
#     carrying also basic documentation, license, etc.
24db9e
# * booth-arbitrator:
24db9e
#   - package to be installed at a machine accessible within HA cluster(s),
24db9e
#     but not (necessarily) a member of any, hence no dependency
24db9e
#     on anything from cluster stack is required
24db9e
# * booth-site:
24db9e
#   - package to be installed at a cluster member node
24db9e
#     (requires working cluster environment to be useful)
24db9e
# * booth-test:
24db9e
#   - files for testing booth
24db9e
#
24db9e
# TODO:
24db9e
# wireshark-dissector.lua currently of no use (rhbz#1259623), but if/when
24db9e
# this no longer persists, add -wireshark package (akin to libvirt-wireshark)
24db9e
24db9e
%bcond_with html_man
24db9e
%bcond_with glue
24db9e
61e743
%global specver 8
24db9e
%global boothver 1.0
24db9e
# set following to the actual commit or, for final release, concatenate
24db9e
# "boothver" macro to "v" (will yield a tag per the convention)
24db9e
%global commit ef769ef9614e8446f597ee4d26d5d339a491ab2f
24db9e
%global lparen (
24db9e
%global rparen )
24db9e
%global shortcommit %(c=%{commit}; case ${c} in
24db9e
                      v*%{rparen} echo ${c:1};;
24db9e
                      *%{rparen} echo ${c:0:7};; esac)
24db9e
%global pre_release %(s=%{shortcommit}; [ ${s: -3:2} != rc ]; echo $?)
24db9e
%global post_release %([ %{commit} = v%{shortcommit} ]; echo $?)
24db9e
%global github_owner ClusterLabs
24db9e
24db9e
%if 0%{pre_release}
24db9e
%global boothrel    0.%{specver}.%(s=%{shortcommit}; echo ${s: -3})
24db9e
%else
24db9e
%if 0%{post_release}
24db9e
%global boothrel    %{specver}.%{shortcommit}.git
24db9e
%else
24db9e
%global boothrel    %{specver}
24db9e
%endif
24db9e
%endif
24db9e
24db9e
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}}
24db9e
# https://fedoraproject.org/wiki/EPEL:Packaging?rd=Packaging:EPEL#The_.25license_tag
24db9e
%{!?_licensedir:%global license %doc}
24db9e
24db9e
%global test_path   %{_datadir}/booth/tests
24db9e
24db9e
Name:           booth
24db9e
Version:        %{boothver}
61e743
Release:        %{boothrel}%{?dist}
24db9e
Summary:        Ticket Manager for Multi-site Clusters
24db9e
Group:          System Environment/Daemons
24db9e
License:        GPLv2+
24db9e
Url:            https://github.com/%{github_owner}/%{name}
24db9e
Source0:        https://github.com/%{github_owner}/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
24db9e
Patch0: 0001-test-README-testing-indent-configuration-literal-par.patch
24db9e
Patch1: 0002-test-README-testing-provide-pcs-configuration-altern.patch
24db9e
Patch2: 0003-test-live_test-use-a-defined-literal-uniformly.patch
24db9e
Patch3: 0004-test-live_test-offer-alternatives-to-crm-pcs-native.patch
24db9e
Patch4: bz1341720-zealous-local-address-matching.patch
24db9e
Patch5: bz1366616-local_site_resolved_prevents_segfault.patch
61e743
Patch6: https://github.com/ClusterLabs/booth/commit/ef62b8cc3f0808e7e75fb608d096369e24135aa1.patch
24db9e
24db9e
# imposed by the same statement in pacemaker.spec
24db9e
%if 0%{?rhel} > 0
61e743
ExclusiveArch: i686 x86_64 aarch64 ppc64le s390x
61e743
24db9e
%endif
24db9e
24db9e
# direct build process dependencies
24db9e
BuildRequires:  autoconf
24db9e
BuildRequires:  automake
24db9e
BuildRequires:  coreutils
24db9e
BuildRequires:  make
24db9e
## ./autogen.sh
24db9e
BuildRequires:  /bin/sh
24db9e
# general build dependencies
24db9e
BuildRequires:  asciidoc
24db9e
BuildRequires:  gcc
24db9e
BuildRequires:  pkgconfig
24db9e
# linking dependencies
24db9e
BuildRequires:  libgcrypt-devel
24db9e
BuildRequires:  libxml2-devel
24db9e
## just for <pacemaker/crm/services.h> include
24db9e
BuildRequires:  pacemaker-libs-devel
24db9e
BuildRequires:  pkgconfig(glib-2.0)
24db9e
BuildRequires:  zlib-devel
24db9e
## logging provider
24db9e
BuildRequires:  pkgconfig(libqb)
24db9e
## random2range provider
24db9e
BuildRequires:  pkgconfig(glib-2.0)
24db9e
## nametag provider
24db9e
BuildRequires:  pkgconfig(libsystemd)
24db9e
# check scriptlet (for hostname and killall respectively)
24db9e
BuildRequires:  hostname psmisc
24db9e
BuildRequires:  python2-devel
24db9e
# spec file specifics
24db9e
## for _unitdir, systemd_requires and specific scriptlet macros
24db9e
BuildRequires:  systemd
24db9e
## for autosetup
24db9e
BuildRequires:  git
24db9e
24db9e
# this is for a composite-requiring-its-components arranged
24db9e
# as an empty package (empty files section) requiring subpackages
24db9e
# (_isa so as to preserve the architecture)
24db9e
Requires:       %{name}-core%{?_isa} = %{version}-%{release}
24db9e
Requires:       %{name}-site = %{version}-%{release}
24db9e
%files
24db9e
# intentionally empty
24db9e
24db9e
%description
24db9e
Booth manages tickets which authorize cluster sites located
24db9e
in geographically dispersed locations to run resources.
24db9e
It facilitates support of geographically distributed
24db9e
clustering in Pacemaker.
24db9e
24db9e
# SUBPACKAGES #
24db9e
24db9e
%package        core
24db9e
Summary:        Booth core files (executables, etc.)
24db9e
Group:          System Environment/Daemons
24db9e
# for booth-keygen (chown, dd)
24db9e
Requires:       coreutils
24db9e
# deal with pre-split arrangement
24db9e
Conflicts:      %{name} < 1.0-1
24db9e
24db9e
%description    core
24db9e
Core files (executables, etc.) for Booth, ticket manager for
24db9e
multi-site clusters.
24db9e
24db9e
%package        arbitrator
24db9e
Summary:        Booth support for running as an arbitrator
24db9e
Group:          System Environment/Daemons
24db9e
BuildArch:      noarch
24db9e
Requires:       %{name}-core = %{version}-%{release}
24db9e
%{?systemd_requires}
24db9e
# deal with pre-split arrangement
24db9e
Conflicts:      %{name} < 1.0-1
24db9e
24db9e
%description    arbitrator
24db9e
Support for running Booth, ticket manager for multi-site clusters,
24db9e
as an arbitrator.
24db9e
24db9e
%post arbitrator
24db9e
%systemd_post booth@.service booth-arbitrator.service
24db9e
24db9e
%preun arbitrator
24db9e
%systemd_preun booth@.service booth-arbitrator.service
24db9e
24db9e
%postun arbitrator
24db9e
%systemd_postun_with_restart booth@.service booth-arbitrator.service
24db9e
24db9e
%package        site
24db9e
Summary:        Booth support for running as a full-fledged site
24db9e
Group:          System Environment/Daemons
24db9e
BuildArch:      noarch
24db9e
Requires:       %{name}-core = %{version}-%{release}
24db9e
# for crm_{resource,simulate,ticket} utilities
24db9e
Requires:       pacemaker >= 1.1.8
24db9e
# for ocf-shellfuncs and other parts of OCF shell-based environment
24db9e
Requires:       resource-agents
24db9e
# deal with pre-split arrangement
24db9e
Conflicts:      %{name} < 1.0-1
24db9e
24db9e
%description    site
24db9e
Support for running Booth, ticket manager for multi-site clusters,
24db9e
as a full-fledged site.
24db9e
24db9e
%package        test
24db9e
Summary:        Test scripts for Booth
24db9e
Group:          System Environment/Daemons
24db9e
BuildArch:      noarch
24db9e
# runtests.py suite (for hostname and killall respectively)
24db9e
Requires:       hostname psmisc
24db9e
Requires:       python(abi) < 3
24db9e
# any of the following internal dependencies will pull -core package
24db9e
## for booth@booth.service
24db9e
Requires:       %{name}-arbitrator = %{version}-%{release}
24db9e
## for booth-site and service-runnable scripts
24db9e
## (and /usr/lib/ocf/resource.d/booth)
24db9e
Requires:       %{name}-site = %{version}-%{release}
24db9e
24db9e
%description    test
24db9e
Automated tests for running Booth, ticket manager for multi-site clusters.
24db9e
24db9e
# BUILD #
24db9e
24db9e
%prep
61e743
# fix issue with acutely broken .gitignore preventing later patch application
61e743
# (see first commit of https://github.com/ClusterLabs/booth/pull/70)
61e743
%global __scm_setup_git(q)\
61e743
rm -f .gitignore; %{expand:%__scm_setup_git %{-q}}
61e743
%autosetup -n %{name}-%{commit} -S git_am -p1
24db9e
24db9e
%build
24db9e
./autogen.sh
24db9e
%{configure} \
24db9e
        --with-initddir=%{_initrddir} \
24db9e
        --docdir=%{_pkgdocdir} \
24db9e
        --enable-user-flags \
24db9e
        %{!?with_html_man:--without-html_man} \
24db9e
        %{!?with_glue:--without-glue}
24db9e
%{make_build}
24db9e
24db9e
%install
24db9e
%{make_install}
24db9e
mkdir -p %{buildroot}/%{_unitdir}
24db9e
cp -a -t %{buildroot}/%{_unitdir} \
24db9e
        -- conf/booth@.service conf/booth-arbitrator.service
24db9e
install -D -m 644 -t %{buildroot}/%{_mandir}/man8 \
24db9e
        -- docs/boothd.8
24db9e
ln -s boothd.8 %{buildroot}/%{_mandir}/man8/booth.8
24db9e
cp -a -t %{buildroot}/%{_pkgdocdir} \
24db9e
        -- ChangeLog README-testing conf/booth.conf.example
24db9e
# drop what we don't package anyway (COPYING added via tarball-relative path)
24db9e
rm -rf %{buildroot}/%{_initrddir}/booth-arbitrator
24db9e
rm -rf %{buildroot}/%{_pkgdocdir}/README.upgrade-from-v0.1
24db9e
rm -rf %{buildroot}/%{_pkgdocdir}/COPYING
24db9e
# tests
24db9e
mkdir -p %{buildroot}/%{test_path}/conf
24db9e
cp -a -t %{buildroot}/%{test_path} \
24db9e
        -- test unit-tests script/unit-test.py
24db9e
cp -a -t %{buildroot}/%{test_path}/conf \
24db9e
        -- conf/booth.conf.example
24db9e
chmod +x %{buildroot}/%{test_path}/test/booth_path
24db9e
chmod +x %{buildroot}/%{test_path}/test/live_test.sh
24db9e
mkdir -p %{buildroot}/%{test_path}/src
24db9e
ln -s -t %{buildroot}/%{test_path}/src \
24db9e
        -- %{_sbindir}/boothd
24db9e
24db9e
%check
24db9e
# alternatively: test/runtests.py
24db9e
VERBOSE=1 make check
24db9e
24db9e
%files          core
24db9e
%license COPYING
24db9e
%doc %{_pkgdocdir}/AUTHORS
24db9e
%doc %{_pkgdocdir}/ChangeLog
24db9e
%doc %{_pkgdocdir}/README
24db9e
%doc %{_pkgdocdir}/booth.conf.example
24db9e
# core command(s) + man pages
24db9e
%{_sbindir}/booth*
24db9e
%{_mandir}/man8/booth*.8*
24db9e
# configuration
24db9e
%dir %{_sysconfdir}/booth
24db9e
%exclude %{_sysconfdir}/booth/booth.conf.example
24db9e
24db9e
%files          arbitrator
24db9e
%{_unitdir}/booth@.service
24db9e
%{_unitdir}/booth-arbitrator.service
24db9e
24db9e
%files          site
24db9e
# OCF (agent + a helper)
24db9e
## /usr/lib/ocf/resource.d/pacemaker provided by pacemaker
24db9e
/usr/lib/ocf/resource.d/pacemaker/booth-site
24db9e
%dir /usr/lib/ocf/lib/booth
24db9e
     /usr/lib/ocf/lib/booth/geo_attr.sh
24db9e
# geostore (command + OCF agent)
24db9e
%{_sbindir}/geostore
24db9e
%{_mandir}/man8/geostore.8*
24db9e
## /usr/lib/ocf/resource.d provided by resource-agents
24db9e
%dir /usr/lib/ocf/resource.d/booth
24db9e
     /usr/lib/ocf/resource.d/booth/geostore
24db9e
# helper (possibly used in the configuration hook)
24db9e
%dir %{_datadir}/booth
24db9e
     %{_datadir}/booth/service-runnable
24db9e
24db9e
%files          test
24db9e
%doc %{_pkgdocdir}/README-testing
24db9e
# /usr/share/booth provided by -site
24db9e
%{test_path}
24db9e
# /usr/lib/ocf/resource.d/booth provided by -site
24db9e
/usr/lib/ocf/resource.d/booth/sharedrsc
24db9e
24db9e
%changelog
61e743
* Tue Jun 26 2018 Jan Pokorný <jpokorny+rpm-booth@redhat.com> - 1.0-8.ef769ef.git
61e743
- build for aarch64
61e743
  Resolves: rhbz#1422615
61e743
- fix unconditional "dist" RPM macro reference in Release field
61e743
  Resolves: rhbz#1465933
61e743
- ensure booth-arbitrator service will get restarted when it fails
61e743
1cd185
* Mon Mar 27 2017 Jan Pokorný <jpokorny+rpm-booth@redhat.com> - 1.0-7.ef769ef.git
1cd185
- build for ppc64le
1cd185
  Resolves: rhbz#1402563
1cd185
24db9e
* Thu Sep 15 2016 Jan Pokorný <jpokorny+rpm-booth@redhat.com> - 1.0-6.ef769ef.git
24db9e
- fix an issue with identity self-determination based on match
24db9e
  between the addresses assigned at host and the configured addresses
24db9e
  when a network-part-of-the-address-only match preceded a possible
24db9e
  exact address match which would not be even tested if the length
24db9e
  of the network prefix was the same (no longer for this exact one)
24db9e
  Resolves: rhbz#1341720
24db9e
- fix a crash when running booth without determined identity
24db9e
  (e.g., existing, yet empty configuration) under some circumstances
24db9e
  Resolves: rhbz#1366616
24db9e
- make patches be applied using "git am" rather than "git apply"
24db9e
24db9e
* Wed Jun 22 2016 Jan Pokorný <jpokorny+rpm-booth@redhat.com> - 1.0-5.77d65dd.git
24db9e
- update per the the current upstream, most notably the support for
24db9e
  cluster-glue alternatives has been accepted (separate patches no
24db9e
  longer needed)
24db9e
- make the main (envelope) package properly require the subpackages
24db9e
  of the same version
24db9e
- add patches allowing for live_test.sh using pcs
24db9e
- allow building also against s390x architecture
24db9e
  (per Pacemaker dependency constraint)
24db9e
  Resolves: rhbz#1302087
24db9e
24db9e
* Wed May 25 2016 Jan Pokorný <jpokorny+rpm-booth@redhat.com> - 1.0-3.570876d.git
24db9e
- update per the changesets recently accepted by the upstream
24db9e
  (memory/resource leaks fixes, patches previously attached separately
24db9e
  that make unit test pass, internal cleanups, etc.)
24db9e
  Resolves: rhbz#1302087
24db9e
24db9e
* Mon May 09 2016 Jan Pokorný <jpokorny+rpm-booth@redhat.com> - 1.0-2.eb4256a.git
24db9e
- update a subset of out-of-tree patches per
24db9e
  https://github.com/ClusterLabs/booth/pull/22#issuecomment-216936987
24db9e
- pre-inclusion cleanups in the spec (apply systemd scriptlet operations
24db9e
  with booth-arbitrator, avoid overloading file implicitly considered %%doc
24db9e
  as %%license)
24db9e
  Resolves: rhbz#1302087
24db9e
  Related (Fedora): rhbz#1314865
24db9e
  Related (Fedora): rhbz#1333509
24db9e
24db9e
* Thu Apr 28 2016 Jan Pokorný <jpokorny+rpm-booth@fedoraproject.org> - 1.0-1.eb4256a.git
24db9e
- initial build