Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 2d27fe3dff73e21c1aac97aebe0dff40 > files > 3

rpm-4.8.1-10.5.mga1.src.rpm

From 2920c6ce9e7df0d4798c5f364784deee9685de35 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 21/36] 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 984a606..89b41fd 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -98,7 +98,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_patch_flags);
     free(arg_fuzz);
-- 
1.6.4.4