diff --git a/java-21-openjdk.spec b/java-21-openjdk.spec index 028c83d..1cd4efd 100644 --- a/java-21-openjdk.spec +++ b/java-21-openjdk.spec @@ -490,40 +490,6 @@ # not-duplicated scriptlets for normal/debug packages %global update_desktop_icons /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : -%define save_alternatives() %{expand: - # warning! alternatives are localised! - # LANG=cs_CZ.UTF-8 alternatives --display java | head - # LANG=en_US.UTF-8 alternatives --display java | head - function nonLocalisedAlternativesDisplayOfMaster() { - LANG=en_US.UTF-8 alternatives --display "$MASTER" - } - function headOfAbove() { - nonLocalisedAlternativesDisplayOfMaster | head -n $1 - } - MASTER="%{?1}" - LOCAL_LINK="%{?2}" - FAMILY="%{?3}" - rm -f %{_localstatedir}/lib/rpm-state/"$MASTER"_$FAMILY > /dev/null - if nonLocalisedAlternativesDisplayOfMaster > /dev/null ; then - if headOfAbove 1 | grep -q manual ; then - if headOfAbove 2 | tail -n 1 | grep -q %{compatiblename} ; then - headOfAbove 2 > %{_localstatedir}/lib/rpm-state/"$MASTER"_"$FAMILY" - fi - fi - fi -} - -%define save_and_remove_alternatives() %{expand: - if [ "x$debug" == "xtrue" ] ; then - set -x - fi - upgrade1_uninstal0=%{?3} - if [ "0$upgrade1_uninstal0" -gt 0 ] ; then # removal of this condition will cause persistence between uninstall - %{save_alternatives %{?1} %{?2} %{?4}} - fi - alternatives --remove "%{?1}" "%{?2}" -} - %define set_if_needed_alternatives() %{expand: MASTER="%{?1}" FAMILY="%{?2}" @@ -599,14 +565,16 @@ exit 0 %define postun_headless() %{expand: - if [ "x$debug" == "xtrue" ] ; then - set -x - fi - post_state=$1 # from postun, https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax - %{save_and_remove_alternatives java %{jrebindir -- %{?1}}/java $post_state %{family}} - %{save_and_remove_alternatives jre_%{origin} %{_jvmdir}/%{sdkdir -- %{?1}} $post_state %{family}} - %{save_and_remove_alternatives jre_%{javaver} %{_jvmdir}/%{sdkdir -- %{?1}} $post_state %{family}} - %{save_and_remove_alternatives jre_%{javaver}_%{origin} %{_jvmdir}/%{jrelnk -- %{?1}} $post_state %{family}} +if [ "x$debug" == "xtrue" ] ; then + set -x +fi +if [ $1 -eq 0 ] +then + alternatives --remove java %{jrebindir -- %{?1}}/java + alternatives --remove jre_%{origin} %{_jvmdir}/%{sdkdir -- %{?1}} + alternatives --remove jre_%{javaver} %{_jvmdir}/%{sdkdir -- %{?1}} + alternatives --remove jre_%{javaver}_%{origin} %{_jvmdir}/%{jrelnk -- %{?1}} +fi } %define posttrans_script() %{expand: @@ -714,14 +682,16 @@ exit 0 } %define postun_devel() %{expand: - if [ "x$debug" == "xtrue" ] ; then - set -x - fi - post_state=$1 # from postun, https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax - %{save_and_remove_alternatives javac %{sdkbindir -- %{?1}}/javac $post_state %{family}} - %{save_and_remove_alternatives java_sdk_%{origin} %{_jvmdir}/%{sdkdir -- %{?1}} $post_state %{family}} - %{save_and_remove_alternatives java_sdk_%{javaver} %{_jvmdir}/%{sdkdir -- %{?1}} $post_state %{family}} - %{save_and_remove_alternatives java_sdk_%{javaver}_%{origin} %{_jvmdir}/%{sdkdir -- %{?1}} $post_state %{family}} +if [ "x$debug" == "xtrue" ] ; then + set -x +fi +if [ $1 -eq 0 ] +then + alternatives --remove javac %{sdkbindir -- %{?1}}/javac + alternatives --remove java_sdk_%{origin} %{_jvmdir}/%{sdkdir -- %{?1}} + alternatives --remove java_sdk_%{javaver} %{_jvmdir}/%{sdkdir -- %{?1}} + alternatives --remove java_sdk_%{javaver}_%{origin} %{_jvmdir}/%{sdkdir -- %{?1}} +fi update-desktop-database %{_datadir}/applications &> /dev/null || : @@ -765,11 +735,13 @@ exit 0 if [ "x$debug" == "xtrue" ] ; then set -x fi - post_state=$1 # from postun, https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax - %{save_and_remove_alternatives javadocdir %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $post_state %{family_noarch}} - %{save_and_remove_alternatives javadocdir_%{origin} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $post_state %{family_noarch}} - %{save_and_remove_alternatives javadocdir_%{javaver} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $post_state %{family_noarch}} - %{save_and_remove_alternatives javadocdir_%{javaver}_%{origin} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $post_state %{family_noarch}} +if [ $1 -eq 0 ] +then + alternatives --remove javadocdir %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api + alternatives --remove javadocdir_%{origin} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api + alternatives --remove javadocdir_%{javaver} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api + alternatives --remove javadocdir_%{javaver}_%{origin} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api +fi exit 0 } @@ -799,14 +771,16 @@ exit 0 } %define postun_javadoc_zip() %{expand: - if [ "x$debug" == "xtrue" ] ; then - set -x - fi - post_state=$1 # from postun, https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax - %{save_and_remove_alternatives javadoczip %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $post_state %{family_noarch}} - %{save_and_remove_alternatives javadoczip_%{origin} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $post_state %{family_noarch}} - %{save_and_remove_alternatives javadoczip_%{javaver} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $post_state %{family_noarch}} - %{save_and_remove_alternatives javadoczip_%{javaver}_%{origin} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $post_state %{family_noarch}} +if [ "x$debug" == "xtrue" ] ; then + set -x +fi +if [ $1 -eq 0 ] +then + alternatives --remove javadoczip %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip + alternatives --remove javadoczip_%{origin} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip + alternatives --remove javadoczip_%{javaver} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip + alternatives --remove javadoczip_%{javaver}_%{origin} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip +fi exit 0 } @@ -2468,6 +2442,7 @@ done - Revert incorrect automated Release change from 1:21.0.5.0.11-2.1 - Set rpmrelease to 4 - Remove copy-jdk-configs logic +- Remove alternatives removal special handling * Tue Oct 29 2024 Troy Dawson - 1:21.0.5.0.11-2.1 - Bump release for October 2024 mass rebuild: