RPM Community Forums

Mailing List Message of <rpm-devel>

Re: %clean replace ??

From: Michael Jennings <mej@kainx.org>
Date: Sat 09 Jun 2007 - 20:45:34 CEST
Message-ID: <20070609184534.GA4227@kainx.org>
On Saturday, 09 June 2007, at 12:36:58 (+0200),
Olivier Thauvin wrote:

> According comment and code in build/parseBuildInstallClean.c the
> %clean section is no longer use and replace by a direct "rm -fr
> %buildroot".

To be accurate, it's actually:
%{?__spec_clean_body}%{!?__spec_clean_body:%{?buildroot:rm -rf '%{buildroot}'\n}}

In other words, __spec_clean_body OR rm -rf %buildroot.

> I am not sure a so direct replacement is a good idea:
> 
> + rm -rf /home/users/olivier/RPM/tmp//munin-root
> (quick translation from french) Can't chdir in foo, perm denied...

I don't follow.

> To avoid this issue, I'd rather suggest to perform "rm -fr %buildroot" only 
> if %clean section is missing, or adding the rm after %clean, in my 
> case %clean is:
> 
> %clean
> chmod u+rX -R $RPM_BUILD_ROOT
> rm -rf $RPM_BUILD_ROOT

My instinct is to say that if you don't have read and execute
permissions to $RPM_BUILD_ROOT, you have other issues that need
addressing.  But maybe I'm missing something. :)

> Also, instead performing this rm during %install, why not simply run
> %clean instead before when at %install step (aka %install call
> %clean).

No, definitely not the right thing to do.  It is good and wise that
pre-%install cleaning and post-%install cleaning are not hard-wired to
be identical.  (Re-)Define %__spec_install_pre and/or
%__spec_clean_body to override either one individually or both
simultaneously.  You can even do this in your (vendor?) macros file
for more universally-useful tweaks.

Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  <mej@kainx.org>
n + 1, Inc., http://www.nplus1.net/       Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
 "That's why C++ is so disappointing:  it does nothing to address some
  of the most fundamental problems in C, and its most important
  addition (classes) builds on the deficient C type model."
                       -- Peter Van Der Linden, "Expert C Programming"
Received on Sat Jun 9 20:45:36 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.