Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Apr 2005 17:35:05 -0500 (CDT)
From:      Mark Linimon <linimon@lonesome.com>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        Alexander Leidinger <Alexander@Leidinger.net>
Subject:   Re: cvs commit: src/usr.sbin/sysinstall config.c
Message-ID:  <Pine.LNX.4.44.0504121703060.2977-100000@pancho>
In-Reply-To: <200504121315.47608.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 12 Apr 2005, John Baldwin wrote:

> That's the problem.  What other algorithm are you going to propose than 
> first-match?

I don't know, exactly.  There are only 5 hard-coded strings being
passed to package_add.  Let me think out loud.

The crudest approach would be to create something like latestPackages.h
which would have

  #define	LATEST_PACKAGE_LINUX_BASE	"linux_base-8"

and that at least gets the magic out of the C code.  A recompile
is still needed, though.  This is gross but low-risk.

The next approach would be to prefix each of those 5 calls by
a new call, get_latest_link, which would walk a list of pairs of
strings and either return the righthand side if the lefthand
side matched, or the original argument, and then come up with
some file format like

  linux_base|linux_base-8

to initialize the set of strings.  Then, of course, you have
to read that file, deal with it being missing, blah blah blah.

Neither approach seems particularly attractive but anything more
thorough would be a lot heavier weight.

Since I'm several weeks behind in my own committments, all I
could do is offer to whip up patches for the first approach and
see if I can generate exactly the same bits from the compile.

mcl



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.44.0504121703060.2977-100000>