RPM Community Forums

Mailing List Message of <rpm-devel>

Re: Just notice: small incompatibility between RPM 4 and 5 on %patch

From: Ralf S. Engelschall <rse+rpm-devel@rpm5.org>
Date: Fri 02 May 2008 - 17:58:07 CEST
Message-ID: <20080502155807.GA47553@engelschall.com>
On Fri, May 02, 2008, Jeff Johnson wrote:

> On May 2, 2008, at 5:45 AM, Ralf S. Engelschall wrote:
>
>> Just a heads up in case you have not noticed (like me): In RPM 5 %patch
>> is a regular macro while in RPM 4 it was a built-in "pseudo-macro". The
>> two are mostly compatible, but in RPM 4 one could have written "%patch
>> ... -P 0 1 2 3" and get %Patch0, %Patch1, %Patch2 and %Patch3 applied.
>> In RPM 5 only %Patch0 is applied because only the first argument is
>> considered. Not a major problem, but something I stumbled over currently
>> (I wondered why some patches were not applied under RPM 5).
>
> I personally have never seen -P 0 1 2 3 4 5 used in 10 years of dealing
> with rpm. Yes, I may have forgotten, but the usage case is vanishingly
> small.

That's correct: From over 1100 packages in OpenPKG only 5 used this. It
was mainly used when over a dozen vendor patches have to be applied as
then a single %patch line is far better than a dozen separate lines.

> Some other more pleasant and useful syntax than array indexes in a tuple
> is needed for spec files. The maintenance of, say, 50+ patches identified
> by integers is a nightmare no matter how the patches are applied.
>
> The convenience and expressive power of looping over a sparse/ordered set
> of array indexes in a single %patch statement is a tortured design flaw
> imho.
>
> But perhaps the macro processor can be tricked up to at least detect
> -P 0 1 2 3 ... as a syntax failure.

I resolved the issue for me by just changing the 5 OpenPKG packages
to use separate %patch lines now. No big deal. But I wanted to drop you
a note here about this subtle incompatibility in case someone else also
stumbles over this when upgrading from RPM 4 to RPM 5.

                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com
Received on Fri May 2 18:03:06 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.