Related: #2003630, fix the version of the collection tar file

This commit is contained in:
Than Ngo 2021-10-15 18:20:50 +02:00
parent 4e1f97187d
commit 112dd6b589
1 changed files with 14 additions and 13 deletions

View File

@ -32,12 +32,15 @@
%global rolename3 sap-netweaver-preconfigure
%global src_owner linux-system-roles
%define irelease 12
# collection_version has to be increased by every rebuild
# otherwise, it cannot be uploaded to Automation Hub and Galaxy
# due to version conflict
%define collection_version 3.1.2
Name: %{package_name}
Summary: System Roles to configure RHEL for running SAP NetWeaver- or SAP HANA-based products
Version: 3.1.1
Release: %{irelease}%{?dist}
Release: 13%{?dist}
License: GPLv3+
Url: https://github.com/berndfinger
Source0: https://github.com/linux-system-roles/auto-maintenance/archive/%{mainid}/auto-maintenance-%{mainid}.tar.gz
@ -80,10 +83,8 @@ Requires: python-netaddr
BuildRequires: ansible >= 2.9.10
%endif
%global collection_version %{version}
%if %{undefined __ansible_provides}
Provides: ansible-collection(%{collection_namespace}.%{collection_name}) = %{collection_version}
Provides: ansible-collection(%{collection_namespace}.%{collection_name}) = %{version}
%endif
# be compatible with the usual Fedora Provides:
Provides: ansible-collection-%{collection_namespace}-%{collection_name} = %{version}-%{release}
@ -103,7 +104,7 @@ Provides: ansible-collection-%{collection_namespace}-%{collection_name} = %{vers
# 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}-%{irelease}.tar.gz
%define ansible_collection_install() ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{collection_version}.tar.gz
%endif
%endif
@ -116,7 +117,7 @@ to applicable SAP notes so that any SAP software can be installed.
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
Collection artifact for %{name}. This package contains %{collection_namespace}-%{collection_name}-%{collection_version}.tar.gz
%endif
%prep
@ -132,7 +133,7 @@ mkdir .collections
cp %{SOURCE5} galaxy.yml
sed -i -e "s|name: rhel|name: %{collection_name}|" galaxy.yml
# add correct version for Automation Hub and Galaxy
sed -i -e "s|version: 3.1.1|version: %{version}-%{irelease}|" galaxy.yml
sed -i -e "s|version: 3.1.1|version: %{collection_version}|" galaxy.yml
# remove git stuff
rm -rf *-preconfigure/.git*
@ -213,10 +214,7 @@ popd
%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
mv %{collection_namespace}-%{collection_name}-%{collection_version}.tar.gz $RPM_BUILD_ROOT%{_datadir}/ansible/collections/
popd
%endif
@ -234,10 +232,13 @@ popd
%if %{with collection_artifact}
%files collection-artifact
%{_datadir}/ansible/collections/%{collection_namespace}-%{collection_name}-%{version}-%{irelease}.tar.gz
%{_datadir}/ansible/collections/%{collection_namespace}-%{collection_name}-%{collection_version}.tar.gz
%endif
%changelog
* Fri Oct 15 2021 Than Ngo <than@redhat.com> - 3.1.1-13
- Fix the version of the collection tar file
* Fri Oct 15 2021 Than Ngo <than@redhat.com> - 3.1.1-12
- Resolves: #2003630, Pepare the roles for ansible-core 2.11: Only use ansible.core modules