%global debug_package %{nil} %global collection_namespace theforeman %global collection_name foreman %global collection_folder %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}/%{collection_name} %if 0%{?fedora} || 0%{?rhel} >= 8 %global ansible_python python3 %else %global ansible_python python2 %endif %global release 1 %global prerelease .pre.master %global git_commit 853f984 %global git_date 20190820101500 %global nightly .%{?git_date}%{?git_commit:git}%{?git_commit} Name: ansible-collection-%{collection_namespace}-%{collection_name} Version: 0.0.0 Release: %{?prerelease:0.}%{release}%{?prerelease}%{?nightly}%{?dist} Summary: The Foreman Project Ansible modules collection License: GPLv3+ URL: https://theforeman.org/plugins/foreman-ansible-modules # this will be replaced with the tarball link from galaxy as soon as we publish to galaxy Source0: https://codeload.github.com/theforeman/foreman-ansible-modules/tar.gz/%{git_commit}#/ansible-collection-theforeman-foreman-%{version}.tar.gz BuildArch: noarch Requires: ansible >= 2.8 Requires: %{ansible_python}-apypie >= 0.0.5 %description Collection %prep # this will be updated after the galaxy publish too %setup -q -n foreman-ansible-modules-%{git_commit} # drop nailgun modules, we don't want them shipped rm -f plugins/module_utils/ansible_nailgun_cement.py grep -rl ansible_nailgun_cement plugins/modules/ | xargs rm -f # fix the imports to use the collection namespace # this will ideally happen on publish to galaxy sed -i '/ansible.module_utils.foreman_helper/ s/ansible.module_utils/ansible_collections.theforeman.foreman.plugins.module_utils/g' plugins/modules/*.py sed -i '/extends_documentation_fragment/ s/foreman/ansible_collections.theforeman.foreman.foreman/g' plugins/modules/*.py %build %install mkdir -p %{buildroot}%{collection_folder} cp -pR plugins %{buildroot}%{collection_folder} %files %{collection_folder}/ %license LICENSE %changelog * Wed Jul 17 2019 Evgeni Golov - 0.0.0-0 - Initial package