Building the collection artifact subpackage
Description: If "--with collection_artifact" is added to rh/fedpkg build, rhel/linux-system-roles-collection-package is created. Notes: - have collection_artifact build always disabled by default - if building --with collection_artifact and without Ansible, fedpkg fails due to missing collection artifact (tarball). - copr build will specify --with collection_artifact explicitly. For %{without ansible}, ansible_collection_build generates tar at the collection top and ansible_collection_install untar from the tarball. Related: rhbz#1961404
This commit is contained in:
parent
57d713d910
commit
031963c284
@ -4,6 +4,8 @@
|
|||||||
%bcond_without ansible
|
%bcond_without ansible
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
%bcond_with collection_artifact
|
||||||
|
|
||||||
%if 0%{?rhel}
|
%if 0%{?rhel}
|
||||||
Name: rhel-system-roles
|
Name: rhel-system-roles
|
||||||
%else
|
%else
|
||||||
@ -12,7 +14,7 @@ Name: linux-system-roles
|
|||||||
Url: https://github.com/linux-system-roles/
|
Url: https://github.com/linux-system-roles/
|
||||||
Summary: Set of interfaces for unified system management
|
Summary: Set of interfaces for unified system management
|
||||||
Version: 1.0.1
|
Version: 1.0.1
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
|
|
||||||
#Group: Development/Libraries
|
#Group: Development/Libraries
|
||||||
License: GPLv3+ and MIT and BSD
|
License: GPLv3+ and MIT and BSD
|
||||||
@ -51,23 +53,19 @@ License: GPLv3+ and MIT and BSD
|
|||||||
BuildRequires: ansible >= 2.9.10
|
BuildRequires: ansible >= 2.9.10
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if %{undefined ansible_collection_build}
|
|
||||||
%if %{without ansible}
|
%if %{without ansible}
|
||||||
# Empty command. We don't have ansible-galaxy.
|
# Empty command. We don't have ansible-galaxy.
|
||||||
%define ansible_collection_build() :
|
%define ansible_collection_build() tar -cf %{_tmppath}/%{collection_namespace}-%{collection_name}-%{version}.tar.gz .
|
||||||
%else
|
%else
|
||||||
%define ansible_collection_build() ansible-galaxy collection build
|
%define ansible_collection_build() ansible-galaxy collection build
|
||||||
%endif
|
%endif
|
||||||
%endif
|
|
||||||
|
|
||||||
%if %{undefined ansible_collection_install}
|
|
||||||
%if %{without ansible}
|
%if %{without ansible}
|
||||||
# Simply copy everything instead of galaxy-installing the built artifact.
|
# 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}/
|
%define ansible_collection_install() mkdir -p %{buildroot}%{ansible_collection_files}/%{collection_name}; (cd %{buildroot}%{ansible_collection_files}/%{collection_name}; tar -xf %{_tmppath}/%{collection_namespace}-%{collection_name}-%{version}.tar.gz)
|
||||||
%else
|
%else
|
||||||
%define ansible_collection_install() ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz
|
%define ansible_collection_install() ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz
|
||||||
%endif
|
%endif
|
||||||
%endif
|
|
||||||
|
|
||||||
# For each role, call either defcommit() or deftag(). The other macros
|
# For each role, call either defcommit() or deftag(). The other macros
|
||||||
# (%%id and %%shortid) can be then used in the same way in both cases.
|
# (%%id and %%shortid) can be then used in the same way in both cases.
|
||||||
@ -256,6 +254,14 @@ consistent configuration interface for managing multiple versions
|
|||||||
of Fedora, Red Hat Enterprise Linux & CentOS.
|
of Fedora, Red Hat Enterprise Linux & CentOS.
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
%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
|
||||||
%setup -q -a1 -a2 -a3 -a4 -a5 -a6 -a7 -a8 -a9 -a10 -a11 -a12 -a13 -a14 -a15 -a16 -a17 -n %{getarchivedir 0}
|
%setup -q -a1 -a2 -a3 -a4 -a5 -a6 -a7 -a8 -a9 -a10 -a11 -a12 -a13 -a14 -a15 -a16 -a17 -n %{getarchivedir 0}
|
||||||
|
|
||||||
@ -384,30 +390,32 @@ rm -r .collections/ansible_collections/%{collection_namespace}/%{collection_name
|
|||||||
cp -p galaxy.yml lsr_role2collection/.ansible-lint \
|
cp -p galaxy.yml lsr_role2collection/.ansible-lint \
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}
|
.collections/ansible_collections/%{collection_namespace}/%{collection_name}
|
||||||
|
|
||||||
# converting README.md to README.html
|
pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
|
||||||
sh md2html.sh -l \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename1}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename2}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename3}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename4}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename5}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename6}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename7}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename8}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename9}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename10}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename11}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename12}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename13}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename14}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename15}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename16}/README.md \
|
|
||||||
.collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/%{rolename17}/README.md
|
|
||||||
|
|
||||||
cd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
|
# converting README.md to README.html
|
||||||
|
sh ../../../../md2html.sh -l \
|
||||||
|
README.md \
|
||||||
|
roles/%{rolename1}/README.md \
|
||||||
|
roles/%{rolename2}/README.md \
|
||||||
|
roles/%{rolename3}/README.md \
|
||||||
|
roles/%{rolename4}/README.md \
|
||||||
|
roles/%{rolename5}/README.md \
|
||||||
|
roles/%{rolename6}/README.md \
|
||||||
|
roles/%{rolename7}/README.md \
|
||||||
|
roles/%{rolename8}/README.md \
|
||||||
|
roles/%{rolename9}/README.md \
|
||||||
|
roles/%{rolename10}/README.md \
|
||||||
|
roles/%{rolename11}/README.md \
|
||||||
|
roles/%{rolename12}/README.md \
|
||||||
|
roles/%{rolename13}/README.md \
|
||||||
|
roles/%{rolename14}/README.md \
|
||||||
|
roles/%{rolename15}/README.md \
|
||||||
|
roles/%{rolename16}/README.md \
|
||||||
|
roles/%{rolename17}/README.md
|
||||||
%ansible_collection_build
|
%ansible_collection_build
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
%install
|
%install
|
||||||
mkdir -p $RPM_BUILD_ROOT%{installbase}
|
mkdir -p $RPM_BUILD_ROOT%{installbase}
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_datadir}/ansible/roles
|
mkdir -p $RPM_BUILD_ROOT%{_datadir}/ansible/roles
|
||||||
@ -638,7 +646,7 @@ mv $RPM_BUILD_ROOT%{_datadir}/ansible/roles/%{roleprefix}ha_cluster/examples/sim
|
|||||||
$RPM_BUILD_ROOT%{_pkgdocdir}/ha_cluster/example-simple-playbook.yml
|
$RPM_BUILD_ROOT%{_pkgdocdir}/ha_cluster/example-simple-playbook.yml
|
||||||
rmdir $RPM_BUILD_ROOT%{_datadir}/ansible/roles/%{roleprefix}ha_cluster/examples
|
rmdir $RPM_BUILD_ROOT%{_datadir}/ansible/roles/%{roleprefix}ha_cluster/examples
|
||||||
|
|
||||||
cd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
|
pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
|
||||||
%ansible_collection_install
|
%ansible_collection_install
|
||||||
|
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection
|
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection
|
||||||
@ -657,6 +665,14 @@ for rolename in %{rolenames}; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
%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
|
||||||
|
popd
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%if %{without ansible}
|
%if %{without ansible}
|
||||||
@ -756,7 +772,17 @@ done
|
|||||||
|
|
||||||
%{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
|
||||||
|
* Tue Apr 13 2021 Noriko Hosoi <nhosoi@redhat.com> - 1.0.1-2
|
||||||
|
- Adding the -collection-artifact subpackage, enabled using
|
||||||
|
"--with collection_artifact". It is used for importing to
|
||||||
|
ansible galaxy/automation hub.
|
||||||
|
|
||||||
* Tue Apr 6 2021 Pavel Cahyna <pcahyna@redhat.com> - 1.0.1-1
|
* Tue Apr 6 2021 Pavel Cahyna <pcahyna@redhat.com> - 1.0.1-1
|
||||||
- Sync with RHEL version 1.0.1-1.el8
|
- Sync with RHEL version 1.0.1-1.el8
|
||||||
Fix description field in galaxy.yml
|
Fix description field in galaxy.yml
|
||||||
|
Loading…
Reference in New Issue
Block a user