RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm/ CHANGES rpm/build/ parsePrep.c rpm/ macros.in

From: Jeff Johnson <n3npq@mac.com>
Date: Sun 19 Oct 2008 - 21:50:55 CEST
Message-id: <3FC514D9-3F8F-410C-A93F-CD8F642D825D@mac.com>
Fussing with --fuzz opens up a world of pain and voids the warranty of  
%patch macros.


If you want pain, try
    #%patchN
in spec files.

I'm unable to convince myself that burying New Fangled Secret Sauce  
Switches internally
to the rpmbuild parser is in anyone's interest whatsoever.

There certainly has been nothing stopping use of %{PATCHn} within  
%prep (and any other
spec file section, %patch was traditionally %prep-only) as
    %{__patch} --whatever --bleeping --options --you --wish < %{PATCHn}

Contrast the aesthetics of that naked shell line with the Secret Sauce
    %patchN --revetahw --gnipeelb --snoitpo --uoy --hsiw
for a net gain of perhaps sizeof(" < %{PATCHn}") in the amount of  
typing effort
and a net loss (because hardly "standard" or "documented" within  
rpmbuild) of
portability and utility.

But whatever ... if you want the gain of --fuzz, you can have the pain  
too.

73 de Jeff

On Oct 19, 2008, at 12:50 PM, Anders F. Björklund wrote:

>  RPM Package Manager, CVS Repository
>  http://rpm5.org/cvs/
>   
> ____________________________________________________________________________
>
>  Server: rpm5.org                         Name:   Anders F. Björklund
>  Root:   /v/rpm/cvs                       Email:  afb@rpm5.org
>  Module: rpm                              Date:   19-Oct-2008 18:50:04
>  Branch: HEAD                             Handle: 2008101916500300
>
>  Modified files:
>    rpm                     CHANGES macros.in
>    rpm/build               parsePrep.c
>
>  Log:
>    add default patch fuzz macro
>
>  Summary:
>    Revision    Changes     Path
>    1.2620      +1  -0      rpm/CHANGES
>    2.125       +4  -3      rpm/build/parsePrep.c
>    1.259       +6  -2      rpm/macros.in
>   
> ____________________________________________________________________________
>
>  patch -p0 <<'@@ .'
>  Index: rpm/CHANGES
>   
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  $ cvs diff -u -r1.2619 -r1.2620 CHANGES
>  --- rpm/CHANGES	19 Oct 2008 07:46:48 -0000	1.2619
>  +++ rpm/CHANGES	19 Oct 2008 16:50:03 -0000	1.2620
>  @@ -1,5 +1,6 @@
>
>   5.2a2 -> 5.2a3:
>  +    - rpm.org: add %{_default_patch_fuzz} macro for patch --fuzz
>       - afb: make buildroot path configurable, but keep old defaults
>       - rpm.org: add %{_buildrootdir} macro for use with %{buildroot}
>
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/build/parsePrep.c
>   
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  $ cvs diff -u -r2.124 -r2.125 parsePrep.c
>  --- rpm/build/parsePrep.c	3 Aug 2008 14:00:58 -0000	2.124
>  +++ rpm/build/parsePrep.c	19 Oct 2008 16:50:03 -0000	2.125
>  @@ -71,7 +71,7 @@
>    * @param db		saved file suffix (i.e. patch --suffix argument)
>    * @param reverse	include -R?
>    * @param removeEmpties	include -E?
>  - * @param fuzz		include -F?
>  + * @param fuzz		include -F? (fuzz<0 means no)
>    * @param subdir	sub-directory (i.e patch -d argument);
>    * @return		expanded %patch macro (NULL on error)
>    */
>  @@ -99,7 +99,7 @@
>   #endif
>       if (subdir)
>   	t = stpcpy( stpcpy(t, "-d "), subdir);
>  -    if (fuzz) {
>  +    if (fuzz >= 0) {
>   	t = stpcpy(t, "-F ");
>   	sprintf(t, "%10.10d", fuzz);
>   	t += strlen(t);
>  @@ -527,7 +527,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}%{!? 
> _default_patch_fuzz:-1}");
>       opt_b = NULL;
>       opt_d = NULL;
>       patch_index = 0;
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/macros.in
>   
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  $ cvs diff -u -r1.258 -r1.259 macros.in
>  --- rpm/macros.in	19 Oct 2008 07:46:48 -0000	1.258
>  +++ rpm/macros.in	19 Oct 2008 16:50:03 -0000	1.259
>  @@ -1,7 +1,7 @@
>   #/*! \page config_macros Default configuration: @USRLIBRPM@/macros
>   # \verbatim
>   #
>  -# $Id: macros.in,v 1.258 2008/10/19 07:46:48 afb Exp $
>  +# $Id: macros.in,v 1.259 2008/10/19 16:50:03 afb Exp $
>   #
>   # This is a global RPM configuration file. All changes made here  
> will
>   # be lost when the rpm package is upgraded. Any per-system  
> configuration
>  @@ -378,6 +378,9 @@
>   #
>   #%vendor
>
>  +#	Default fuzz level for %patch in spec file.
>  +#%_default_patch_fuzz	-1
>  +
>    
> #= 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>   # ---- Build configuration macros.
>   #
>  @@ -402,8 +405,9 @@
>   %define __patch_number  %{-P:%{-P*}}%{!-P:0} \
>   %define __patch_file    %{P:%{__patch_number}} \
>   %define __patch_suffix  %{-b:-b --suffix %{-b*}} %{-z:--suffix %{- 
> z*}} \
>  +%define __patch_fuzz    %{?_default_patch_fuzz:%(test % 
> {_default_patch_fuzz} -ge 0 && echo "--fuzz=%{_default_patch_fuzz}  
> ")} \
>   %define __patch_options -s %{-p:-p%{-p*}} %{-F:-F%{-F*}} %{-d:-d%{- 
> d*}} %{-R} %{-E} %{__patch_suffix} \
>  -echo "Patch #%{__patch_number} (%{basename:%{__patch_file}}):" && % 
> {uncompress:%{__patch_file}} | %{__patch} %{__patch_options}\
>  +echo "Patch #%{__patch_number} (%{basename:%{__patch_file}}):" && % 
> {uncompress:%{__patch_file}} | %{__patch} %{__patch_fuzz}% 
> {__patch_options}\
>   }
>
>   #
>  @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-cvs@rpm5.org
Received on Sun Oct 19 21:51:04 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.