Redirect %patch output
Andreas Scherer
andreas_scherer at alice.de
Fri Oct 2 14:39:59 UTC 2015
Dear all,
I want to submit an idea for extending the %patch macro by adding support for
the '-o' option of the patch programme.
REQUEST: Extend the %patch macro in order to support an invocation like
%patch -p1 -P0 -o Makefile.unix
ENVIRONMENT: My system is Kubuntu 12.04 LTS with rpm 4.9.1.1-1ubuntu0.3.
For creating local packages I use Kris Deugau's debbuild script
(https://secure.deepnet.cx/trac/debbuild) with some current patches
(https://github.com/ascherer/debbuild-0.11.3).
USE CASE: Recently I encountered the situation with two separate source
archives that form a single set of code files. The first introduces a
'Makefile' (https://github.com/ascherer/cweb), the second an extended
'Makefile.unix' (https://github.com/ascherer/cwebbin), which is the actual one
used in the '%build' section (make -f Makefile.unix). After cleaning out the
latter, I want to apply a patch to the original 'Makefile' in the '%prep'
section to create 'Makefile.unix' on-the-fly, instead of shipping it in the
second tarfile.
STATE OF RESEARCH: Curiously, my initial idea
Patch: 0001-Makefile.unix-originates-from-Makefile.patch
[...]
%patch -p1 -o Makefile.unix
actually works with debbuild 0.11.3. The 'debbuild' Perl script simply
forwards the invocation options from '%patch' to 'patch' (only eliminating the
'-P' option for detecting the patch number).
PROBLEM: Cross-checking with rpmbuild 4.9.1.1 resulted in an error message,
because the '-o' option is not supported in this form:
Fehler: Unbekannte Option: -o: %patch -p1 -o Makefile.unix
WORKAROUND: Alternatively, one can replace the %patch macro with a genuine
call to the patch programme:
Patch0: 0001-Makefile.unix-originates-from-Makefile.patch
[...]
patch -p1 -i %{PATCH0} -o Makefile.unix
Note that this requires the (single) patch to be qualified with the '0'
numeral. (Moreover, plain debbuild fails to support the %[PATCH0} macro, so a
compatible solution for both rpmbuild and debbuild is not possible.)
PROSPECT: I have not yet tried to build 'rpmbuild' from the Github sources. As
far as I can see, module 'build/parsePrep.c' has to be changed by adding
support for handling the '-o' option in the 'doPatchMacro' function.
Discuss. :o)
Cheers, Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.rpm.org/pipermail/rpm-list/attachments/20151002/2fb8e9a8/attachment.asc>
More information about the Rpm-list
mailing list