sap-hana-ha/sap-hana-ha.spec

137 lines
4.3 KiB
RPMSpec

#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
#
# Below are the steps to prepare the source files.
#
# 1) The script to generate a new source file from the SAPHanaSR
# upstream git repo.
#
# git switch main
# TAG=$(git log --pretty="format:%h" -n 1)
# distdir="sap-hana-ha-${TAG}"
# TARFILE="${distdir}.tar.gz"
# rm -rf $TARFILE $distdir
# git archive --prefix=$distdir/ HEAD | gzip > $TARFILE
#
# 2) Update sources with pattern replacements.
# Run ONCE and include the patches. Only re-run if patch conflictcs
# appeared and were solved.
#
# sh -x ./create-rename-patches.sh
#
# Always carefully review the results of the patches, there is no
# automatic check elsewhere!
# Use %%{name}
# %%global name sap-hana-ha
%global saphana_hash 87a5781
Name: sap-hana-ha
Summary: Cluster resource HA for SAP HANA in System Replication
Version: 1.2.8
Release: 2%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
License: GPLv2+
URL: https://github.com/SUSE/SAPHanaSR
Source0: %{name}-%{saphana_hash}.tar.gz
# Unpackaged source, just to make sure centpkg keeps it.
Source1: create-rename-patches.sh
# Patches that will always be needed.
# Other patches: handle conflicts if diff lines overlap
Patch100: patterns-srHook-files.patch
Patch101: patterns-ra-files.patch
Patch102: patterns-tools-files.patch
BuildArch: noarch
# Package dependencies
Requires: resource-agents >= 4.8.0
Conflicts: resource-agents-sap-hana
Conflicts: resource-agents-sap-hana-scaleout
Requires: /bin/bash /usr/bin/grep /bin/sed /bin/gawk
Requires: python3
%description
The SAP HANA resource agents and hook scripts interface with Pacemaker
to allow SAP HANA scale-up and scale-out instances to be managed in a cluster
environment.
%prep
# Unpack the source and apply patches automatically.
%autosetup -N -n %{name}-%{saphana_hash}
%autopatch -p 1
# Fail if there are patterns found after patching.
# Recreate the patches if the source files changed.
# Return success message for the final command RC=0.
grep -r \
-e "\"provider_company\": \"SUSE\"" \
-e "susChkSrv" \
-e "suschksrv" \
-e "susTkOver" \
-e "sustkover" \
-e "susHanaSR" \
-e "sushanasr" \
-e "SAPHanaSR-angi" \
-e "suse_SAPHanaFilesystem" \
srHook/ ra/ tools/ && {
echo -e "\v>>> CHECK FAILED: Patterns found after patching. Fix the patches.\v"
exit 1
} || echo "CHECK PASSED: No unpatched patterns found"
%install
# Dir structure
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/%{name}/samples
mkdir -p %{buildroot}%{_usr}/lib/%{name}
mkdir -p %{buildroot}%{_usr}/lib/ocf/resource.d/heartbeat
# Resource agents and r-a libraries
install -m 0755 ra/SAPHana* %{buildroot}%{_usr}/lib/ocf/resource.d/heartbeat
install -m 0644 ra/saphana-*-lib %{buildroot}%{_usr}/lib/%{name}
# Hook scripts - sanitize upstream names where needed
install -m 0644 srHook/susHanaSR.py %{buildroot}%{_datadir}/%{name}/HanaSR.py
install -m 0644 srHook/susChkSrv.py %{buildroot}%{_datadir}/%{name}/ChkSrv.py
# Select sample config files
install -m 0444 srHook/global.ini_susHanaSR %{buildroot}/%{_datadir}/%{name}/samples/global.ini_HanaSR
install -m 0444 srHook/global.ini_susChkSrv %{buildroot}/%{_datadir}/%{name}/samples/global.ini_ChkSrv
# Scripts for some add-on functionality.
# saphana_sr_tools is a lib imported by SAPHanaSR-* python scripts.
install -m 0555 tools/SAPHanaSR-showAttr %{buildroot}%{_bindir}
install -m 0444 tools/saphana_sr_tools.py %{buildroot}%{_usr}/lib/%{name}
%files
%defattr(-,root,root)
%license LICENSE
%dir %{_datadir}/%{name}
%dir %{_usr}/lib/%{name}
%{_bindir}/*
%{_datadir}/%{name}/*
%{_usr}/lib/ocf/resource.d/heartbeat/*
%{_usr}/lib/%{name}/*
%changelog
* Tue Aug 13 2024 Janine Fuchs <jfuchs@redhat.com> - 1.2.8-2
- Add package to RHEL 10.
Resolves: RHEL-53598
# vim:set ai ts=2 sw=2 sts=2 et: