Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > media > main-updates-src > by-pkgid > dec4e1edeef36e7485e13bf42f1af5da > files > 3

rpm-4.6.0-14.3mnb2.src.rpm

From 0a238150d111b04055ccd96f5abb8639658946d6 Mon Sep 17 00:00:00 2001
From: Pascal "Pixel" Rigaux <pascal@rigaux.org>
Date: Thu, 29 Jan 2009 11:44:30 +0100
Subject: [PATCH 29/35] introduce %_patch and allow easy override when the patch is not compressed

(to allow git-repository--apply-patch to be used instead of plain "patch" in
rpm-mandriva-setup-build)
---
 build/parsePrep.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/build/parsePrep.c b/build/parsePrep.c
index a2c47d0..e5dafd3 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -112,7 +112,13 @@ static char *doPatch(rpmSpec spec, uint32_t c, int strip, const char *db,
 		reverse ? " -R" : "", 
 		removeEmpties ? " -E" : "");
 
-    patchcmd = rpmExpand("%{uncompress: ", fn, "} | %{__patch} ", args, NULL);
+
+    rpmCompressedMagic compressed = COMPRESSED_OTHER;
+    (void) rpmFileIsCompressed(fn, &compressed);
+    if (compressed == COMPRESSED_NOT)
+      patchcmd = rpmExpand("%{_patch} ", args, " -i ", fn, NULL);
+    else
+      patchcmd = rpmExpand("%{uncompress: ", fn, "} | %{_patch} ", args, NULL);
 
     free(arg_fuzz);
     free(arg_backup);
-- 
1.6.1.3