[Rpm-ecosystem] Documenting %autopatch

Jason L Tibbitts III tibbs at math.uh.edu
Fri May 18 19:12:39 UTC 2018


>>>>> "MS" == Miroslav Suchý <msuchy at redhat.com> writes:

MS> Is anywhere documented %autopatch?

I think the only real documentation is the source:

# Automatically apply all patches
%autopatch(vp:)\
%{lua:\
local options = rpm.expand("%{!-v:-q} %{-p:-p%{-p*}} ")\
for i, p in ipairs(patches) do\
    print(rpm.expand("%apply_patch -m %{basename:"..p.."}  "..options..p.." "..i.."\n"))\
end}

It just expands to a bunch of %apply_patch invocations.  Takes only two
options: -v to control verbosity, and -p (with argument) corresponding
to the -p option of the 'patch' program.  Of course, then you have to
chase down what %apply_patch does, if you want to go that far.  I guess,
though, that if you're going to document %autopatch then you probably
want to document %apply_patch.

It does the equivalent of %patch, but uses the "configured" SCM to apply
the patch instead of calling patch.  The various SCM invocations are
controlled by the %__scm_apply_* macros.  The SCM defaults to plain old
patch, but is set (via the %__scm macro) when you call %autosetup with
-S.  I don't know if it would be considered supported to manually set
%__scm directly, though of course that does work with the current set of
macros.  But the end result is that you shouldn't call %autopatch or
%apply_patch without first calling %autosetup (presumably with -N).

I always assumed that autopatch was mostly intended to be called
internally by autosetup, so that the nesting would be a bit more
manageable.  The magic around setting %__scm (and the lack of
documentation) seems to reinforce that.  But the documentation does say
that it can be called separately, so... I don't know.  How much of this
did you want to document?

 - J<


More information about the Rpm-ecosystem mailing list