From 02f4a20583a595f9b9ff184d18c4b0753bcf118f Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Mon, 3 Jun 2019 00:38:59 +0200 Subject: [PATCH] misc: protect listfiles against empty input, to avoid harmless but annoying messages in build logs --- macros.fedora-misc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/macros.fedora-misc b/macros.fedora-misc index 9d4a3ac..3bd1498 100644 --- a/macros.fedora-misc +++ b/macros.fedora-misc @@ -12,10 +12,17 @@ # Arguments passed to the macro without flags will be interpreted as inclusion # globs. %listfiles(i:x:) %{expand: -while IFS= read -r finc ; do - realpath -qe --relative-base=. "" %{?-x*} %{?listfiles_exclude} \\ - | sort -u | grep -q "${finc}" || echo "${finc}" -done <<< $(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u) +%if "%{?-i*}%{?listfiles_include}%*" != "" + 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}" + done <<< "${listfiles_include}" + %else + echo "${listfiles_include}" + %endif +%endif } # https://github.com/rpm-software-management/rpm/issues/581