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 %{origin}
%global top_level_dir_name_backup %{top_level_dir_name}-backup %global top_level_dir_name_backup %{top_level_dir_name}-backup
%global buildver 9 %global buildver 9
%global rpmrelease 1 %global rpmrelease 2
#%%global tagsuffix "" #%%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 # 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 %if %is_system_jdk
@ -434,6 +434,14 @@
%global rpm_state_dir %{_localstatedir}/lib/rpm-state/ %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} %if %{with_systemtap}
# Where to install systemtap tapset (links) # Where to install systemtap tapset (links)
# We would like these to be in a package specific sub-dir, # We would like these to be in a package specific sub-dir,
@ -1011,9 +1019,9 @@ OrderWithRequires: copy-jdk-configs
# for printing support # for printing support
Requires: cups-libs Requires: cups-libs
# Post requires alternatives to install tool alternatives # Post requires alternatives to install tool alternatives
Requires(post): %{_sbindir}/alternatives Requires(post): %{alternatives_requires}
# Postun requires alternatives to uninstall tool alternatives # 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 # for optional support of kernel stream control, card reader and printing bindings
Suggests: lksctp-tools%{?_isa}, pcsc-lite-devel%{?_isa} 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} Requires: %{name}%{?1}%{?_isa} = %{epoch}:%{version}-%{release}
OrderWithRequires: %{name}-headless%{?1}%{?_isa} = %{epoch}:%{version}-%{release} OrderWithRequires: %{name}-headless%{?1}%{?_isa} = %{epoch}:%{version}-%{release}
# Post requires alternatives to install tool alternatives # Post requires alternatives to install tool alternatives
Requires(post): %{_sbindir}/alternatives Requires(post): %{alternatives_requires}
# Postun requires alternatives to uninstall tool alternatives # Postun requires alternatives to uninstall tool alternatives
Requires(postun): %{_sbindir}/alternatives Requires(postun): %{alternatives_requires}
# Standard JPackage devel provides # Standard JPackage devel provides
Provides: java-sdk-%{javaver}-%{origin}%{?1} = %{epoch}:%{version}-%{release} 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: %define java_javadoc_rpo() %{expand:
OrderWithRequires: %{name}-headless%{?1}%{?_isa} = %{epoch}:%{version}-%{release} OrderWithRequires: %{name}-headless%{?1}%{?_isa} = %{epoch}:%{version}-%{release}
# Post requires alternatives to install javadoc alternative # Post requires alternatives to install javadoc alternative
Requires(post): %{_sbindir}/alternatives Requires(post): %{alternatives_requires}
# Postun requires alternatives to uninstall javadoc alternative # Postun requires alternatives to uninstall javadoc alternative
Requires(postun): %{_sbindir}/alternatives Requires(postun): %{alternatives_requires}
# Standard JPackage javadoc provides # Standard JPackage javadoc provides
Provides: java-%{javaver}-javadoc%{?1} = %{epoch}:%{version}-%{release} Provides: java-%{javaver}-javadoc%{?1} = %{epoch}:%{version}-%{release}
@ -2278,6 +2286,9 @@ require "copy_jdk_configs.lua"
%endif %endif
%changelog %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 * 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 - Perform static library build on a separate source tree with bundled image libraries
- Make static library build optional - Make static library build optional