Re: next draft of rpm guidelines are here



Hi,

I don't really agree on all this...
Yes, it's impossible to make a perfect check on what the $RPM_BUILD_ROOT is
set to, and all the distributions I know of do not set it to a stupid
default value. This is why I never do a check but simply "rm -rf
%{buildroot}" :

- If the %{buildroot} is something "dangerous" to remove, the user set it
himself of the distro is REALLY broken : Too bad!
- RPMs should NEVER be built as root anyway, so the worst a user can do is
wipe out his home, a check for != "/" wouldn't prevent this anyhow.
- Doing checks like that make the .spec file less readable.

Just my habits and opinions :-)
Matthias

> Greg -
> 
> The look like they are coming along well.  I would partially disagree
> with your statement:
> 
> rm -rf $RPM_BUILD_ROOT    
>     This line just ensures that there are no "stray" files in the build
> root when the package is built. This helps to make sure that no stray
> files end up in the final RPM. Some packagers like to do a check that
> $RPM_BUILD_ROOT isn't set to something dangerous, but doing a good check
> for that is nearly impossible.
> 
> While it is nearly impossible to keep people from shooting themselves in
> the foot on purpose (for example setting $RPM_BUILD_ROOT to "/usr/../")
> it is a good idea to check for $RPM_BUILD_ROOT being set to "/" because
> RPM will set it to "/" if you don't have a BuildRoot line in your spec
> file.  A better option is to use:
> 
> if test "$RPM_BUILD_ROOT" != "/"; then
>     rm -rf $RPM_BUILD_ROOT
> fi
> 
> in the %clean and %install sections.
> 
> Thanks.
> Peter

--
Matthias Saou
matthias accelance fr




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