listfiles: make it robust against all kinds of “interesting” input

– restore protection against empty input
 – handle non-empty inputs, with whitespace, quotes, linebreaks, etc
This commit is contained in:
Nicolas Mailhot 2019-07-08 23:28:50 +02:00
parent 1f7310110e
commit b8797dcd02
2 changed files with 3 additions and 2 deletions

View File

@ -12,9 +12,9 @@
# Arguments passed to the macro without flags will be interpreted as inclusion
# globs.
%listfiles(i:x:) %{expand:
%if "%{?-i*}%{expand:?listfiles_include}%*" != ""
%if %{lua: print(string.len(rpm.expand("%{?-i*}%{?listfiles_include}%*")))}
listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u)
%if "%{?-x*}%{expand:?listfiles_exclude}" != ""
%if %{lua: print(string.len(rpm.expand("%{?-x*}%{?listfiles_exclude}")))}
while IFS= read -r finc ; do
realpath -qe --relative-base=. %{?-x*} %{?listfiles_exclude} \\
| sort -u | grep -q "${finc}" || echo "${finc}"

View File

@ -202,6 +202,7 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
%{_rpmconfigdir}/macros.d/macros.kmp
%changelog
- listfiles: make it robust against all kinds of “interesting” inputs
- wordwrap: make list indenting smarter, to produce something with enough
structure that it can be converted into AppStream metadata