[Rpm-maint] [PATCH] Evaluate the spec file before making the build tree

Panu Matilainen pmatilai at laiskiainen.org
Tue Oct 12 09:20:59 UTC 2010

On Mon, 11 Oct 2010, James Leddy wrote:

> Patch attached, commit msg:
> Certain macros such as %{name} are defined in the spec file. Since the
> build tree is created before the spec file today, you can't use a
> definition like
> %_rpmtopdir     %{_topdir}/%{name}/%{version}-%{release}
> in your rpm macros, because even though rpm -i succeeds, the rpmbuild
> does not, unless the relevant directories are created.

The patch doesn't do what it claims to do: it still creates the build-tree 
before the spec is parsed. A rebase thinko perhaps?

The other problem is that moving the build-tree creation later breaks 
tar-builds when the tree doesn't already exist (from "make check"):

  53: rpmbuild -tb <tar with bad spec>                FAILED 
  54: rpmbuild -tb                                    FAILED 

Might be solvable by stuffing the tar-extracted spec to %{_tmppath} and 
using that to parse the spec (and only then copy the spec to its expected 
place), but I might be forgetting some corner case.

The whole build-tree generation is ridiculously complex and fragile with 
all sorts of relative/absolute path, macros-from-spec vs otherwise etc 
issues :-/

 	- Panu -

More information about the Rpm-maint mailing list