From be3905d4aafa8a835d4a0305ba7251b8232aaead Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Mon, 16 Dec 2024 16:57:02 -0500 Subject: [PATCH] Consistently end scriptlets with exit 0 - Consistently end scriptlets with exit 0 - Resolves: RHEL-68848 --- java-21-openjdk.spec | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/java-21-openjdk.spec b/java-21-openjdk.spec index b51aeca..bff8642 100644 --- a/java-21-openjdk.spec +++ b/java-21-openjdk.spec @@ -488,7 +488,6 @@ %define post_script() %{expand: update-desktop-database %{_datadir}/applications &> /dev/null || : /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : -exit 0 } # 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 %{update_desktop_icons} fi -exit 0 } # 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}} update-desktop-database %{_datadir}/applications &> /dev/null || : /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : - -exit 0 } %define preun_devel() %{expand: @@ -655,7 +651,6 @@ if [ $1 -eq 0 ] ; then /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null %{update_desktop_icons} fi -exit 0 } %define posttrans_devel() %{expand: @@ -2160,9 +2155,15 @@ find $RPM_BUILD_ROOT/%{_jvmdir}/%{sdkdir -- $suffix}/legal -type f -exec chmod 6 # end, dual install 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} %post %{post_script %{nil}} +exit 0 # Allow upgrades from packages that have /usr/lib/jvm/java-21-openjdk # as an alternatives symlink, without running into the known RPM @@ -2185,27 +2186,35 @@ end %post headless %{post_headless %{nil}} +exit 0 %postun %{postun_script %{nil}} +exit 0 %preun headless %{preun_headless %{nil}} +exit 0 %posttrans %{posttrans_script %{nil}} +exit 0 %post devel %{post_devel %{nil}} +exit 0 %preun devel %{preun_devel %{nil}} +exit 0 %postun devel %{postun_devel %{nil}} +exit 0 %posttrans devel %{posttrans_devel %{nil}} +exit 0 %pretrans javadoc -p %{lua_delete_old_link -- %{_jvmdir}/%{sdkdir -- %{?1}}} @@ -2213,9 +2222,11 @@ end %post javadoc %{alternatives_javadoc_install %{nil}} +exit 0 %preun javadoc %{preun_javadoc %{nil}} +exit 0 %pretrans javadoc-zip -p %{lua_delete_old_link -- %{_jvmdir}/%{sdkdir -- %{?1}}} @@ -2223,68 +2234,87 @@ end %post javadoc-zip %{alternatives_javadoczip_install %{nil}} +exit 0 %preun javadoc-zip %{preun_javadoc_zip %{nil}} +exit 0 %endif %if %{include_debug_build} %post slowdebug %{post_script -- %{debug_suffix_unquoted}} +exit 0 %post headless-slowdebug %{post_headless -- %{debug_suffix_unquoted}} +exit 0 %postun slowdebug %{postun_script -- %{debug_suffix_unquoted}} +exit 0 %preun headless-slowdebug %{preun_headless -- %{debug_suffix_unquoted}} +exit 0 %posttrans slowdebug %{posttrans_script -- %{debug_suffix_unquoted}} +exit 0 %post devel-slowdebug %{post_devel -- %{debug_suffix_unquoted}} +exit 0 %preun devel-slowdebug %{preun_devel -- %{debug_suffix_unquoted}} +exit 0 %postun devel-slowdebug %{postun_devel -- %{debug_suffix_unquoted}} +exit 0 %posttrans devel-slowdebug %{posttrans_devel -- %{debug_suffix_unquoted}} +exit 0 %endif %if %{include_fastdebug_build} %post fastdebug %{post_script -- %{fastdebug_suffix_unquoted}} +exit 0 %post headless-fastdebug %{post_headless -- %{fastdebug_suffix_unquoted}} +exit 0 %postun fastdebug %{postun_script -- %{fastdebug_suffix_unquoted}} +exit 0 %preun headless-fastdebug %{preun_headless -- %{fastdebug_suffix_unquoted}} +exit 0 %posttrans fastdebug %{posttrans_script -- %{fastdebug_suffix_unquoted}} +exit 0 %post devel-fastdebug %{post_devel -- %{fastdebug_suffix_unquoted}} +exit 0 %preun devel-fastdebug %{preun_devel -- %{fastdebug_suffix_unquoted}} +exit 0 %postun devel-fastdebug %{postun_devel -- %{fastdebug_suffix_unquoted}} +exit 0 %posttrans devel-fastdebug %{posttrans_devel -- %{fastdebug_suffix_unquoted}} - +exit 0 %endif %if %{include_normal_build} @@ -2411,11 +2441,13 @@ end - Comment on alternatives removal in preun and RPM scriptlet idiom - Remove unused family macros - Document priority_for +- Consistently end scriptlets with exit 0 - Resolves: RHEL-71920 - Resolves: RHEL-71954 - Resolves: RHEL-69321 - Resolves: RHEL-69995 - Resolves: RHEL-71924 +- Resolves: RHEL-68848 * Tue Oct 29 2024 Troy Dawson - 1:21.0.5.0.11-2.1 - Bump release for October 2024 mass rebuild: