Subject: Re: Format selection in pkg_create
To: None <tech-pkg@netbsd.org>
From: Joerg Sonnenberger <joerg@britannica.bec.de>
List: tech-pkg
Date: 08/05/2007 15:23:44
On Sun, Aug 05, 2007 at 11:08:59AM +0200, Hubert Feyrer wrote:
> To me, it sounds a bit redundant to give a filename (with a suffix that 
> indicates a format), and also specify the format with an option at the 
> same time.

Because it means implicit encoding of information. The code has to frob
passed-in package name to check for a known suffix and add one
otherwise. With the explicit encoding, I avoid the need to guess
intelligently and I make the code less dependent on current practise
(maybe we want to use .pkg in the future for all forms of compression?).
I also don't have to deal with wether the package name has a suffix and
other issues, I can just trust the caller to know what it is doing.

In the long term, there might not even be a file name to guess from in
the lower code, so adding the explicit type there is useful anyway and
then I can go all the way up and expect the caller to decide what to do.

Joerg