From 700feeb01062bef43edc6691ee632797f53fbac8 Mon Sep 17 00:00:00 2001 From: James Antill Date: Thu, 26 May 2022 01:02:07 -0400 Subject: [PATCH] Auto sync2gitlab import of booth-1.0-199.1.ac1d34c.git.el8.src.rpm --- .gitignore | 1 + ...uild-Do-not-link-with-pcmk-libraries.patch | 33 ++ ...ndle-updated-exit-code-of-crm_ticket.patch | 57 +++ EMPTY | 1 - booth.spec | 375 ++++++++++++++++++ sources | 1 + 6 files changed, 467 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 0001-build-Do-not-link-with-pcmk-libraries.patch create mode 100644 0002-pacemaker-Handle-updated-exit-code-of-crm_ticket.patch delete mode 100644 EMPTY create mode 100644 booth.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..09ee87e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/booth-1.0-199-ac1d34c.tar.gz diff --git a/0001-build-Do-not-link-with-pcmk-libraries.patch b/0001-build-Do-not-link-with-pcmk-libraries.patch new file mode 100644 index 0000000..d731299 --- /dev/null +++ b/0001-build-Do-not-link-with-pcmk-libraries.patch @@ -0,0 +1,33 @@ +From 2f944ea46b1b39113a34ca586cd8e3cd8f0d1d70 Mon Sep 17 00:00:00 2001 +From: Jan Friesse +Date: Wed, 3 Jun 2020 15:04:56 +0200 +Subject: [PATCH] build: Do not link with pcmk libraries + +Patch 4205de05fe337d1b1127fae302e6e6c2f0613ccf introduced better way to +check for pacemaker headers but also usage of PCMK_LIBS when linking +boothd. + +This is not needed, because boothd uses just crm/services.h header file +for inclusion of OCF return codes, so patch removes the use of PCMK_LIBS. + +Signed-off-by: Jan Friesse +--- + src/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Makefile.am b/src/Makefile.am +index 8598725..4023791 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -23,7 +23,7 @@ boothd_SOURCES += auth.c + endif + + boothd_LDFLAGS = $(OS_DYFLAGS) -L./ +-boothd_LDADD = -lm $(GLIB_LIBS) $(ZLIB_LIBS) $(PCMK_LIBS) ++boothd_LDADD = -lm $(GLIB_LIBS) $(ZLIB_LIBS) + boothd_CFLAGS = $(GLIB_CFLAGS) $(PCMK_CFLAGS) + + if !LOGGING_LIBQB +-- +2.18.2 + diff --git a/0002-pacemaker-Handle-updated-exit-code-of-crm_ticket.patch b/0002-pacemaker-Handle-updated-exit-code-of-crm_ticket.patch new file mode 100644 index 0000000..c72dabe --- /dev/null +++ b/0002-pacemaker-Handle-updated-exit-code-of-crm_ticket.patch @@ -0,0 +1,57 @@ +From bb58699a47a7b9070d555490f980c33caa3066e9 Mon Sep 17 00:00:00 2001 +From: Jan Friesse +Date: Mon, 8 Jun 2020 15:38:06 +0200 +Subject: [PATCH] pacemaker: Handle updated exit code of crm_ticket + +crm_ticket included since Pacemaker version 2.0.0-rc2 doesn't return +EPERM (1) error code any longer when ticket is updated without using +--force. Instead new value CRM_EX_INSUFFICIENT_PRIV (4) is used. + +This return value is used in the test_atomicity function which is +failing with new enough Pacemaker. + +Solution is to check also for return code 4. + +Also previously when unexpected code is returned, log contained full +return value as returned by system call. This is not very readable so +use only exit status (WEXITSTATUS) instead. + +Signed-off-by: Jan Friesse +--- + src/pacemaker.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/pacemaker.c b/src/pacemaker.c +index 7e3f9e6..1582fa8 100644 +--- a/src/pacemaker.c ++++ b/src/pacemaker.c +@@ -59,6 +59,7 @@ enum atomic_ticket_supported atomicity = UNKNOWN; + * - the old version asks for "Y/N" via STDIN, and returns 0 + * when reading "no"; + * - the new version just reports an error without asking. ++ * Since 2.0.0-rc2 error code is changed from 1 (EPERM) to 4 (CRM_EX_INSUFFICIENT_PRIV) + */ + static void test_atomicity(void) + { +@@ -86,7 +87,8 @@ static void test_atomicity(void) + log_info("Old \"crm_ticket\" found, using non-atomic ticket updates."); + break; + +- case 1: ++ case 1: /* Pacemaker < 2.0.0-rc2 - EPERM */ ++ case 4: /* Pacemaker >= 2.0.0-rc2 - CRM_EX_INSUFFICIENT_PRIV */ + atomicity = YES; + log_info("New \"crm_ticket\" found, using atomic ticket updates."); + break; +@@ -94,7 +96,7 @@ static void test_atomicity(void) + default: + log_error("Unexpected return value from \"crm_ticket\" (%d), " + "falling back to non-atomic ticket updates.", +- rv); ++ WEXITSTATUS(rv)); + atomicity = NO; + } + +-- +2.18.2 + diff --git a/EMPTY b/EMPTY deleted file mode 100644 index 0519ecb..0000000 --- a/EMPTY +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/booth.spec b/booth.spec new file mode 100644 index 0000000..ac6c163 --- /dev/null +++ b/booth.spec @@ -0,0 +1,375 @@ +# 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) + +%bcond_with html_man +%bcond_with glue +%bcond_with run_build_tests + +# set following to the result of `git describe --abbrev=128 $commit` +# This will be used to fill booth_ver, booth_numcomm and booth_sha1. +# It is important to keep abbrev to get full length sha1! When updating source use +# `spectool -g booth.spec` to download source. +%global git_describe_str v1.0-199-gac1d34ce172678a8f5ba415e976cf2366d45e15e + +# Set this to 1 when rebasing (changing git_describe_str) and increase otherwise +%global release 1 + +# Run shell script to parse git_describe str into version, numcomm and sha1 hash +%global booth_ver %(s=%{git_describe_str}; vver=${s%%%%-*}; echo ${vver:1}) +%global booth_numcomm %(s=%{git_describe_str}; t=${s#*-}; echo ${t%%%%-*}) +%global booth_sha1 %(s=%{git_describe_str}; t=${s##*-}; echo ${t:1}) +%global booth_short_sha1 %(s=%{booth_sha1}; echo ${s:0:7}) +%global booth_archive_name %{name}-%{booth_ver}-%{booth_numcomm}-%{booth_short_sha1} + +## User and group to use for nonprivileged services (should be in sync with pacemaker) +%global uname hacluster +%global gname haclient + +# 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 +Version: %{booth_ver} +Release: %{booth_numcomm}.%{release}.%{booth_short_sha1}.git%{?dist} +Summary: Ticket Manager for Multi-site Clusters +License: GPLv2+ +Url: https://github.com/%{github_owner}/%{name} +Source0: https://github.com/%{github_owner}/%{name}/archive/%{booth_short_sha1}/%{booth_archive_name}.tar.gz +Patch0: 0001-build-Do-not-link-with-pcmk-libraries.patch +Patch1: 0002-pacemaker-Handle-updated-exit-code-of-crm_ticket.patch + +# direct build process dependencies +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: coreutils +BuildRequires: make +## ./autogen.sh +BuildRequires: /bin/sh +# general build dependencies +BuildRequires: asciidoc +BuildRequires: gcc +BuildRequires: pkgconfig +# linking dependencies +BuildRequires: libgcrypt-devel +BuildRequires: libxml2-devel +## just for 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 +# For generating tests +BuildRequires: sed +# spec file specifics +## for _unitdir, systemd_requires and specific scriptlet macros +BuildRequires: systemd +## for autosetup +BuildRequires: git +%if 0%{?with_run_build_tests} +# check scriptlet (for perl and netstat) +BuildRequires: perl-interpreter net-tools +%endif + +# 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) +Requires: %{name}-core%{?_isa} +Requires: %{name}-site +%files +# intentionally empty + +%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. + +# SUBPACKAGES # + +%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 +%systemd_post booth@.service booth-arbitrator.service + +%preun arbitrator +%systemd_preun booth@.service booth-arbitrator.service + +%postun arbitrator +%systemd_postun_with_restart booth@.service booth-arbitrator.service + +%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 +Requires: %{__python3} +Requires: python3-pexpect +# runtests.py suite (for perl and netstat) +Requires: perl-interpreter net-tools + +%description test +Automated tests for running Booth, ticket manager for multi-site clusters. + +# BUILD # + +%prep +%autosetup -n %{name}-%{booth_sha1} -S git_am + +%build +./autogen.sh +%{configure} \ + --with-initddir=%{_initrddir} \ + --docdir=%{_pkgdocdir} \ + --enable-user-flags \ + %{?with_html_man:--with-html_man} \ + %{!?with_glue:--without-glue} \ + PYTHON=%{__python3} +%{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} +# Copy tests from tarball +cp -a -t %{buildroot}/%{test_path} \ + -- conf test unit-tests script/unit-test.py +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 +# 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 + +# https://fedoraproject.org/wiki/Packaging:Python_Appendix#Manual_byte_compilation +%py_byte_compile %{__python3} %{buildroot}/%{test_path} + +%check +# alternatively: test/runtests.py +%if 0%{?with_run_build_tests} +VERBOSE=1 make check +%endif + +%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 + +%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/booth/ +%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/booth/cores + +# Generated html docs +%if 0%{?with_html_man} +%{_pkgdocdir}/booth-keygen.8.html +%{_pkgdocdir}/boothd.8.html +%endif + +%files arbitrator +%{_unitdir}/booth@.service +%{_unitdir}/booth-arbitrator.service + +%files site +# OCF (agent + a helper) +## /usr/lib/ocf/resource.d/pacemaker provided by pacemaker +%{_usr}/lib/ocf/resource.d/pacemaker/booth-site +%dir %{_usr}/lib/ocf/lib/booth + %{_usr}/lib/ocf/lib/booth/geo_attr.sh +# geostore (command + OCF agent) +%{_sbindir}/geostore +%{_mandir}/man8/geostore.8* +## /usr/lib/ocf/resource.d provided by resource-agents +%dir %{_usr}/lib/ocf/resource.d/booth + %{_usr}/lib/ocf/resource.d/booth/geostore +# helper (possibly used in the configuration hook) +%dir %{_datadir}/booth + %{_datadir}/booth/service-runnable + +# Generated html docs +%if 0%{?with_html_man} +%{_pkgdocdir}/geostore.8.html +%endif + +%files test +%doc %{_pkgdocdir}/README-testing +# /usr/share/booth provided by -site +%{test_path} +# /usr/lib/ocf/resource.d/booth provided by -site +%{_usr}/lib/ocf/resource.d/booth/sharedrsc + +%changelog +* Thu Oct 15 2020 Jan Friesse - 1.0-199.1.ac1d34c.git +- Resolves: rhbz#1873948 +- Resolves: rhbz#1768172 + +- Fix versioning scheme to handle updates better +- Handle updated exit code of crm_ticket + +* Wed Jun 3 2020 Jan Friesse - 1.0-6.ac1d34c.git.2 +- Related: rhbz#1835831 + +- Do not link with the pcmk libraries +- Generate runtests.py and boothtestenv.py with -Es as make check does + +* Tue Jun 2 2020 Jan Friesse - 1.0-6.ac1d34c.git.1 +- Resolves: rhbz#1602455 +- Resolves: rhbz#1682122 +- Resolves: rhbz#1768369 +- Resolves: rhbz#1835831 + +- Update to current snapshot (commit ac1d34c) to fix test suite, + build warnings and build with gcc10 +- Fix hardcoded-library-path +- Package /var/lib/booth where booth can chroot +- Add '?dist' macro to release field +- Pass full path of Python3 to configure +- Add CI tests +- Enable gating + +* Wed Sep 19 2018 Tomas Orsava - 1.0-5.f2d38ce.git +- Require the Python interpreter directly instead of using the package name +- Related: rhbz#1619153 + +* Thu Jul 19 2018 Jan Pokorný - 1.0-4.f2d38ce.git +- revert back to using asciidoc instead of asciidoctor for generating man pages + (rhbz#1603119) +- fix some issues in the shell scripts (rhbz#1602455) + +* Mon Jul 16 2018 Jan Pokorný - 1.0-3.f2d38ce.git +- update for another, current snapshot beyond booth-1.0 + (commit f2d38ce), including: + . support for solely manually managed tickets (9a365f9) + . use asciidoctor instead of asciidoc for generating man pages (65e6a6b) +- switch to using Python 3 for the tests instead of Python 2 + (behind unversioned "python" references; rhbz#1590856) + +* Thu Jun 21 2018 Troy Dawson - 1.0-2.570876d.git.3 +- Fix python shebangs (#1580601) + +* Fri Feb 10 2017 Fedora Release Engineering - 1.0-2.570876d.git.2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Jul 19 2016 Fedora Release Engineering - 1.0-2.570876d.git.1 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Wed May 25 2016 Jan Pokorný - 1.0-3.570876d.git +- update per the changesets recently accepted by the upstream + (memory/resource leaks fixes, patches previously attached separately + that make unit test pass, internal cleanups, etc.) + +* Thu May 05 2016 Jan Pokorný - 1.0-2.eb4256a.git +- update a subset of out-of-tree patches per + https://github.com/ClusterLabs/booth/pull/22#issuecomment-216936987 +- pre-inclusion cleanups in the spec (apply systemd scriptlet operations + with booth-arbitrator, avoid overloading file implicitly considered %%doc + as %%license) + Resolves: rhbz#1314865 + Related: rhbz#1333509 + +* Thu Apr 28 2016 Jan Pokorný - 1.0-1.eb4256a.git +- initial build diff --git a/sources b/sources new file mode 100644 index 0000000..8a5f453 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (booth-1.0-199-ac1d34c.tar.gz) = 557bc42faceee65b272fefea6eaa8a6b2895f497fd0e20f2d29b15a967dc860cc0a518bae1c346fe5679714eb7b33ed14ff79ee087932c568b099529ec57fcfe