diff --git a/.gitignore b/.gitignore index e69de29..2a441e4 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,4 @@ +/*.tar.gz +/*.src.rpm +/.build-*.log +/*/ diff --git a/resource-agents-sap-hana.spec b/resource-agents-sap-hana.spec new file mode 100644 index 0000000..bb00dff --- /dev/null +++ b/resource-agents-sap-hana.spec @@ -0,0 +1,207 @@ +# +# 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 is the script used to generate a new source file +# from the SAPHanaSR upstream git repo. +# +# TAG=$(git log --pretty="format:%h" -n 1) +# distdir="SAPHanaSR-${TAG}" +# TARFILE="${distdir}.tar.gz" +# rm -rf $TARFILE $distdir +# git archive --prefix=$distdir/ HEAD | gzip > $TARFILE +# + +%global upstream_prefix ClusterLabs-resource-agents +%global upstream_version e76b7d3a + +%global saphana_prefix SAPHanaSR +%global saphana_version 2dea8fe + +# Whether this platform defaults to using systemd as an init system +# (needs to be evaluated prior to BuildRequires being enumerated and +# installed as it's intended to conditionally select some of these, and +# for that there are only few indicators with varying reliability: +# - presence of systemd-defined macros (when building in a full-fledged +# environment, which is not the case with ordinary mock-based builds) +# - systemd-aware rpm as manifested with the presence of particular +# macro (rpm itself will trivially always be present when building) +# - existence of /usr/lib/os-release file, which is something heavily +# propagated by systemd project +# - when not good enough, there's always a possibility to check +# particular distro-specific macros (incl. version comparison) +%define systemd_native (%{?_unitdir:1}%{!?_unitdir:0}%{nil \ + } || %{?__transaction_systemd_inhibit:1}%{!?__transaction_systemd_inhibit:0}%{nil \ + } || %(test -f /usr/lib/os-release; test $? -ne 0; echo $?)) + +# determine the ras-set to process based on configure invokation +%bcond_with rgmanager +%bcond_without linuxha + +Name: resource-agents-sap-hana +Summary: SAP HANA cluster resource agents +Epoch: 1 +Version: 0.155.0 +Release: 1%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +License: GPLv2+ +URL: https://github.com/SUSE/SAPHanaSR +Source0: %{upstream_prefix}-%{upstream_version}.tar.gz +Source1: %{saphana_prefix}-%{saphana_version}.tar.gz + +BuildArch: noarch + +# Build dependencies +BuildRequires: make +BuildRequires: automake autoconf pkgconfig gcc +BuildRequires: perl-interpreter +BuildRequires: libxslt glib2-devel +BuildRequires: systemd +BuildRequires: which + +%if 0%{?fedora} || 0%{?centos} > 7 || 0%{?rhel} > 7 || 0%{?suse_version} +BuildRequires: python3-devel +%else +BuildRequires: python-devel +%endif + +%if 0%{?fedora} || 0%{?centos} || 0%{?rhel} +BuildRequires: docbook-style-xsl docbook-dtds +%if 0%{?rhel} == 0 +BuildRequires: libnet-devel +%endif +%endif + +%if 0%{?suse_version} +BuildRequires: libnet-devel +BuildRequires: libglue-devel +BuildRequires: libxslt docbook_4 docbook-xsl-stylesheets +%endif + +Requires: resource-agents >= 4.8.0 +Conflicts: %{name}-scaleout + +Requires: /bin/bash /usr/bin/grep /bin/sed /bin/gawk +Requires: perl + +%description +The SAP HANA resource agents interface with Pacemaker to allow +SAP instances to be managed in a cluster environment. + +%prep +%setup -q -n %{upstream_prefix}-%{upstream_version} +%setup -q -T -D -a 1 -n %{upstream_prefix}-%{upstream_version} + +# add SAPHana agents to Makefile.am +mv %{saphana_prefix}-%{saphana_version}/ra/SAPHana* heartbeat +sed -i -e '/ SAPInstance \\/a\ SAPHana \\\n SAPHanaTopology \\' heartbeat/Makefile.am +sed -i -e '/ ocf_heartbeat_SAPInstance.7 \\/a\ ocf_heartbeat_SAPHana.7 \\\n ocf_heartbeat_SAPHanaTopology.7 \\' doc/man/Makefile.am + +# change provider company +sed -i -e 's/\("provider_company": \)"SUSE"/\1"Red Hat"/g' %{saphana_prefix}-%{saphana_version}/srHook/SAPHanaSR.py + +%build +if [ ! -f configure ]; then + ./autogen.sh +fi + +%if 0%{?fedora} >= 11 || 0%{?centos} > 5 || 0%{?rhel} > 5 +CFLAGS="$(echo '%{optflags}')" +%global conf_opt_fatal "--enable-fatal-warnings=no" +%else +CFLAGS="${CFLAGS} ${RPM_OPT_FLAGS}" +%global conf_opt_fatal "--enable-fatal-warnings=yes" +%endif + +%if %{with rgmanager} +%global rasset rgmanager +%endif +%if %{with linuxha} +%global rasset linux-ha +%endif +%if %{with rgmanager} && %{with linuxha} +%global rasset all +%endif + +export CFLAGS + +%configure \ +%if 0%{?fedora} || 0%{?centos} > 7 || 0%{?rhel} > 7 || 0%{?suse_version} + PYTHON="%{__python3}" \ +%endif + %{conf_opt_fatal} \ +%if %{defined _unitdir} + --with-systemdsystemunitdir=%{_unitdir} \ +%endif +%if %{defined _tmpfilesdir} + --with-systemdtmpfilesdir=%{_tmpfilesdir} \ + --with-rsctmpdir=/run/resource-agents \ +%endif + --with-pkg-name=resource-agents \ + --with-ras-set=%{rasset} + +%if %{defined jobs} +JFLAGS="$(echo '-j%{jobs}')" +%else +JFLAGS="$(echo '%{_smp_mflags}')" +%endif + +make $JFLAGS + +%install +rm -rf %{buildroot} +make install DESTDIR=%{buildroot} + +# remove other agents +find %{buildroot}/usr/lib/ocf ! -type d ! -iname "SAPHana*" -exec rm {} \; +find %{buildroot}/%{_mandir} -type f ! -iname "*SAPHana*" -exec rm {} \; + +mkdir %{buildroot}/%{_datadir}/SAPHanaSR +cp -r %{saphana_prefix}-%{saphana_version}/srHook %{buildroot}/%{_datadir}/SAPHanaSR + +## tree fixup +# remove docs (there is only one and they should come from doc sections in files) +rm -rf %{buildroot}/usr/share/doc/resource-agents + +%files +%defattr(-,root,root) +%{_usr}/lib/ocf/resource.d/heartbeat/SAPHana* +%{_mandir}/man7/*SAP* +%{_datadir}/SAPHanaSR + +%exclude /etc +%exclude /usr/include +%exclude /usr/lib/debug +%exclude /usr/lib/systemd +%exclude /usr/lib/tmpfiles.d +%exclude /usr/libexec +%exclude /usr/sbin/ldirectord +%exclude /usr/sbin/ocf* +%exclude /usr/share/resource-agents +%exclude /usr/share/pkgconfig/resource-agents.pc +%exclude /usr/src + +%changelog +* Mon Jun 7 2021 Oyvind Albrigtsen - 0.155.0-1 +- Rebase to SAPHanaSR 0.155.0 upstream release. + +* Fri Feb 14 2020 Oyvind Albrigtsen - 0.154.0-2 +- Rebase to SAPHanaSR 0.154.0 upstream release. + + Resolves: rhbz#1802104 + +* Fri Sep 6 2019 Oyvind Albrigtsen - 0.152.22-1 +- SAPHanaTopology: make multi instance aware (MCOS) + + Resolves: rhbz#1738205 + +* Tue Jul 30 2019 Oyvind Albrigtsen - 0.152.21-4 +- Initial build as separate package + + Resolves: rhbz#1688344 diff --git a/sources b/sources new file mode 100644 index 0000000..62172a2 --- /dev/null +++ b/sources @@ -0,0 +1,2 @@ +SHA512 (ClusterLabs-resource-agents-e76b7d3a.tar.gz) = 218ab0dee7f07c2ae5646a0ea3231c33bd573de4f1b041ebed560074c256b21cf33836fe50f3a18eb1ec11c2f9a4515da1066d2e4932f59cea5b9b8af892a6a6 +SHA512 (SAPHanaSR-2dea8fe.tar.gz) = 80cf74d4ce878ccbf8fab9624102ad4c7c2a3eb0f2d960ec683af1650ae06276469cb18754b49c709d122bf800030b7d7bab09c904f71576ce66500737f27cbd