From rpm-list 10/19/00 ---------------------------------------------- On Mon, 16 Oct 2000, Jim Knoble wrote: > : It does show up the fact that the buildroot is not clean of files > : (once you have figured out what is going on). This can be a nasty > : problem in and of itself. > > (Sigh.) RPM really ought to take care of cleaning and (re)creating the > build root automagically (probably at %build or %prep time) when > BuildRoot is set to a safe value (e.g., not '/'). Thinking about this -- Is there any reason, as least in a -ba context, _not_ to use a BuildRoot value of %{buildroot} PLUS a temp sub-directory, based, say, on 'mktemp -d' ? -- This would end this issue. The mktemp package is tiny -- under 7k -- and are not unreasonable as a Require for rpm-build . It looks as simple as modifying /usr/lib/rpm/macros at about line 116 with: TEMPBR=%{buildroot} %buildroot=`mktemp -d $TEMPBR/rpm-build.XXXXXX` But grepping -i through /usr/lib/rpm shows that some conditional definition of BuildRoot and buildroot is happening, so this may not be as simple as it appears. ... mktemp is in /bin if one is inclined to add the full path --
There is little reason (other than legacy) to permit building without a buildroot these day. And, if buildroot is enabled by default, then automagically re-creating in %install and removing in %clean are trivial to add. There is legacy packaging, and that prevents changing rpm's implementation at this time. I see no reason to use mktemp to generate a random name of a sub-directory, as detecting the generated name complicates building packages. Besides, I believe that you can already do this from the command line if you choose, as the complications in the implementation of buildroot are there to permit the command line to override the configurartion which overrides the value found in the spec file. That means rpm -ba ... --buildroot `mktemp /var/tmp/rpm-build.XXXXXX` ... should do the job.
Changing component.
--buildroot doesn't work with rpm-4.0.3-1.03 as shipped with RedHat 7.2. $ rpm -tb --buildroot /var/tmp/mc-build mc-4.5.99a.tar.gz --buildroot: unknown option This can be a separate bug, but it's closely related. In my opinion, there is no reason to honor the value of buildroot in the specfile. Only the _existence_ of the option matters. Intruducing buildroot in its present form (i.e. with directory name) was an error IMHO. The option should be boolean.
I agree, but what's done is done, and it's gonna take a while longer to change the paradigm.
Buildtroot roll in is sufficiently wide, that this is no longer the right solution -- as the initiial submitter, I am closing