Putting --fuzz=0 into rpmbuild on older versions?

Tom Lane tgl at redhat.com
Mon Jul 28 23:40:05 UTC 2008


Dave Jones <davej at redhat.com> writes:
> On Sun, Jul 27, 2008 at 02:31:45PM -0400, Tom Lane wrote:
>>> I looked around for a place to inject --fuzz=0 into the patch arguments
>>> on F-9, and couldn't find one.  Is the definition of %patch really
>>> hardwired into rpmbuild? 

> Yes.

Ick.

> See the ApplyPatch macro in the kernel specfile for a way to work
> around it.

Double ick.

After some poking at rpm I found that making F-9 support fuzz
specification decently is really a very small patch (attached).
With this, I can put "%_default_patch_fuzz 0" into ~/.rpmmacros
and get rawhide-equivalent behavior.  I think I'll be using a
locally patched rpm if I can't get the maintainer to apply this...

			regards, tom lane


diff -Naur rpm-4.4.2.3.orig/build/parsePrep.c rpm-4.4.2.3/build/parsePrep.c
--- rpm-4.4.2.3.orig/build/parsePrep.c	2008-04-01 03:28:21.000000000 -0400
+++ rpm-4.4.2.3/build/parsePrep.c	2008-07-28 16:20:03.000000000 -0400
@@ -61,7 +61,7 @@
  * @param strip		patch level (i.e. patch -p argument)
  * @param db		saved file suffix (i.e. patch --suffix argument)
  * @param reverse	include -R?
- * @param fuzz		include -F?
+ * @param fuzz		fuzz factor, fuzz<0 means no fuzz set
  * @param removeEmpties	include -E?
  * @return		expanded %patch macro (NULL on error)
  */
@@ -98,7 +98,7 @@
 #endif
 	t = stpcpy( stpcpy(t, "--suffix "), db);
     }
-    if (fuzz) {
+    if (fuzz>=0) {
 	t = stpcpy(t, " -F");
 	sprintf(t, "%d", fuzz);
 	t += strlen(t);
@@ -463,7 +463,8 @@
     int patch_index, x;
 
     memset(patch_nums, 0, sizeof(patch_nums));
-    opt_P = opt_p = opt_R = opt_E = opt_F = 0;
+    opt_P = opt_p = opt_R = opt_E = 0;
+    opt_F = rpmExpandNumeric("%{_default_patch_fuzz}");		/* get default fuzz factor for %patch */
     opt_b = NULL;
     patch_index = 0;
 
@@ -515,7 +516,7 @@
 		fnum = strtok(NULL, " \t\n");
 	    }
 	    opt_F = (fnum ? strtol(fnum, &end, 10) : 0);
-	    if (! opt_F || *end) {
+	    if (opt_F < 0 || *end) {
 		rpmError(RPMERR_BADSPEC,
 			_("line %d: Bad arg to %%patch -F: %s\n"),
 			spec->lineNum, spec->line);
diff -Naur rpm-4.4.2.3.orig/macros.in rpm-4.4.2.3/macros.in
--- rpm-4.4.2.3.orig/macros.in	2008-04-01 03:28:22.000000000 -0400
+++ rpm-4.4.2.3/macros.in	2008-07-28 16:21:42.000000000 -0400
@@ -340,6 +340,9 @@
 #
 #%vendor
 
+#	Default fuzz level for %patch in spec file (-1 means don't set it).
+%_default_patch_fuzz	-1
+
 #==============================================================================
 # ---- Build configuration macros.
 #




More information about the fedora-devel-list mailing list