Transform galaxy.yml in %build instead of %prep

For cleaner sources and easier patching.

Patch galaxy.yml to add some metadata for the redfish_* modules.

Related: rhbz2112434
This commit is contained in:
Pavel Cahyna 2022-08-18 16:04:18 +02:00
parent 201700f72e
commit 8cf9810759
2 changed files with 27 additions and 3 deletions

View File

@ -67,6 +67,8 @@ Source: https://github.com/pcahyna/fedora.linux_mgmt/archive/%{collection_versio
# Collection tarballs from Galaxy
# Not used on Fedora.
Source901: https://galaxy.ansible.com/download/community-general-5.4.0.tar.gz
Patch1: redfish-metadata.patch
%endif
BuildArch: noarch
@ -102,6 +104,10 @@ Collection artifact for %{name}. This package contains %{collection_namespace}-%
%endif
%setup -n %{extractdir}
%if 0%{?rhel}
%patch1 -p1
%endif
%if 0%{?rhel}
modules=( remote_management/redfish/redfish_{command,config,info}.py )
module_utils=( redfish_utils.py )
@ -135,12 +141,10 @@ find -type f -exec \
# borrowed from from ansible-collection-ansible-netcommon
find -type f ! -executable -type f -name '*.py' -print -exec sed -i -e '1{\@^#!.*@d}' '{}' +
%{SOURCE1} %{collection_namespace} %{collection_name} %{collection_version} > galaxy.yml.new
mv galaxy.yml.new galaxy.yml
%build
mkdir -p .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
cp -a * .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
%{SOURCE1} %{collection_namespace} %{collection_name} %{collection_version} > .collections/ansible_collections/%{collection_namespace}/%{collection_name}/galaxy.yml
pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/
%ansible_collection_build

20
redfish-metadata.patch Normal file
View File

@ -0,0 +1,20 @@
diff -up fedora.linux_mgmt-1.0.0/galaxy.yml~ fedora.linux_mgmt-1.0.0/galaxy.yml
--- fedora.linux_mgmt-1.0.0/galaxy.yml~ 2022-08-18 15:51:16.694699074 +0200
+++ fedora.linux_mgmt-1.0.0/galaxy.yml 2022-08-18 15:54:51.257016538 +0200
@@ -19,6 +19,7 @@ readme: README.md
authors:
- Pavel Cahyna <pcahyna@redhat.com>
- Bulat Gaifullin (@bgaifullin) <gaifullinbf@gmail.com>
+- Jose Delarosa (@jose-delarosa)
### OPTIONAL but strongly recommended
@@ -32,7 +33,7 @@ license:
# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
# requirements as 'namespace' and 'name'
-tags: [ipmi, linux]
+tags: [ipmi, redfish, linux]
# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
# collection label 'namespace.name'. The value is a version range