teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.13.0-autosetup-errors.patch

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