Subject: Re: Getting rid of pkg_install special handling
To: None <>
From: Alistair Crooks <>
List: tech-pkg
Date: 04/23/2005 20:58:52
On Sat, Apr 23, 2005 at 12:52:58PM +0200, Thomas Klausner wrote:
> Hi!
> The pkg_install package is currently a special case:  It cannot be
> pkg_deleted and is hard to update for this reason.
> AFAICT, the reason for this is that we don't want to end up with
> a system where there are no pkg tools installed.

That is correct.
> Also, when the pkg tools are outdated, package builds fail and tell
> the user to update the package manually, instead of the usual
> dependency handling or automatic updating (I guess for a similar
> reason).

This is mainly because, in the past, we were more worried about the
pkg_install tools being up to date for features that were used in  More recently, the infrastructure has grown, and I think
you are right - we should be concentrating on ease of use, rather than
version differences in pkg_install.
> This is not really necessary for a system that's using source
> packages, since you can always go to pkg tools/pkg_install and do
> 'make install'. I tested this without any pkg_* in a chroot, and
> I got lots of pkg_admin-not-found warnings, but a 'make install'
> worked and registered the package successfully.
> So there is a way to get pkg tools on a source package using system.

That's good news - you should also take a look at


which is pkg_info, pkg_delete and pkg_create done in shell and awk (at
least enough to get digest and other pre-reqs of pkg_install compiled,
installed and registered when bootstrapping pkgsrc). has been
in the generic bootstrap kit since it was written (the copyright says
2002, and I remember writing it at Usenix that year - Monterey, IIRC).
> Then there are binary package systems, using packages compiled on
> other systems. We need a way to install a pkg_install package
> without any pkg_* installed. So dillo and I sat down and wrote a
> small shell script that does exactly that: extract a pkg_add binary
> from a pkg_install binary package and use that to install the
> pkg_install binary package itself.
> So if we make sure that this shell script gets created whenever a
> pkg_install binary package is created, we can install pkg_install
> from source and from binary package, even on systems with no pkg_*
> tools installed. This way we can get rid of most parts of the
> special handling of the pkg_install package, like in particular
> the PKG_PRESERVE hack and the outdated pkg_install package handling.
> Of course, this needs documentation updates, which I'll do.
> The shell script is attached. It needs a better name, and in two
> places @FOO@ variables need to be replaced instead of being hardcoded
> for testing right now.
> Does anyone see any problems with this approach?

I don't see any problems with the approach, but wonder why wheels are
getting re-invented.