Subject: Re: the netbsd way
To: SODA Noriyuki <firstname.lastname@example.org>
From: Marc Espie <email@example.com>
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 <firstname.lastname@example.org> 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,
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
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.