Hardcode /usr/sbin/alternatives for Flatpak builds

/usr/sbin/alternatives is not under the Flatpak build's %{_prefix},
which is set to /app.

(See <https://pagure.io/packaging-committee/issue/848> "Clarify the
use of path macros with respect to build dependencies").

Found when trying to do a LibreOffice Flatpak build from RHEL RPM
specs, which includes java-1.8.0-openjdk among its components.
This commit is contained in:
Jiri 2021-03-11 09:01:35 +01:00
parent 95f9df0e6a
commit d8d4b70fb3
1 changed files with 19 additions and 8 deletions

View File

@ -270,7 +270,7 @@
%global origin_nice OpenJDK
%global top_level_dir_name %{origin}
%global buildver 7
%global rpmrelease 0
%global rpmrelease 1
# Priority must be 8 digits in total; up to openjdk 1.8, we were using 18..... so when we moved to 11, we had to add another digit
%if %is_system_jdk
# Using 10 digits may overflow the int used for priority, so we combine the patch and build versions
@ -372,6 +372,14 @@
%global rpm_state_dir %{_localstatedir}/lib/rpm-state/
# For flatpack builds hard-code /usr/sbin/alternatives,
# otherwise use %%{_sbindir} relative path.
%if 0%{?flatpak}
%global alternatives_requires /usr/sbin/alternatives
%else
%global alternatives_requires %{_sbindir}/alternatives
%endif
%if %{with_systemtap}
# Where to install systemtap tapset (links)
# We would like these to be in a package specific sub-dir,
@ -935,11 +943,11 @@ OrderWithRequires: copy-jdk-configs
# for printing support
Requires: cups-libs
# Post requires alternatives to install tool alternatives
Requires(post): %{_sbindir}/alternatives
Requires(post): %{alternatives_requires}
# in version 1.7 and higher for --family switch
Requires(post): chkconfig >= 1.7
# Postun requires alternatives to uninstall tool alternatives
Requires(postun): %{_sbindir}/alternatives
Requires(postun): %{alternatives_requires}
# in version 1.7 and higher for --family switch
Requires(postun): chkconfig >= 1.7
# for support of kernel stream control, card reader and printing bindings
@ -964,11 +972,11 @@ Provides: java-headless%1 = %{epoch}:%{version}-%{release}
Requires: %{name}%1%{?_isa} = %{epoch}:%{version}-%{release}
OrderWithRequires: %{name}-headless%1%{?_isa} = %{epoch}:%{version}-%{release}
# Post requires alternatives to install tool alternatives
Requires(post): %{_sbindir}/alternatives
Requires(post): %{alternatives_requires}
# in version 1.7 and higher for --family switch
Requires(post): chkconfig >= 1.7
# Postun requires alternatives to uninstall tool alternatives
Requires(postun): %{_sbindir}/alternatives
Requires(postun): %{alternatives_requires}
# in version 1.7 and higher for --family switch
Requires(postun): chkconfig >= 1.7
@ -1018,11 +1026,11 @@ Provides: java-%{origin}-demo%1 = %{epoch}:%{version}-%{release}
%global java_javadoc_rpo() %{expand:
OrderWithRequires: %{name}-headless%1%{?_isa} = %{epoch}:%{version}-%{release}
# Post requires alternatives to install javadoc alternative
Requires(post): %{_sbindir}/alternatives
Requires(post): %{alternatives_requires}
# in version 1.7 and higher for --family switch
Requires(post): chkconfig >= 1.7
# Postun requires alternatives to uninstall javadoc alternative
Requires(postun): %{_sbindir}/alternatives
Requires(postun): %{alternatives_requires}
# in version 1.7 and higher for --family switch
Requires(postun): chkconfig >= 1.7
@ -1054,7 +1062,7 @@ Version: %{newjavaver}.%{buildver}
# This package needs `.rolling` as part of Release so as to not conflict on install with
# java-X-openjdk. I.e. when latest rolling release is also an LTS release packaged as
# java-X-openjdk. See: https://bugzilla.redhat.com/show_bug.cgi?id=1647298
Release: %{?eaprefix}%{rpmrelease}%{?extraver}.rolling%{?dist}.1
Release: %{?eaprefix}%{rpmrelease}%{?extraver}.rolling%{?dist}
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
# also included the epoch in their virtual provides. This created a
@ -2132,6 +2140,9 @@ require "copy_jdk_configs.lua"
%endif
%changelog
* Fri Feb 19 2021 Stephan Bergmann <sbergman@redhat.com> - 1:15.0.2.0.7-1.rolling
- Hardcode /usr/sbin/alternatives for Flatpak builds
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:15.0.2.0.7-0.rolling.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild