[Fedora-packaging] Re: Refining today's "don't touch system fs" guideline

Michael Schwendt bugs.michael at gmx.net
Fri Oct 13 12:11:08 UTC 2006


On Fri, 13 Oct 2006 10:25:36 +0200, Ralf Corsepius wrote:

> Whether a package does a
> 
> %build
> make something
> make install-something DESTDIR=$RPM_BUILD_ROOT
> export LD_LIBRARY_PATH=$RPM_BUILD_ROOT%{_lib}
> make all
> %install
> rm -rf $RPM_BUILD_ROOT
> make install DESTDIR=$RPM_BUILD_ROOT
> 
> or a 
> 
> %build
> make something
> make install-something DESTDIR=$(PWD)/tmp
> export LD_LIBRARY_PATH=(PWD)/tmp%{_lib}
> make all
> %install
> rm -rf $(PWD)/tmp
> rm -rf $RPM_BUILD_ROOT
> make install DESTDIR=$RPM_BUILD_ROOT
> 
> doesn't make a real difference.

It does. ;)

The former installs into $RPM_BUILD_ROOT without doing "rm -rf
$RPM_BUILD_ROOT" first. It would need to do this at the beginning of
%build (!).


Rather than $RPM_BUILD_DIR I would also choose $RPM_BUILD_ROOT as a
temporary working directory, because it is emptied at the beginning of
%install again anyway and is specific to the current package.

$RPM_BUILD_DIR or %_builddir is not. It is %{_topdir}/BUILD by default and
hence is located above the extracted source tarballs. Usually, you would
prefer $(pwd) which expands to $RPM_BUILD_ROOT or below. Or append a
unique string to %_builddir before working in there.

We want rpmbuild --short-circuit builds to work for both %build and
%install, regardless of how that is achieved.

If it is necessary to create tmp files in %check, don't impose too many
restrictions on the packagers.




More information about the Fedora-packaging mailing list