Consistently end scriptlets with exit 0

- Consistently end scriptlets with exit 0
- Resolves: RHEL-68848
This commit is contained in:
Thomas Fitzsimmons 2024-12-16 16:57:02 -05:00
parent 4c454ba831
commit be3905d4aa

View File

@ -488,7 +488,6 @@
%define post_script() %{expand: %define post_script() %{expand:
update-desktop-database %{_datadir}/applications &> /dev/null || : update-desktop-database %{_datadir}/applications &> /dev/null || :
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
exit 0
} }
# We want fastdebug and slowdebug alternatives to have a lower # We want fastdebug and slowdebug alternatives to have a lower
@ -537,7 +536,6 @@ if [ $1 -eq 0 ] ; then
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
%{update_desktop_icons} %{update_desktop_icons}
fi fi
exit 0
} }
# Perform alternatives removals in preun instead of postun so that we # Perform alternatives removals in preun instead of postun so that we
@ -629,8 +627,6 @@ alternatives --install %{_jvmdir}/java-%{javaver} java_sdk_%{javaver} %{_jvmdir}
%{alternatives_javac_install -- %{?1}} %{alternatives_javac_install -- %{?1}}
update-desktop-database %{_datadir}/applications &> /dev/null || : update-desktop-database %{_datadir}/applications &> /dev/null || :
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
exit 0
} }
%define preun_devel() %{expand: %define preun_devel() %{expand:
@ -655,7 +651,6 @@ if [ $1 -eq 0 ] ; then
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
%{update_desktop_icons} %{update_desktop_icons}
fi fi
exit 0
} }
%define posttrans_devel() %{expand: %define posttrans_devel() %{expand:
@ -2160,9 +2155,15 @@ find $RPM_BUILD_ROOT/%{_jvmdir}/%{sdkdir -- $suffix}/legal -type f -exec chmod 6
# end, dual install # end, dual install
done done
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/
# recommends an explicit "exit 0" at the end of each scriptlet. Keep
# them in this section instead of in the parameterized macro
# definitions, so that multiple macros can be called without worrying
# about which one ends with "exit 0".
%if %{include_normal_build} %if %{include_normal_build}
%post %post
%{post_script %{nil}} %{post_script %{nil}}
exit 0
# Allow upgrades from packages that have /usr/lib/jvm/java-21-openjdk # Allow upgrades from packages that have /usr/lib/jvm/java-21-openjdk
# as an alternatives symlink, without running into the known RPM # as an alternatives symlink, without running into the known RPM
@ -2185,27 +2186,35 @@ end
%post headless %post headless
%{post_headless %{nil}} %{post_headless %{nil}}
exit 0
%postun %postun
%{postun_script %{nil}} %{postun_script %{nil}}
exit 0
%preun headless %preun headless
%{preun_headless %{nil}} %{preun_headless %{nil}}
exit 0
%posttrans %posttrans
%{posttrans_script %{nil}} %{posttrans_script %{nil}}
exit 0
%post devel %post devel
%{post_devel %{nil}} %{post_devel %{nil}}
exit 0
%preun devel %preun devel
%{preun_devel %{nil}} %{preun_devel %{nil}}
exit 0
%postun devel %postun devel
%{postun_devel %{nil}} %{postun_devel %{nil}}
exit 0
%posttrans devel %posttrans devel
%{posttrans_devel %{nil}} %{posttrans_devel %{nil}}
exit 0
%pretrans javadoc -p <lua> %pretrans javadoc -p <lua>
%{lua_delete_old_link -- %{_jvmdir}/%{sdkdir -- %{?1}}} %{lua_delete_old_link -- %{_jvmdir}/%{sdkdir -- %{?1}}}
@ -2213,9 +2222,11 @@ end
%post javadoc %post javadoc
%{alternatives_javadoc_install %{nil}} %{alternatives_javadoc_install %{nil}}
exit 0
%preun javadoc %preun javadoc
%{preun_javadoc %{nil}} %{preun_javadoc %{nil}}
exit 0
%pretrans javadoc-zip -p <lua> %pretrans javadoc-zip -p <lua>
%{lua_delete_old_link -- %{_jvmdir}/%{sdkdir -- %{?1}}} %{lua_delete_old_link -- %{_jvmdir}/%{sdkdir -- %{?1}}}
@ -2223,68 +2234,87 @@ end
%post javadoc-zip %post javadoc-zip
%{alternatives_javadoczip_install %{nil}} %{alternatives_javadoczip_install %{nil}}
exit 0
%preun javadoc-zip %preun javadoc-zip
%{preun_javadoc_zip %{nil}} %{preun_javadoc_zip %{nil}}
exit 0
%endif %endif
%if %{include_debug_build} %if %{include_debug_build}
%post slowdebug %post slowdebug
%{post_script -- %{debug_suffix_unquoted}} %{post_script -- %{debug_suffix_unquoted}}
exit 0
%post headless-slowdebug %post headless-slowdebug
%{post_headless -- %{debug_suffix_unquoted}} %{post_headless -- %{debug_suffix_unquoted}}
exit 0
%postun slowdebug %postun slowdebug
%{postun_script -- %{debug_suffix_unquoted}} %{postun_script -- %{debug_suffix_unquoted}}
exit 0
%preun headless-slowdebug %preun headless-slowdebug
%{preun_headless -- %{debug_suffix_unquoted}} %{preun_headless -- %{debug_suffix_unquoted}}
exit 0
%posttrans slowdebug %posttrans slowdebug
%{posttrans_script -- %{debug_suffix_unquoted}} %{posttrans_script -- %{debug_suffix_unquoted}}
exit 0
%post devel-slowdebug %post devel-slowdebug
%{post_devel -- %{debug_suffix_unquoted}} %{post_devel -- %{debug_suffix_unquoted}}
exit 0
%preun devel-slowdebug %preun devel-slowdebug
%{preun_devel -- %{debug_suffix_unquoted}} %{preun_devel -- %{debug_suffix_unquoted}}
exit 0
%postun devel-slowdebug %postun devel-slowdebug
%{postun_devel -- %{debug_suffix_unquoted}} %{postun_devel -- %{debug_suffix_unquoted}}
exit 0
%posttrans devel-slowdebug %posttrans devel-slowdebug
%{posttrans_devel -- %{debug_suffix_unquoted}} %{posttrans_devel -- %{debug_suffix_unquoted}}
exit 0
%endif %endif
%if %{include_fastdebug_build} %if %{include_fastdebug_build}
%post fastdebug %post fastdebug
%{post_script -- %{fastdebug_suffix_unquoted}} %{post_script -- %{fastdebug_suffix_unquoted}}
exit 0
%post headless-fastdebug %post headless-fastdebug
%{post_headless -- %{fastdebug_suffix_unquoted}} %{post_headless -- %{fastdebug_suffix_unquoted}}
exit 0
%postun fastdebug %postun fastdebug
%{postun_script -- %{fastdebug_suffix_unquoted}} %{postun_script -- %{fastdebug_suffix_unquoted}}
exit 0
%preun headless-fastdebug %preun headless-fastdebug
%{preun_headless -- %{fastdebug_suffix_unquoted}} %{preun_headless -- %{fastdebug_suffix_unquoted}}
exit 0
%posttrans fastdebug %posttrans fastdebug
%{posttrans_script -- %{fastdebug_suffix_unquoted}} %{posttrans_script -- %{fastdebug_suffix_unquoted}}
exit 0
%post devel-fastdebug %post devel-fastdebug
%{post_devel -- %{fastdebug_suffix_unquoted}} %{post_devel -- %{fastdebug_suffix_unquoted}}
exit 0
%preun devel-fastdebug %preun devel-fastdebug
%{preun_devel -- %{fastdebug_suffix_unquoted}} %{preun_devel -- %{fastdebug_suffix_unquoted}}
exit 0
%postun devel-fastdebug %postun devel-fastdebug
%{postun_devel -- %{fastdebug_suffix_unquoted}} %{postun_devel -- %{fastdebug_suffix_unquoted}}
exit 0
%posttrans devel-fastdebug %posttrans devel-fastdebug
%{posttrans_devel -- %{fastdebug_suffix_unquoted}} %{posttrans_devel -- %{fastdebug_suffix_unquoted}}
exit 0
%endif %endif
%if %{include_normal_build} %if %{include_normal_build}
@ -2411,11 +2441,13 @@ end
- Comment on alternatives removal in preun and RPM scriptlet idiom - Comment on alternatives removal in preun and RPM scriptlet idiom
- Remove unused family macros - Remove unused family macros
- Document priority_for - Document priority_for
- Consistently end scriptlets with exit 0
- Resolves: RHEL-71920 - Resolves: RHEL-71920
- Resolves: RHEL-71954 - Resolves: RHEL-71954
- Resolves: RHEL-69321 - Resolves: RHEL-69321
- Resolves: RHEL-69995 - Resolves: RHEL-69995
- Resolves: RHEL-71924 - Resolves: RHEL-71924
- Resolves: RHEL-68848
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1:21.0.5.0.11-2.1 * Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1:21.0.5.0.11-2.1
- Bump release for October 2024 mass rebuild: - Bump release for October 2024 mass rebuild: