Precompute alternative priorities at build time

- Precompute alternative priorities at build time
- Related: RHEL-68848
This commit is contained in:
Thomas Fitzsimmons 2024-09-25 17:16:48 -04:00
parent 41185b81bf
commit 2e945c75c3

View File

@ -507,19 +507,16 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
exit 0
}
%define priority_for() %{expand:%[%{?1:1}%{!?1:0} ? %{priority} - 1 : %{priority}]}
%define alternatives_java_install() %{expand:
if [ "x$debug" == "xtrue" ] ; then
set -x
fi
PRIORITY=%{priority}
if [ "%{?1}" == %{debug_suffix} ]; then
let PRIORITY=PRIORITY-1
fi
ext=.gz
key=java
alternatives \\
--install %{_bindir}/java $key %{jrebindir -- %{?1}}/java $PRIORITY \\
--install %{_bindir}/java $key %{jrebindir -- %{?1}}/java %{priority_for -- %{?1}} \\
--slave %{_jvmdir}/jre jre %{_jvmdir}/%{sdkdir -- %{?1}} \\
--slave %{_bindir}/%{alt_java_name} %{alt_java_name} %{jrebindir -- %{?1}}/%{alt_java_name} \\
--slave %{_bindir}/jcmd jcmd %{sdkbindir -- %{?1}}/jcmd \\
@ -540,12 +537,12 @@ alternatives \\
for X in %{origin} %{javaver} ; do
key=jre_"$X"
alternatives --install %{_jvmdir}/jre-"$X" $key %{_jvmdir}/%{sdkdir -- %{?1}} $PRIORITY
alternatives --install %{_jvmdir}/jre-"$X" $key %{_jvmdir}/%{sdkdir -- %{?1}} %{priority_for -- %{?1}}
%{set_if_needed_alternatives $key %{family}}
done
key=jre_%{javaver}_%{origin}
alternatives --install %{_jvmdir}/jre-%{javaver}-%{origin} $key %{_jvmdir}/%{jrelnk -- %{?1}} $PRIORITY
alternatives --install %{_jvmdir}/jre-%{javaver}-%{origin} $key %{_jvmdir}/%{jrelnk -- %{?1}} %{priority_for -- %{?1}}
%{set_if_needed_alternatives $key %{family}}
}
@ -586,15 +583,10 @@ fi
if [ "x$debug" == "xtrue" ] ; then
set -x
fi
PRIORITY=%{priority}
if [ "%{?1}" == %{debug_suffix} ]; then
let PRIORITY=PRIORITY-1
fi
ext=.gz
key=javac
alternatives \\
--install %{_bindir}/javac $key %{sdkbindir -- %{?1}}/javac $PRIORITY \\
--install %{_bindir}/javac $key %{sdkbindir -- %{?1}}/javac %{priority_for -- %{?1}} \\
--slave %{_jvmdir}/java java_sdk %{_jvmdir}/%{sdkdir -- %{?1}} \\
--slave %{_bindir}/jlink jlink %{sdkbindir -- %{?1}}/jlink \\
--slave %{_bindir}/jmod jmod %{sdkbindir -- %{?1}}/jmod \\
@ -665,12 +657,12 @@ alternatives \\
for X in %{origin} %{javaver} ; do
key=java_sdk_"$X"
alternatives --install %{_jvmdir}/java-"$X" $key %{_jvmdir}/%{sdkdir -- %{?1}} $PRIORITY
alternatives --install %{_jvmdir}/java-"$X" $key %{_jvmdir}/%{sdkdir -- %{?1}} %{priority_for -- %{?1}}
%{set_if_needed_alternatives $key %{family}}
done
key=java_sdk_%{javaver}_%{origin}
alternatives --install %{_jvmdir}/java-%{javaver}-%{origin} $key %{_jvmdir}/%{sdkdir -- %{?1}} $PRIORITY
alternatives --install %{_jvmdir}/java-%{javaver}-%{origin} $key %{_jvmdir}/%{sdkdir -- %{?1}} %{priority_for -- %{?1}}
%{set_if_needed_alternatives $key %{family}}
}
@ -715,23 +707,19 @@ exit 0
%define alternatives_javadoc_install() %{expand:
if [ "x$debug" == "xtrue" ] ; then
set -x
fi
PRIORITY=%{priority}
if [ "%{?1}" == %{debug_suffix} ]; then
let PRIORITY=PRIORITY-1
fi
for X in %{origin} %{javaver} ; do
key=javadocdir_"$X"
alternatives --install %{_javadocdir}/java-"$X" $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $PRIORITY
alternatives --install %{_javadocdir}/java-"$X" $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api %{priority_for -- %{?1}}
%{set_if_needed_alternatives $key %{family_noarch}}
done
key=javadocdir_%{javaver}_%{origin}
alternatives --install %{_javadocdir}/java-%{javaver}-%{origin} $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $PRIORITY
alternatives --install %{_javadocdir}/java-%{javaver}-%{origin} $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api %{priority_for -- %{?1}}
%{set_if_needed_alternatives $key %{family_noarch}}
key=javadocdir
alternatives --install %{_javadocdir}/java $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $PRIORITY
alternatives --install %{_javadocdir}/java $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api %{priority_for -- %{?1}}
%{set_if_needed_alternatives $key %{family_noarch}}
exit 0
}
@ -753,24 +741,20 @@ exit 0
%define alternatives_javadoczip_install() %{expand:
if [ "x$debug" == "xtrue" ] ; then
set -x
fi
PRIORITY=%{priority}
if [ "%{?1}" == %{debug_suffix} ]; then
let PRIORITY=PRIORITY-1
fi
for X in %{origin} %{javaver} ; do
key=javadoczip_"$X"
alternatives --install %{_javadocdir}/java-"$X".zip $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $PRIORITY
alternatives --install %{_javadocdir}/java-"$X".zip $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip %{priority_for -- %{?1}}
%{set_if_needed_alternatives $key %{family_noarch}}
done
key=javadoczip_%{javaver}_%{origin}
alternatives --install %{_javadocdir}/java-%{javaver}-%{origin}.zip $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $PRIORITY
alternatives --install %{_javadocdir}/java-%{javaver}-%{origin}.zip $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip %{priority_for -- %{?1}}
%{set_if_needed_alternatives $key %{family_noarch}}
# Weird legacy filename for backwards-compatibility
key=javadoczip
alternatives --install %{_javadocdir}/java-zip $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $PRIORITY
alternatives --install %{_javadocdir}/java-zip $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip %{priority_for -- %{?1}}
%{set_if_needed_alternatives $key %{family_noarch}}
exit 0
}
@ -2459,6 +2443,7 @@ done
- Remove alternatives removal special handling
- Move postun alternatives logic to preun
- Remove --family arguments to alternatives --install
- Precompute alternative priorities at build time
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1:21.0.5.0.11-2.1
- Bump release for October 2024 mass rebuild: