Subject: Re: Ruminations on pkg_chk...
To: Bruce J.A. Nourish <bjan+tech-pkg@bjan.net>
From: Adam C. Migus <adam@migus.org>
List: tech-pkg
Date: 12/30/2003 23:50:53
On Tuesday 30 December 2003 09:23 pm, Bruce J.A. Nourish wrote:
> Hey everyone,
>
> Several people (including myself) have complained about pkg_chk's
> rather poor handling of complex dependency graphs, that in practice
> results in packages bieng repeatedly rebuilt during an update.
>
> I spent the afternoon trying to hack pkg_chk to tsort the
> update/install list. The result looks so ugly, I don't even want to
> use it myself.
>
> The main problem is the way pkg_chk represents the packages it is
> going to install/upgrade: a list of 2-tuples of (name, dir). It is
> impossible to tsort the list in that form. The obvious solution,
> to make an associative array with one data as key, and the other
> as value is not practially possible with any of the base system
> shells.

You could do this in sh(1) using scalars, eval and expr.  You could 
generate a poor man's associative array by defining 'keys' as the 
directory with '/' replaced with '_'{1}, '-' replaced with '_'{2}, and 
'_' replaced with '_'{3} then the data being the variable's contents 
and an index variable containing a list of the keys.  For example:

audio_SDL___sound="SDL_sound-1.0.0"
textproc_p5__XML__Parser="XML-Parser-2.31"
index="audio_SDL___sound textproc_p5__XML__Parser"

It's a little tricky (more so on the decoding) but it works.

>
> If anyone has any bright ideas on this, perhaps they'd care to share
> them with me?
>
> On the same note, what do people think of the portupgrade stuff in
> FreeBSD? I've just acquired a FreeBSD box to experiment on. One
> problem I can see is that it requires a binary INDEX.db that must be
> generated on the host with the ports tree. This would make it hard to
> share a pkgsrc tree across multiple machines by NFS, which is what I
> do at home. Perhaps it's worth it, though...

I use portupgrade quite a bit.  It's a really neat utility but would be 
even more neat IMO would be if pkgsrc could do everything it could to 
without requiring a utility like portupgrade on top of itself.  I think 
it's mostly there.

Adam