Fix portable archive name macros to strip literal %{nil}

The previous %{expand:%{1}} approach did not work because RPM
parameter substitution inside %(shell) is a single-pass text
replacement that does not re-expand the result. Instead, revert
to %{1} and pipe through a second sed to remove any literal
%{nil} that appears in the shell output.
This commit is contained in:
Andrew Lukoshko 2026-02-21 08:37:49 +00:00
parent c7a54c9237
commit 0552d33d6d

View File

@ -445,9 +445,9 @@
%define uniquesuffix() %{expand:%{fullversion}.%{_arch}%{?1}}
# portable only declarations
%global jreimage jre
%define jreportablenameimpl() %(echo %{uniquesuffix ""} | sed "s;el%{rhel}\\(_[0-9]\\)*;portable%{expand:%{1}}.jre;g")
%define jdkportablenameimpl() %(echo %{uniquesuffix ""} | sed "s;el%{rhel}\\(_[0-9]\\)*;portable%{expand:%{1}}.jdk;g")
%define staticlibsportablenameimpl() %(echo %{uniquesuffix ""} | sed "s;el%{rhel}\\(_[0-9]\\)*;portable%{expand:%{1}}.static-libs;g")
%define jreportablenameimpl() %(echo %{uniquesuffix ""} | sed "s;el%{rhel}\\(_[0-9]\\)*;portable%{1}.jre;g" | sed 's/%%{nil}//g')
%define jdkportablenameimpl() %(echo %{uniquesuffix ""} | sed "s;el%{rhel}\\(_[0-9]\\)*;portable%{1}.jdk;g" | sed 's/%%{nil}//g')
%define staticlibsportablenameimpl() %(echo %{uniquesuffix ""} | sed "s;el%{rhel}\\(_[0-9]\\)*;portable%{1}.static-libs;g" | sed 's/%%{nil}//g')
%define jreportablearchive() %{expand:%{jreportablenameimpl -- %%{1}}.tar.xz}
%define jdkportablearchive() %{expand:%{jdkportablenameimpl -- %%{1}}.tar.xz}
%define staticlibsportablearchive() %{expand:%{staticlibsportablenameimpl -- %%{1}}.tar.xz}