teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone
Blob Blame History Raw
From 73ea59e0d53503bb45d5eac9d9792127a6d04c23 Mon Sep 17 00:00:00 2001
From: Thierry Vignaud <thierry.vignaud@gmail.com>
Date: Thu, 17 Sep 2015 04:36:47 -0400
Subject: [PATCH] fix %autopatch when patch do not exist

unlike Mageia's %apply_patches which inspired it, %autopatch continues
when it fails to apply a patch because it doesn't exists. Eg:

+ /usr/bin/cat /home/tv/rpmbuild/SOURCES/test.patch2
+ /usr/bin/patch -p1 -s
/usr/bin/cat: /home/tv/rpmbuild/SOURCES/test.patch2: No such file or directory
+ /usr/bin/cat /home/tv/rpmbuild/SOURCES/test.patch
+ /usr/bin/patch -p1 -s

Let's catch that error

Signed-off-by: Lubos Kardos <lkardos@redhat.com>
---
 macros.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/macros.in b/macros.in
index 5dddede..5e0d17b 100644
--- a/macros.in
+++ b/macros.in
@@ -1118,6 +1118,7 @@ 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*}}}
 
 # Automatically apply all patches
-- 
1.9.3