From 6b756590a3fd8d86baf8bc7c283832794b750c8c Mon Sep 17 00:00:00 2001 From: Pavel Cahyna Date: Thu, 18 Aug 2022 16:40:45 +0200 Subject: [PATCH] Change FQCN only in files from the right collection Before we were substituting community.general even in the main README.md. Related: rhbz2112434 --- ansible-collection-redhat-rhel_mgmt.spec | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ansible-collection-redhat-rhel_mgmt.spec b/ansible-collection-redhat-rhel_mgmt.spec index fb07452..d771dc8 100644 --- a/ansible-collection-redhat-rhel_mgmt.spec +++ b/ansible-collection-redhat-rhel_mgmt.spec @@ -119,16 +119,21 @@ for dir in %{_builddir}/.external/*/*; do name=$(basename "$dir") ns=$(basename $(dirname "$dir")) for module in "${modules[@]}"; do - cp -pL $dir/plugins/modules/$module plugins/modules/ + dest_module=plugins/modules/$(basename $module) + cp -pL $dir/plugins/modules/$module $dest_module + # Replacing original collection name by downstream (vendored) name + if [ "${ns}" != "%{collection_namespace}" ] || [ "${name}" != "%{collection_name}" ] ; then + sed "s/${ns}[.]${name}/%{collection_namespace}.%{collection_name}/g" -i $dest_module + fi done for module_util in "${module_utils[@]}"; do - cp -pL $dir/plugins/module_utils/$module_util plugins/module_utils/$module_util + dest_module_util=plugins/module_utils/$module_util + cp -pL $dir/plugins/module_utils/$module_util $dest_module_util + # Replacing original collection name by downstream (vendored) name + if [ "${ns}" != "%{collection_namespace}" ] || [ "${name}" != "%{collection_name}" ] ; then + sed "s/${ns}[.]${name}/%{collection_namespace}.%{collection_name}/g" -i $dest_module_util + fi done - # Replacing original collection name by downstream (vendored) name - if [ "${ns}" != "%{collection_namespace}" ] || [ "${name}" != "%{collection_name}" ] ; then - find -type f -exec \ - sed "s/${ns}[.]${name}/%{collection_namespace}.%{collection_name}/g" -i {} \; - fi done %endif