Remove doc fragments with sed oneliner

This commit is contained in:
Sergei Petrosian 2023-04-11 18:58:55 +02:00
parent 7d7acf657f
commit df519d40e3
1 changed files with 6 additions and 14 deletions

View File

@ -388,27 +388,19 @@ for module in "${!module_map[@]}"; do
if [ ! -f $moduledir/$module ]; then
moduledir=.external/community/general/plugins/modules/files
fi
module_target=$role/library/$module
cp -pL $moduledir/$module $module_target
ls -alrtF $module_target
cp -pL $moduledir/$module $role/library/$module
ls -alrtF $role/library/$module
sed -i -e ':a;N;$!ba;s/description:\n\( *\)/description:\n\1- WARNING: Do not use this module directly! It is only for role internal use.\n\1/' $role/library/$module
# Remove doc_fragments from vendored modules
if grep -q extends_documentation_fragment $module_target; then
top_line=$(grep extends_documentation_fragment $module_target -n | cut -d":" -f1)
bottom_line=$((top_line+1))
# While $bottom_line is still in the extends_documentation_fragment yaml list
while sed -n ${bottom_line}p $module_target | grep '\-\s' > /dev/null; do
rm_lines="$top_line,$bottom_line"
bottom_line=$((bottom_line+1))
done
sed -i "${rm_lines}d" $module_target
fi
# Remove doc_fragments
sed -i '/^extends_documentation_fragment:/,/^[^ -]/{/^extends/d;/^[ -]/d}' $role/library/$module
done
# Fix until the updated redhat_subscription.py is in community.general
cp %{SOURCE2301} rhc/library/redhat_subscription.py
sed -i -e ':a;N;$!ba;s/description:\n\( *\)/description:\n\1- WARNING: Do not use this module directly! It is only for role internal use.\n\1/' rhc/library/redhat_subscription.py
# Remove doc_fragments
sed -i '/^extends_documentation_fragment:/,/^[^ -]/{/^extends/d;/^[ -]/d}' rhc/library/redhat_subscription.py
# containers.podman:
# - library: