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:
Andrew Hughes 2021-02-19 03:15:08 +00:00
parent affa8f56ef
commit 7997be64b6

View File

@ -345,7 +345,7 @@
%global top_level_dir_name %{origin}
%global top_level_dir_name_backup %{top_level_dir_name}-backup
%global buildver 9
%global rpmrelease 1
%global rpmrelease 2
#%%global tagsuffix ""
# 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
@ -434,6 +434,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,
@ -1011,9 +1019,9 @@ 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}
# Postun requires alternatives to uninstall tool alternatives
Requires(postun): %{_sbindir}/alternatives
Requires(postun): %{alternatives_requires}
# for optional support of kernel stream control, card reader and printing bindings
Suggests: lksctp-tools%{?_isa}, pcsc-lite-devel%{?_isa}
@ -1035,9 +1043,9 @@ 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}
# Postun requires alternatives to uninstall tool alternatives
Requires(postun): %{_sbindir}/alternatives
Requires(postun): %{alternatives_requires}
# Standard JPackage devel provides
Provides: java-sdk-%{javaver}-%{origin}%{?1} = %{epoch}:%{version}-%{release}
@ -1085,9 +1093,9 @@ Provides: java-%{origin}-demo%{?1} = %{epoch}:%{version}-%{release}
%define 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}
# Postun requires alternatives to uninstall javadoc alternative
Requires(postun): %{_sbindir}/alternatives
Requires(postun): %{alternatives_requires}
# Standard JPackage javadoc provides
Provides: java-%{javaver}-javadoc%{?1} = %{epoch}:%{version}-%{release}
@ -2278,6 +2286,9 @@ require "copy_jdk_configs.lua"
%endif
%changelog
* Fri Feb 19 2021 Stephan Bergmann <sbergman@redhat.com> - 1:11.0.10.0.9-2
- Hardcode /usr/sbin/alternatives for Flatpak builds
* Fri Feb 12 2021 Andrew Hughes <gnu.andrew@redhat.com> - 1:11.0.10.0.9-1
- Perform static library build on a separate source tree with bundled image libraries
- Make static library build optional