Create collection artifact subpackage, for AH

Disabled by default, to be enabled in COPR builds.

Related: rhbz1843859
This commit is contained in:
Pavel Cahyna 2021-08-26 09:32:50 +02:00
parent b4b2964c0d
commit 1c80434482

View File

@ -4,6 +4,8 @@
%bcond_without ansible %bcond_without ansible
%endif %endif
%bcond_with collection_artifact
%global collection_namespace_orig fedora %global collection_namespace_orig fedora
%global collection_name_orig linux_mgmt %global collection_name_orig linux_mgmt
@ -19,7 +21,7 @@ Name: ansible-collection-%{collection_namespace}-%{collection_name}
Url: https://github.com/pcahyna/fedora.linux_mgmt/ Url: https://github.com/pcahyna/fedora.linux_mgmt/
Summary: Ansible Collection of general system management and utility modules and other plugins Summary: Ansible Collection of general system management and utility modules and other plugins
Version: 1.0.0 Version: 1.0.0
Release: 1%{?dist} Release: 2%{?dist}
License: GPLv3+ License: GPLv3+
@ -33,7 +35,7 @@ License: GPLv3+
# Not used (yet). Could be made to point to AH in RHEL - but what about CentOS Stream? # Not used (yet). Could be made to point to AH in RHEL - but what about CentOS Stream?
#%%{!?ansible_collection_url:%%define ansible_collection_url() https://galaxy.ansible.com/%%{collection_namespace}/%%{collection_name}} #%%{!?ansible_collection_url:%%define ansible_collection_url() https://galaxy.ansible.com/%%{collection_namespace}/%%{collection_name}}
%{!?ansible_collection_files:%define ansible_collection_files %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}/} %{!?ansible_collection_files:%define ansible_collection_files %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}}
%if %{with ansible} %if %{with ansible}
BuildRequires: ansible >= 2.9.10 BuildRequires: ansible >= 2.9.10
@ -79,6 +81,14 @@ Provides: ansible-collection(%{collection_namespace}.%{collection_name}) = %{col
%{summary}. %{summary}.
Targeted at GNU/Linux systems. Targeted at GNU/Linux systems.
%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 %prep
%autosetup -n %{extractdir} %autosetup -n %{extractdir}
@ -100,11 +110,28 @@ mv galaxy.yml.new galaxy.yml
%install %install
%ansible_collection_install %ansible_collection_install
%if %{with collection_artifact}
# Copy collection artifact to /usr/share/ansible/collections/ for collection-artifact
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
%endif
%files %files
%dir %{_datadir}/ansible %dir %{_datadir}/ansible
%license COPYING %license COPYING
%{ansible_collection_files} %{ansible_collection_files}
%if %{with collection_artifact}
%files collection-artifact
%{_datadir}/ansible/collections/%{collection_namespace}-%{collection_name}-%{version}.tar.gz
%endif
%changelog %changelog
* Thu Aug 26 2021 Pavel Cahyna <pcahyna@redhat.com> - 1.0.0-2
- Create collection artifact subpackage, disabled by default
Taken from rhel-system-roles.
* Thu Aug 05 2021 Pavel Cahyna <pcahyna@redhat.com> - 1.0.0-1 * Thu Aug 05 2021 Pavel Cahyna <pcahyna@redhat.com> - 1.0.0-1
- Initial version - Initial version