Subject: Re: the netbsd way
To: SODA Noriyuki <>
From: Marc Espie <>
List: tech-pkg
Date: 10/31/2006 12:28:02
On Tue, Oct 31, 2006 at 08:10:31PM +0900, SODA Noriyuki wrote:
> >>>>> On Tue, 31 Oct 2006 11:32:08 +0100, Marc Espie <> said:

> > We rewrote our pkgtools infrastructure.

> Unfortunately, they are written in perl.
> Since NetBSD will never import perl into the base system, OpenBSD
> pkgtools cannot be used on NetBSD (as a tool in the base system,
> I mean).

I would probably not use as strong language as `never'... things change,
you know.

In any case, you could reuse part of the design, whatever the 
language might be.

One thing which has proven amazingly useful is the class structure of
packing elements, together with the `visit' method (okay, it's just a
visitor pattern).

Such things have been done in other languages, in other contexts (libxml
comes to mind, though it's atrocious to follow there), but being able
to walk a packing-list, and to have a lot of stuff `typed' there, is
probably the singlest thing that has helped us a lot: we no longer have
lots of tools that parse packing-lists any which way. Every new operation
ends up using $plist->visit('method').

And so, we do not have to implement it for each and every element, only
for the elements that matter...

The biggest advantage there is that most of the common operations have been
moved from packing-lists and install scripts to the framework: instead of
having big, generated shell-scripts that might be buggy, we have one single
framework that creates users, copies configuration files, deletes common
directories, calls ldconfig when needed.  That framework might be buggy, but
it's ways easier to update one single framework than to fix hundreds of
generated scripts in installed packages.

Perl was chosen for our pkgtools rewrite because of its RAD value.  This
does not mean you have to start from scratch, you can definitely use a
lot of the lessons we learned there while writing traditional C code.