[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Fedora-packaging] Phase out buildroot?

On Thu, 21 May 2009, Toshio Kuratomi wrote:

On 05/20/2009 11:39 PM, Chuck Anderson wrote:
On Wed, May 20, 2009 at 11:05:57PM -0700, Toshio Kuratomi wrote:
On 05/20/2009 08:47 PM, Chuck Anderson wrote:
On Wed, May 20, 2009 at 05:46:18PM -0700, Toshio Kuratomi wrote:
Since the rpm version shipped in Fedora 10 and beyond defines a default
buildroot, I think we can start phasing out the current buildroot
Guideline.  How about adding this to the start of the buildroot tag
I'd be concerned about accidentally blowing away people's systems if
they take a src.rpm from Fedora and try to build it on an older Fedora
or non-Fedora system.



What will this evaluate to on older systems?  Won't it be "rm -rf\n"?
Which actually won't remove anything?

Last I knew, it will evaluate to / and all hilarity will ensue.  Once
upon a time, the recommendation was to use something like this to
prevent such disasters:

[ "$RPM_BUILD_ROOT" != "/" ]&&  rm -rf $RPM_BUILD_ROOT

That fell out of favor when the BuildRoot: tag was mandated in Fedora
packages.  If we remove the BuildRoot: requirement and instead rely
upon the new rpmbuild default, we risk obliterating unsuspecting
users' systems.

I have a better idea.  How about we get rpmbuild to automatically do
the moral equivalent of "[ "$RPM_BUILD_ROOT" != "/" ]&&  rm -rf
$RPM_BUILD_ROOT" internally before starting %install and %clean, and
remove all such boilerplate from all Fedora specs.  Then we can remove
the BuildRoot: requirement as well, and older/non-Fedora systems will
just break/pollute/fail to cleanup the build instead of blowing away
the users system, a much lesser evil IMO.

I thought that Panu posted something about this actually being the case but I can't find it in a quick look at the code in git. Perhaps that was an idea rather than actually coded or perhaps my memory is wrong.

Lots of ideas get tossed around, many of them get get forgotten before anybody gets around to do anything about them... :-/

Panu care to weigh in on this ?

There are no changes to rpm in this area that I recall. This could be done by just tweaking the build templates in redhat-rpm-config though, something like this in /usr/lib/rpm/redhat/macros:

%__spec_install_pre %{___build_pre}\
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\

This would also force fixing any packages that install stuff from %build.
I remember openoffice being that way... hmm ok that was a long time ago, it's been fixed in F-9.

Another possible alternative is what Suse does: remove and create the buildroot at beginning of the entire build (copy-pasted from suse macros):

%__spec_build_pre %{___build_pre}\
%{?buildroot:  %__rm -rf "$RPM_BUILD_ROOT"\
%__mkdir_p `dirname "$RPM_BUILD_ROOT"`\
%__mkdir "$RPM_BUILD_ROOT"\

	- Panu -

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]