Overriding default BuildRoot

Panu Matilainen pmatilai at laiskiainen.org
Fri May 4 05:24:19 UTC 2012


On 05/03/2012 11:16 PM, Wempa, Kristofer wrote:
> I have been using RPM to build thousands of packages for various SuSE
> and RedHat Linux distributions.  We recently acquired Red Hat 6
> servers and I noticed that the RPM on that server sets a "BuildRoot"
> by default.  I need to override this since we already have a
> well-defined structure for our tool chains.  Modifying all of the
> spec files is not an option since the packages all install in various
> ways.  I tried re-defining the %{buildroot} and %{_buildrootdir}
> macros in my local macros file, but it looks like RPM ignores this.
> How can I unset the BuildRoot so that my builds will behave as they
> have with other operating systems ?  Thanks in advance.

rpm >= 4.6 simply ignores any BuildRoot directive in specs and there's 
no way to make it honor it. Overriding %_buildrootdir (and %buildroot 
for that matter) does work as expected though, eg putting this to 
~/.rpmmacros makes the buildroot go to /var/tmp:

%_buildrootdir /var/tmp/

Moving it to a "better" place (eg to avoid having the buildroot end up 
over NFS, have a large/fast local scratch area reserved for the purpose 
or such) is fine, the default of ending up in ~/rpmbuild/ is the way it 
is to avoid having to deal with multiuser clashes in eg /var/tmp. Beyond 
that, the exact location of buildroot is an internal implementation 
detail which does not matter at all, that it ever was spec defineable 
was nothing but somebody's mistake a long, long time ago.

	- Panu -


More information about the Rpm-list mailing list