[Fedora-packaging] Re: BuildRoot

Ville Skyttä ville.skytta at iki.fi
Tue Jul 25 20:26:26 UTC 2006


On Tue, 2006-07-25 at 18:16 +0200, Axel Thimm wrote:
> On Tue, Jul 25, 2006 at 05:55:03PM +0200, Ralf Corsepius wrote:
> > On Tue, 2006-07-25 at 16:46 +0200, Axel Thimm wrote:
> > > +
> > > +#==============================================================================
> > > +#	These are the default values that can be overridden by other
> > > +#	(e.g. per-platform, per-system, per-packager, per-package) macros.
> > > +#
> > > +#	Path to top of build area.
> > > +%_topdir		%(test `%{__id_u}` = 0 && echo %{_usrsrc}/redhat || echo $HOME/rpmbuild)
> > > +
> > > +#	Directory where temporary files can be created.
> > > +%_tmppath		%(test `%{__id_u}` = 0 && echo %{_var}/tmp || echo $HOME/rpmbuild/tmp
> > > +
> > > +#	Configurable build root path, same as BuildRoot: in a specfile.
> > > +#	(Note: the configured macro value will override the spec file value).
> > > +
> > > +%buildroot		%{_tmppath}/%{name}-%{version}-%{release}
> > 
> > - Doesn't work in your several %arch's case.
> 
> I didn't want to obfuscate it, better use sane and common defaults.

The above looks ok on first sight, and would look even better if
%buildroot was defined as
%{_tmppath}/%{name}-%{version}-%{release}-%{_target_cpu} which I'd
assume to take care of the multiarch simultaneous build issue and not
really obfuscate things at all.

Too bad it doesn't work very well, for "BuildArch: noarch" packages,
%{buildroot} ends up ending with -noarch here as expected, but
$RPM_BUILD_ROOT ends with -x86_64.  And for example many scripts
in /usr/lib/rpm operate on $RPM_BUILD_ROOT.  On the other hand, explicit
--target to rpmbuild affects both consistently, so I suppose BuildArch
(not limited to noarch) in specfiles kicks in too late to affect
$RPM_BUILD_ROOT.  Reproducer: try rpmbuild -bp with this specfile and
the above %buildroot definition in macros somewhere:

---
Name:           foo
Version:        1
Release:        1
Summary:        foo
Group:          foo
License:        foo
BuildArch:      noarch
%description
%prep
echo %{buildroot}
echo $RPM_BUILD_ROOT
---

/var/tmp/foo-1-1-noarch
/var/tmp/foo-1-1-x86_64




More information about the Fedora-packaging mailing list