diff --git a/backport-Build-rpm-require-rpm-4.14.0-or-later.patch b/backport-Build-rpm-require-rpm-4.14.0-or-later.patch new file mode 100644 index 0000000000000000000000000000000000000000..9fb829b9e1b944a14ed4e40e5ac81e3a96d8a8c6 --- /dev/null +++ b/backport-Build-rpm-require-rpm-4.14.0-or-later.patch @@ -0,0 +1,39 @@ +From f66e08174fff4552ba3914f12e56517a2d5663e1 Mon Sep 17 00:00:00 2001 +From: Ken Gaillot +Date: Wed, 7 Aug 2024 16:45:01 -0500 +Subject: [PATCH 016/150] Build: rpm: require rpm 4.14.0 or later + +Both RHEL 8 and SUSE 15 provide it, so we can require it for 3.0.0 +--- + INSTALL.md | 2 +- + rpm/pacemaker.spec.in | 1 - + 2 files changed, 1 insertion(+), 2 deletions(-) + +diff --git a/INSTALL.md b/INSTALL.md +index a05e901e71..7ac85c9090 100644 +--- a/INSTALL.md ++++ b/INSTALL.md +@@ -54,7 +54,7 @@ Also: + | documentation | | python3-sphinx | python3-sphinx | python3-sphinx | + | documentation (PDF) | | latexmk texlive texlive-capt-of texlive-collection-xetex texlive-fncychap texlive-framed texlive-multirow texlive-needspace texlive-tabulary texlive-titlesec texlive-threeparttable texlive-upquote texlive-wrapfig texlive-xetex | texlive texlive-latex | texlive texlive-latex-extra | + | annotated source code as HTML via "make global" | | global | global | global | +-| RPM packages via "make rpm" | 4.11 or later | rpm | rpm | (n/a) | ++| RPM packages via "make rpm" | 4.14 or later | rpm | rpm | (n/a) | + | unit tests | 1.1.0 or later | libcmocka-devel | libcmocka-devel | libcmocka-dev | + + ## Optional Testing Dependencies +diff --git a/rpm/pacemaker.spec.in b/rpm/pacemaker.spec.in +index 7367f54868..ee2142df4f 100644 +--- a/rpm/pacemaker.spec.in ++++ b/rpm/pacemaker.spec.in +@@ -597,7 +597,6 @@ make %{_smp_mflags} check + && touch .CHECKED + } 2>&1 | sed 's/[fF]ail/faiil/g' # prevent false positives in rpmlint + [ -f .CHECKED ] && rm -f -- .CHECKED +-exit $? # TODO remove when rpm<4.14 compatibility irrelevant + + %install + # skip automake-native Python byte-compilation, since RPM-native one (possibly +-- +2.33.1.windows.1 + diff --git a/backport-Feature-python-Add-a-python-wrapper-for-crm_exit_str.patch b/backport-Feature-python-Add-a-python-wrapper-for-crm_exit_str.patch new file mode 100644 index 0000000000000000000000000000000000000000..bae9b60191b5c2a3c0a7d20a744ffdb9151e0950 --- /dev/null +++ b/backport-Feature-python-Add-a-python-wrapper-for-crm_exit_str.patch @@ -0,0 +1,104 @@ +From 8dbd0816c84b075b02e21f733376343ec60290a6 Mon Sep 17 00:00:00 2001 +From: Chris Lumens +Date: Mon, 3 Jun 2024 09:28:06 -0400 +Subject: [PATCH 022/150] Feature: python: Add a python wrapper for + crm_exit_str. + +We also need a new function to find libcrmcommon.so (and potentially, +other libraries in the future) in case we are running from the source +tree instead of on an installed system. This allows anything that +imports pacemaker.exitstatus to still function. +--- + python/pacemaker/Makefile.am | 3 ++- + python/pacemaker/_library.py | 38 ++++++++++++++++++++++++++++++++++ + python/pacemaker/exitstatus.py | 6 ++++++ + 3 files changed, 46 insertions(+), 1 deletion(-) + create mode 100644 python/pacemaker/_library.py + +diff --git a/python/pacemaker/Makefile.am b/python/pacemaker/Makefile.am +index df9cc46eef..99a137ad78 100644 +--- a/python/pacemaker/Makefile.am ++++ b/python/pacemaker/Makefile.am +@@ -1,5 +1,5 @@ + # +-# Copyright 2023 the Pacemaker project contributors ++# Copyright 2023-2024 the Pacemaker project contributors + # + # The version control history for this file may have further details. + # +@@ -10,6 +10,7 @@ + MAINTAINERCLEANFILES = Makefile.in + + pkgpython_PYTHON = __init__.py \ ++ _library.py \ + exitstatus.py + + nodist_pkgpython_PYTHON = buildoptions.py +diff --git a/python/pacemaker/_library.py b/python/pacemaker/_library.py +new file mode 100644 +index 0000000000..cd6bc4ef44 +--- /dev/null ++++ b/python/pacemaker/_library.py +@@ -0,0 +1,38 @@ ++"""A module providing private library management code.""" ++ ++__all__ = ["_libcrmcommon"] ++__copyright__ = "Copyright 2024 the Pacemaker project contributors" ++__license__ = "GNU Lesser General Public License version 2.1 or later (LGPLv2.1+)" ++ ++import ctypes ++from ctypes.util import find_library ++from glob import glob ++import os ++ ++from pacemaker.buildoptions import BuildOptions ++ ++ ++def load_library(basename): ++ """Find and load the library with the given base name.""" ++ path = find_library(basename) ++ ++ # If the library was not found anywhere in the default locations, also search ++ # for it in the build directory ++ if path is None: ++ # pylint: disable=protected-access ++ for d in glob("%s/lib/*/.libs" % BuildOptions._BUILD_DIR): ++ path = "%s/lib%s.so" % (d, basename) ++ ++ if os.path.exists(path): ++ break ++ ++ path = None ++ ++ if path is None: ++ raise FileNotFoundError(basename) ++ ++ return ctypes.cdll.LoadLibrary(path) ++ ++ ++_libcrmcommon = load_library("crmcommon") ++_libcrmcommon.crm_exit_str.restype = ctypes.c_char_p +diff --git a/python/pacemaker/exitstatus.py b/python/pacemaker/exitstatus.py +index 7294d518e7..03f7d2c8e2 100644 +--- a/python/pacemaker/exitstatus.py ++++ b/python/pacemaker/exitstatus.py +@@ -6,6 +6,8 @@ __license__ = "GNU Lesser General Public License version 2.1 or later (LGPLv2.1+ + + from enum import IntEnum, unique + ++from pacemaker._library import _libcrmcommon ++ + + # These values must be kept in sync with include/crm/common/results.h + @unique +@@ -60,3 +62,7 @@ class ExitStatus(IntEnum): + DEGRADED_PROMOTED = 191 + NONE = 193 + MAX = 255 ++ ++ def __str__(self): ++ """Given an ExitStatus, return the matching error string.""" ++ return _libcrmcommon.crm_exit_str(self.value).decode() +-- +2.33.1.windows.1 + diff --git a/backport-Low-schemas-Add-additional-node-types-to-the-crmadmi.patch b/backport-Low-schemas-Add-additional-node-types-to-the-crmadmi.patch new file mode 100644 index 0000000000000000000000000000000000000000..1a36e9d3bd22cd42367a58e8d2a0ad86647ba363 --- /dev/null +++ b/backport-Low-schemas-Add-additional-node-types-to-the-crmadmi.patch @@ -0,0 +1,42 @@ +From 2169d226538a75cdc1a8107bcd86499b21303fd7 Mon Sep 17 00:00:00 2001 +From: Chris Lumens +Date: Tue, 13 Aug 2024 10:58:23 -0400 +Subject: [PATCH 017/150] Low: schemas: Add additional node types to the + crmadmin schema. + +I think these always should have been present as options in the schema. +Without them, crmadmin output does not validate. +--- + xml/api/crmadmin-2.25.rng | 2 ++ + xml/api/crmadmin-2.4.rng | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/xml/api/crmadmin-2.25.rng b/xml/api/crmadmin-2.25.rng +index 973f6d4935..1400a2ceb7 100644 +--- a/xml/api/crmadmin-2.25.rng ++++ b/xml/api/crmadmin-2.25.rng +@@ -51,6 +51,8 @@ + member + remote + ping ++ cluster ++ guest + + + +diff --git a/xml/api/crmadmin-2.4.rng b/xml/api/crmadmin-2.4.rng +index 34c9ca4307..3866d97dc5 100644 +--- a/xml/api/crmadmin-2.4.rng ++++ b/xml/api/crmadmin-2.4.rng +@@ -58,6 +58,8 @@ + member + remote + ping ++ cluster ++ guest + + + +-- +2.33.1.windows.1 + diff --git a/pacemaker.spec b/pacemaker.spec index b13d36ec950fa75b7e6b274d0fc27ac5563e3ae2..dd470aff8af0c7184c37d0fb5806d3b017768e89 100644 --- a/pacemaker.spec +++ b/pacemaker.spec @@ -17,7 +17,7 @@ ## can be incremented to build packages reliably considered "newer" ## than previously built packages with the same pcmkversion) %global pcmkversion 2.1.8 -%global specversion 1 +%global specversion 2 ## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build %global commit 3980678f0372f2c7c294c01f61d63f0b2cafaad1 @@ -149,6 +149,12 @@ Url: https://www.clusterlabs.org/ # You can use "spectool -s 0 pacemaker.spec" (rpmdevtools) to show final URL. Source0: https://codeload.github.com/%{github_owner}/%{name}/tar.gz/%{archive_github_url} Source1: https://codeload.github.com/%{github_owner}/%{nagios_name}/tar.gz/%{nagios_archive_github_url} +Patch0: backport-Build-rpm-require-rpm-4.14.0-or-later.patch +# https://github.com/ClusterLabs/pacemaker/commit/f66e08174fff4552ba3914f12e56517a2d5663e1 +Patch1: backport-Low-schemas-Add-additional-node-types-to-the-crmadmi.patch +# https://github.com/ClusterLabs/pacemaker/commit/2169d226538a75cdc1a8107bcd86499b21303fd7 +Patch2: backport-Feature-python-Add-a-python-wrapper-for-crm_exit_str.patch +# https://github.com/ClusterLabs/pacemaker/commit/8dbd0816c84b075b02e21f733376343ec60290a6 Requires: resource-agents Requires: %{pkgname_pcmk_libs} = %{version}-%{release} @@ -756,6 +762,11 @@ exit 0 %license %{nagios_name}-%{nagios_hash}/COPYING %changelog +* Tue Sep 03 2024 liupei - 2.1.8-2 +- Build: rpm: require rpm 4.14.0 or later +- Low: schemas: Add additional node types to the crmadmin schema. +- Feature: python: Add a python wrapper for crm_exit_str. + * Sat Aug 31 2024 liupei - 2.1.8-1 - Update to version 2.1.8 - local options: support PCMK_panic_action="off" or "sync-off"