Subject: Re: "make install" owerwrites files without asking
To: None <tech-pkg@netbsd.org>
From: Joerg Sonnenberger <joerg@britannica.bec.de>
List: tech-pkg
Date: 06/29/2005 15:33:24
On Wed, Jun 29, 2005 at 03:21:14PM +0200, Antoine Reilles wrote:
> 
> On Jun 29, 2005, at 3:04 PM, Joerg Sonnenberger wrote:
> 
> >On Wed, Jun 29, 2005 at 02:49:56PM +0200, Geert Hendrickx wrote:
> >
> >>A solution for this could be based on FAKE installs, like OpenBSD  
> >>Ports
> >>have.  The packages own "make install" is done to a temporary  
> >>directory,
> >>then a package is created, and this package is pkg_add'ed on the  
> >>system
> >>(in NetBSD make package needs a make install first, which is  
> >>sometimes
> >>not desirable).
> >
> >I'll be implementing that soon.
> 
> This looks like the way darwinports do installs package. They use the  
> destroot functionality packages using autotools support, to install  
> the package in a fake root directory under work.

destroot or DESTDIR? The latter is supported by automake 1.3+ (?).
It is also supported by a lot of software which doesn't use automake,
e.g. most imake generated Makefiles. It's the most common mechanism
to achieve it. A fallback option which often works too, is to redefine
the PREFIX, but that breaks for obvious reasons when the PREFIX is
wired into the executable.

> It is very easy then to  
> check if PLIST is respected, to compress manpages, or check all  
> manpages are installed in the correct directory ( PKGDIR/man or  
> PKGDIR/share/man ).

And a whole lot of other checks possible. It means that pkg_filecheck
is far less needed and a good base for implementing reference counting
on directories. Marc did a lot in that area in OpenBSD over the last
year(s).

> Also this make possible (maybe not always) to do  
> the full build including make install under normal user rights, and  
> use root user only for pkgsrc stuff: moving/copying files, setting  
> rights, and so on.

Often, but not always. Still missing is a way to change ownership of
individual files or specify mode bits more explicitly. That would need
some integration with pkg_create.

The only thing root privs are needed for would be installation of actual
packages. IMO that's a huge pro.

BTW, this leads to another question. Would there be interest in rewriting
the pkg_tools to use e.g. libarchive? It would make e.g. pkg_add fully
self-contained and can allow various optimisations currently not possible.

Joerg