per package BuildRoot does not work

Marten Lehmann lehmann at
Tue Jun 7 21:55:21 UTC 2011


I created a spec file which generates two sub packages and no main 
package, e.g. the specfile is called service.spec and creates the 
packages service-standard and service-premium. Only one of both packages 
may be installed at a time, I added an according "conflicts" section in 
each package definition and the files in their location in the file 
system are identical, just compiled with different options.

As really everything is identical in the spec file for those two service 
options besides a single parameter change, I don't want to build two 
different spec files. I want that both packages are created with one 
rpmbuild call without passing any special parameters or ENV variables to 

Well, everything works fine, except for one point: It seems that I 
cannot specify a different BuildRoot for each package?!

I know the basic usage of packages, e.g. for mysql where a huge build 
creates lots of files and each of them later belongs to one certain 
package like "libs", "server" or "devel".

My case is different: In the buildroot there are sub directories 
"standard" and "premium" which in turn contain the identical structures 
and files, just compiled differently.



The files section just references the files wanted, ie.

%files standard

%files premium

Now how do I tell rpmbuild to use the buildroot 
/var/tmp/buildroot/standard for the standard package and 
/var/tmp/buildroot/premium for the premium package?

I tried to not specify a global "BuildRoot" but directly in each 
%package section. But rpmbuild just takes the first occurence and uses 
it globally and ignores the second. So I get dozends of "error: File not 
found:" errors.

How can I rewrite the %files macro to use a different buildroot?

I'm using rpm-build-4.3.3-33_nonptl.el4_8.1 on RHEL4.8.

Kind regards

More information about the Rpm-list mailing list