From 231a7213b90a8dfba426737732e2dc6e62acfbad Mon Sep 17 00:00:00 2001 From: Lubos Kardos Date: Tue, 19 Jan 2016 14:37:07 +0100 Subject: [PATCH] Fix %autosetup to not cause errors during run of rpmspec tool Firstly %autosetup showed an error during its expansion if some patch wasn't available, that is an error was showed during parsing of a spec file. This caused showing an error during execution of rpmspec tool (rhbz:1293687). Now %autosetup doesn't cause an error during parsing of a spec file but it causes an error during building of specfile if some patch is not available. Also old macro %patch behaves similarly. --- macros.in | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/macros.in b/macros.in index 319a1a3..f11affe 100644 --- a/macros.in +++ b/macros.in @@ -1122,8 +1122,15 @@ done \ # Single patch application %apply_patch(qp:m:)\ -test -f %{1} || exit 1 ; \ -%{uncompress:%{1}} | %{expand:%__scm_apply_%{__scm} %{-q} %{-p:-p%{-p*}} %{-m:-m%{-m*}}} +%{lua:\ +local file = rpm.expand("%{1}")\ +if posix.access(file, "r") then\ + local options = rpm.expand("%{-q} %{-p:-p%{-p*}} %{-m:-m%{-m*}}")\ + local scm_apply = rpm.expand("%__scm_apply_%{__scm}")\ + print(rpm.expand("%{uncompress:"..file.."} | "..scm_apply.." "..options.."\\n"))\ +else\ + print("echo 'Cannot read "..file.."'; exit 1;".."\\n")\ +end} # Automatically apply all patches %autopatch(vp:)\ -- 1.9.3