Change FQCN only in files from the right collection

Before we were substituting community.general even in the main
README.md.

Related: rhbz2112434
This commit is contained in:
Pavel Cahyna 2022-08-18 16:40:45 +02:00
parent 8cf9810759
commit 6b756590a3

View File

@ -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