rhel-system-roles-sap/SPECS/rhel-system-roles-sap.spec

341 lines
13 KiB
RPMSpec

%if 0%{?rhel} && ! 0%{?epel}
%bcond_with ansible
%else
%bcond_without ansible
%endif
%bcond_with collection_artifact
%if 0%{?fedora} || 0%{?rhel} >= 8
%bcond_without html
%else
# pandoc is not supported in rhel 7 and older,
# which is needed for converting .md to .html.
%bcond_with html
%endif
%global collection_namespace sap
%if 0%{?rhel}
%define package_name rhel-system-roles-sap
%global collection_name rhel
%else
%define package_name linux-system-roles-sap
%global collection_name linux
%endif
%global mainid ec364d2e0bd422b69f34871a1188114f368097a0
%global gitcommit_sap 9bed558b55cedc8939f6b3d4436436a6aaaf095c
%global gitcommit_sap_hana 9f22b540bc41e2d10fbc1250b36a7ef08129feb2
%global gitcommit_sap_netweaver 337ba5580ba862e1adac59dcda8a126cdf561225
%global rolename1 sap-preconfigure
%global rolename2 sap-hana-preconfigure
%global rolename3 sap-netweaver-preconfigure
%global src_owner linux-system-roles
Name: %{package_name}
Summary: System Roles to configure RHEL for running SAP NetWeaver- or SAP HANA-based products
Version: 3.1.1
Release: 6%{?dist}.alma
License: GPLv3+
Url: https://github.com/berndfinger
Source0: https://github.com/linux-system-roles/auto-maintenance/archive/%{mainid}/auto-maintenance-%{mainid}.tar.gz
Source1: https://github.com/berndfinger/sap-preconfigure/archive/%{gitcommit_sap}/sap-preconfigure-%{gitcommit_sap}.tar.gz
Source2: https://github.com/berndfinger/sap-hana-preconfigure/archive/%{gitcommit_sap_hana}/sap-hana-preconfigure-%{gitcommit_sap_hana}.tar.gz
Source3: https://github.com/berndfinger/sap-netweaver-preconfigure/archive/%{gitcommit_sap_netweaver}/sap-netweaver-preconfigure-%{gitcommit_sap_netweaver}.tar.gz
Source4: README.md
Source5: galaxy.yml
# patches 0-49 for sap-preconfigure
Patch1: sap-preconfigure-69de334fecbce65506bbea15b1b9bcd643528352.patch
Patch2: sap-preconfigure-fa66c6722c0bf31c651c1d63972d9a32b9218ccf.patch
Patch3: sap-preconfigure-62908fd7a79a4ef0d38ce2e48bca5970eb0f2304.patch
# patches 50-99 for sap-hana-preconfigure
Patch50: sap-hana-preconfigure-md2html-error.patch
Patch51: sap-hana-preconfigure-f30be1952fe55cc4a5e153bfd13863f527643d40.patch
Patch52: sap-hana-preconfigure-61b366bb366f1dca0684d00f7cbf4563f71630e6.patch
Patch53: sap-hana-preconfigure-2557f321ab86bba4cbf463eaf69df8d1bb3a2261.patch
# patches 100-149 for sap-netweaver-preconfigur
Patch100: sap-netweaver-preconfigure-rhel9.patch
BuildArch: noarch
%if %{with html}
# Requirements for md2html.sh to build the documentation
%if 0%{?fedora} || 0%{?rhel} >= 9
BuildRequires: rubygem-kramdown-parser-gfm
%else
BuildRequires: pandoc
BuildRequires: asciidoc
BuildRequires: highlight
%endif
%endif
# Requirements for galaxy_transform.py
BuildRequires: python3
%if 0%{?fedora} || 0%{?rhel} >= 8
BuildRequires: python3dist(ruamel.yaml)
Requires: python3-jmespath
Requires: python3-netaddr
%else
BuildRequires: python3-ruamel-yaml
Requires: python-jmespath
Requires: python-netaddr
%endif
%if %{with ansible}
BuildRequires: ansible >= 2.9.10
%endif
%global collection_version %{version}
%if %{undefined __ansible_provides}
Provides: ansible-collection(%{collection_namespace}.%{collection_name}) = %{collection_version}
%endif
# be compatible with the usual Fedora Provides:
Provides: ansible-collection-%{collection_namespace}-%{collection_name} = %{version}-%{release}
%{!?ansible_collection_files:%define ansible_collection_files %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}/}
%if %{undefined ansible_collection_build}
%if %{without ansible}
# Empty command. We don't have ansible-galaxy.
%define ansible_collection_build() :
%else
%define ansible_collection_build() ansible-galaxy collection build
%endif
%endif
%if %{undefined ansible_collection_install}
%if %{without ansible}
# Simply copy everything instead of galaxy-installing the built artifact.
%define ansible_collection_install() mkdir -p %{buildroot}%{ansible_collection_files}; cp -a . %{buildroot}%{ansible_collection_files}/%{collection_name}/
%else
%define ansible_collection_install() ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz
%endif
%endif
%description
Collection of Ansible roles which configures a RHEL system according
to applicable SAP notes so that any SAP software can be installed.
%if %{with collection_artifact}
%package collection-artifact
Summary: Collection artifact to import to Automation Hub / Ansible Galaxy
%description collection-artifact
Collection artifact for %{name}. This package contains %{collection_namespace}-%{collection_name}-%{version}.tar.gz
%endif
%prep
%setup -q -a1 -a2 -a3 -n auto-maintenance-%{mainid}
# rename the source directories without gitcommit_sap
mv sap-preconfigure-%{gitcommit_sap} sap-preconfigure
mv sap-hana-preconfigure-%{gitcommit_sap_hana} sap-hana-preconfigure
mv sap-netweaver-preconfigure-%{gitcommit_sap_netweaver} sap-netweaver-preconfigure
# cp own galaxy.yml and rename the collection name correctly for Automation Hub and Galaxy
mkdir .collections
cp %{SOURCE5} galaxy.yml
sed -i -e 's|name: rhel|name: %{collection_name}|' galaxy.yml
pushd sap-preconfigure
%patch1 -p1
%patch2 -p1
%patch3 -p1
popd
pushd sap-hana-preconfigure
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch53 -p1
popd
pushd sap-netweaver-preconfigure
%patch100 -p1
popd
# remove git stuff
rm -rf *-preconfigure/.git*
# remove zero file
rm -f sap-hana-preconfigure/tasks/RedHat_6/recommendations.yml
# remove all SLES stuff and RHEL 6 stuff
rm -rf sap-hana-preconfigure/tasks/SLES/
rm -rf sap-hana-preconfigure/tasks/sapnote/1275776 # SLES - sapconf, saptune, etc
rm -rf sap-hana-preconfigure/tasks/sapnote/1944799 # SLES - HANA install and config guidelines
rm -f sap-hana-preconfigure/tasks/sapnote/1944799.yml
rm -f sap-hana-preconfigure/tasks/sapnote/2013638.yml # RHEL 6.5 - OS settings
rm -f sap-hana-preconfigure/tasks/sapnote/2136965.yml # RHEL 6.6 - OS settings
rm -f sap-hana-preconfigure/tasks/sapnote/2247020.yml # RHEL 6.7 - OS settings
rm -rf sap-hana-preconfigure/tasks/sapnote/2578899 # SLES 15 - installation
rm -rf sap-hana-preconfigure/tasks/sapnote/2684254 # SLES 15 - OS settings for HANA
rm -f sap-hana-preconfigure/vars/RedHat_6.5.yml
rm -f sap-hana-preconfigure/vars/RedHat_6.6.yml
rm -f sap-hana-preconfigure/vars/RedHat_6.7.yml
rm -f sap-hana-preconfigure/vars/SLES_15.yml
%build
sh md2html.sh \
sap-preconfigure/README.md \
sap-hana-preconfigure/README.md \
sap-netweaver-preconfigure/README.md
for role in %{rolename1} %{rolename2} %{rolename3} ; do
new_role="$(echo ${role/sap-/} | tr '-' '_')"
python3 lsr_role2collection.py --role "$role" \
--src-path "$role" \
--src-owner %{src_owner} \
--dest-path .collections \
--readme %{SOURCE4} \
--namespace %{collection_namespace} \
--collection %{collection_name} \
--new-role "$new_role" \
--extra-mapping "timesync:redhat.rhel_system_roles.timesync,storage:redhat.rhel_system_roles.storage,sap-preconfigure:sap.rhel.preconfigure,sap-hana-preconfigure:sap.rhel.hana_preconfigure,sap-netweaver-preconfigure:sap.rhel.netweaver_preconfigure"
done
rm -f .collections/ansible_collections/%{collection_namespace}/%{collection_name}/tests/sanity/ignore-2.9.txt
# Merge .sanity-ansible-ignore-2.9-ROLENAME.txt into tests/sanity/ignore-2.9.txt
for role in %{rolenames}; do
if [ -f .collections/ansible_collections/%{collection_namespace}/%{collection_name}/.sanity-ansible-ignore-2.9-"$role".txt ];
then
cat .collections/ansible_collections/%{collection_namespace}/%{collection_name}/.sanity-ansible-ignore-2.9-"$role".txt \
>> .collections/ansible_collections/%{collection_namespace}/%{collection_name}/tests/sanity/ignore-2.9.txt
rm -f .collections/ansible_collections/%{collection_namespace}/%{collection_name}/.sanity-ansible-ignore-*-"$role".txt
fi
done
# removing dot files/dirs
rm -rf .collections/ansible_collections/%{collection_namespace}/%{collection_name}/.[A-Za-z]*
cp -p galaxy.yml lsr_role2collection/.ansible-lint \
.collections/ansible_collections/%{collection_namespace}/%{collection_name}
# build collection file
cd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
%ansible_collection_build
%install
mkdir -p $RPM_BUILD_ROOT%{_datadir}/ansible/roles \
$RPM_BUILD_ROOT%{_pkgdocdir}/sap-hana-preconfigure \
$RPM_BUILD_ROOT%{_pkgdocdir}/sap-preconfigure \
$RPM_BUILD_ROOT%{_pkgdocdir}/sap-netweaver-preconfigure
cp -pR sap-hana-preconfigure sap-preconfigure sap-netweaver-preconfigure $RPM_BUILD_ROOT%{_datadir}/ansible/roles/
cp -p sap-hana-preconfigure/{README.md,LICENSE} $RPM_BUILD_ROOT%{_pkgdocdir}/sap-hana-preconfigure/
cp -p sap-preconfigure/{README.md,LICENSE} $RPM_BUILD_ROOT%{_pkgdocdir}/sap-preconfigure/
cp -p sap-netweaver-preconfigure/{README.md,LICENSE} $RPM_BUILD_ROOT%{_pkgdocdir}/sap-netweaver-preconfigure/
# install collection files
pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
%ansible_collection_install
popd
# install collection_artifact
%if %{with collection_artifact}
# Copy collection artifact to /usr/share/ansible/collections/ for collection-artifact
pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
if [ -f %{collection_namespace}-%{collection_name}-%{version}.tar.gz ]; then
mv %{collection_namespace}-%{collection_name}-%{version}.tar.gz \
$RPM_BUILD_ROOT%{_datadir}/ansible/collections/
fi
popd
%endif
%files
%dir %{_pkgdocdir}
%dir %{_pkgdocdir}/sap-preconfigure
%dir %{_pkgdocdir}/sap-hana-preconfigure
%dir %{_pkgdocdir}/sap-netweaver-preconfigure
%dir %{_datadir}/ansible
%dir %{_datadir}/ansible/roles
%doc %{_pkgdocdir}/*/README.md
%license %{_pkgdocdir}/*/LICENSE
%{_datadir}/ansible/roles/*
%{ansible_collection_files}
%if %{with collection_artifact}
%files collection-artifact
%{_datadir}/ansible/collections/%{collection_namespace}-%{collection_name}-%{version}.tar.gz
%endif
%changelog
* Wed Sep 08 2021 Than Ngo <than@redhat.com> - 3.1.1-6
- set min kernel version for RHEL 8.4 x86_64
- use grubby for setting tsx=on
- add tsx=on to the kernel command line unconditionally
* Wed Sep 01 2021 Than Ngo <than@redhat.com> - 3.1.1-5
- Related: #1928398, fix yum group install errors on RHEL 7
* Fri Aug 20 2021 Than Ngo <than@redhat.com> - 3.1.1-4
- Related: #1928398, fix #149, #177, #193, #194
* Mon Jul 12 2021 Than Ngo <than@redhat.com> - 3.1.1-3
- add missing __sap_preconfigure_envgroups for RHEL 7.x
- add __sap_hana_preconfigure_req_repos variables for RHEL 8.5 and later
Related: #1928398
* Thu Jul 01 2021 Than Ngo <than@redhat.com> - 3.1.1-2
- Related: #1928398, add missing changelogs
* Tue Jun 29 2021 Than Ngo <than@redhat.com> - 3.1.1-1
- Resolves: #1928398, rebase to 3.1.1 for Ansible Collections
* Fri Mar 05 2021 Than Ngo <than@redhat.com> - 3.0.1-4
- fixed issue #130 in sap-preconfigure
- fixed typos in README.md in sap_hana_preconfigure
- added detailed explanations for sap_hana_preconfigure_kernel_parameters_ppc64le in README.md
- fixed issue #170 in sap_hana_preconfigure
Related: #1891642
* Wed Feb 24 2021 Than Ngo <than@redhat.com> - 3.0.1-3
- Related: #1891642, fixed issue #125 in sap-preconfigure and #163 and #164 in sap-hana-preconfigure
* Thu Feb 18 2021 Than Ngo <than@redhat.com> - 3.0.1-2
- Related: #1891642, update sap-hana-preconfigure 3.0.1 and fixed Urls
* Thu Feb 18 2021 Than Ngo <than@redhat.com> - 3.0.1-1
- Related: #1891642, rebase to 3.0.1
* Mon Feb 15 2021 Than Ngo <than@redhat.com> - 3.0.0-2
- Related: #1891642, more fixes #145, #148, #149, #150 #147
* Thu Jan 28 2021 Than Ngo <than@redhat.com> - 3.0.0-1
- Resolves: #1891638, bug fixes
- Resolves: #1891642, new features
* Mon Sep 21 2020 Than Ngo <than@redhat.com> - 2.0.0-7
- Related: #1867027, fix #119
* Thu Aug 20 2020 Than Ngo <than@redhat.com> - 2.0.0-6
- Related: #1867027, fix #92
* Fri Aug 07 2020 Than Ngo <than@redhat.com> - 2.0.0-5
- Resolves: #1867027, more fixes for #89, #109, #110, #111, #112, #113, #114, #116
* Tue Jul 21 2020 Than Ngo <than@redhat.com> - 2.0.0-4
- Related: #1844190, more fixes for #84, #85, #86, #88, #98, #104, #105, #107
* Fri Jul 03 2020 Than Ngo <than@redhat.com> - 2.0.0-3
- Related: #1844190, drop 1944799.yml
* Mon Jun 29 2020 Than Ngo <than@redhat.com> - 2.0.0-2
- Related: #1844190, more fixes for #78, #79, #81, #82, #94-#97, #99, #101-#102
* Mon Jun 08 2020 Than Ngo <than@redhat.com> - 2.0.0-1
- Resolves: #1844190, rebase to 2.0.0
* Thu May 07 2020 Than Ngo <than@redhat.com> - 1.1.1-2
- Resolves: #1829495, fix summary
* Mon Oct 21 2019 Than Ngo <than@redhat.com> - 1.1.1-1
- rebase to 1.1.1
- always use ansible_hostname + ansible_domain instead of ansible_fqdn
- use {{ ansible_hostname }}.{{ ansible_domain }} instead of {{ ansible_fqdn }}
- added LC_ALL=C before commands for which the outputs are to be evaluated
* Thu Sep 12 2019 Than Ngo <than@redhat.com> - 1.1-1
- rebase to 1.1
* Fri Jun 28 2019 Than Ngo <than@redhat.com> - 1.0-1
- Initial release.