Fix portable archive name macros: use %{nil} instead of %%{nil}

The %%{nil} in %files call sites passes the literal string "%{nil}"
as an argument through the macro chain. Inside %(shell) execution,
RPM parameter substitution is a single-pass text replacement that
does not re-expand the result, so "%{nil}" appears literally in
filenames instead of expanding to empty.

Fix by using %{nil} (single %) at the call sites, which RPM expands
to empty before passing as an argument. Also revert the macro
definitions to their original upstream form.
This commit is contained in:
Andrew Lukoshko 2026-02-21 10:28:44 +00:00
parent 0552d33d6d
commit 0e07a2275b

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%{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 jreportablenameimpl() %(echo %{uniquesuffix ""} | sed "s;el%{rhel}\\(_[0-9]\\)*;portable%{1}.jre;g")
%define jdkportablenameimpl() %(echo %{uniquesuffix ""} | sed "s;el%{rhel}\\(_[0-9]\\)*;portable%{1}.jdk;g")
%define staticlibsportablenameimpl() %(echo %{uniquesuffix ""} | sed "s;el%{rhel}\\(_[0-9]\\)*;portable%{1}.static-libs;g")
%define jreportablearchive() %{expand:%{jreportablenameimpl -- %%{1}}.tar.xz}
%define jdkportablearchive() %{expand:%{jdkportablenameimpl -- %%{1}}.tar.xz}
%define staticlibsportablearchive() %{expand:%{staticlibsportablenameimpl -- %%{1}}.tar.xz}
@ -1872,8 +1872,8 @@ done
%files
# main package builds always
%{_jvmdir}/%{jreportablearchive -- %%{nil}}
%{_jvmdir}/%{jreportablearchive -- %%{nil}}.sha256sum
%{_jvmdir}/%{jreportablearchive -- %{nil}}
%{_jvmdir}/%{jreportablearchive -- %{nil}}.sha256sum
%else
%files
# placeholder
@ -1882,15 +1882,15 @@ done
%if %{include_normal_build}
%files devel
%{_jvmdir}/%{jdkportablearchive -- %%{nil}}
%{_jvmdir}/%{jdkportablearchive -- %{nil}}
%{_jvmdir}/%{jdkportablearchive -- .debuginfo}
%{_jvmdir}/%{jdkportablearchive -- %%{nil}}.sha256sum
%{_jvmdir}/%{jdkportablearchive -- %{nil}}.sha256sum
%{_jvmdir}/%{jdkportablearchive -- .debuginfo}.sha256sum
%if %{include_staticlibs}
%files static-libs
%{_jvmdir}/%{staticlibsportablearchive -- %%{nil}}
%{_jvmdir}/%{staticlibsportablearchive -- %%{nil}}.sha256sum
%{_jvmdir}/%{staticlibsportablearchive -- %{nil}}
%{_jvmdir}/%{staticlibsportablearchive -- %{nil}}.sha256sum
%endif
%files unstripped