misc: protect listfiles against empty input, to avoid harmless but annoying messages in build logs

This commit is contained in:
Nicolas Mailhot 2019-06-03 00:38:59 +02:00 committed by Igor Gnatenko
parent 8394d3cf12
commit 02f4a20583

View File

@ -12,10 +12,17 @@
# Arguments passed to the macro without flags will be interpreted as inclusion # Arguments passed to the macro without flags will be interpreted as inclusion
# globs. # globs.
%listfiles(i:x:) %{expand: %listfiles(i:x:) %{expand:
while IFS= read -r finc ; do %if "%{?-i*}%{?listfiles_include}%*" != ""
realpath -qe --relative-base=. "" %{?-x*} %{?listfiles_exclude} \\ listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u)
%if "%{?-x*}%{?listfiles_exclude}" != ""
while IFS= read -r finc ; do
realpath -qe --relative-base=. %{?-x*} %{?listfiles_exclude} \\
| sort -u | grep -q "${finc}" || echo "${finc}" | sort -u | grep -q "${finc}" || echo "${finc}"
done <<< $(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u) done <<< "${listfiles_include}"
%else
echo "${listfiles_include}"
%endif
%endif
} }
# https://github.com/rpm-software-management/rpm/issues/581 # https://github.com/rpm-software-management/rpm/issues/581