Subject: Re: pkg_create -O bug fixes
To: David Young <dyoung@pobox.com>
From: Greg A. Woods <woods@weird.com>
List: tech-pkg
Date: 06/29/2003 13:15:49
[[ I believe this belongs in tech-pkg, not tech-install.  Redirect again
   if you feel otherwise. ]]

[ On Sunday, June 29, 2003 at 01:03:18 (-0500), David Young wrote: ]
> Subject: pkg_create -O bug fixes
>
> Seems to me that pkg_create -O (emit packing list only) should not have
> the side-effect of writing to the package-files database. Correct?

Actually that's one of its primary purposes, IIUC.  (and assuming you're
talking about $PKGDB_DIR/pkgdb.byfile.db)

'-O' should _also_ do everything that 'pkg_add' does except of course
copy any files around.

Note that "pkg_create -O" is used by the register-pkg target in
pkgsrc/mk/bsd.pkg.mk in a statement that opens with:

	if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then

I.e. if the package is not already registered in PKG_DBDIR then this
code registers it there and part of this registration is to update the
package files database and it is expected that "pkg_create -O" will be
the command that does it.

This feature has been there since the inception of the pkgdb.  Here's
the comment from pkg_install/create/pl.c when this feature was added:

----------------------------
revision 1.10
date: 1999/01/19 17:01:59;  author: hubertf;  state: Exp;  lines: +44 -170
Add code for pkgdb.
----------------------------


Perhaps a separate and as-yet unimplemented "pkg_admin" sub-command
could be used to update the package files database, but that's not yet
possible and would have to be done and deployed before any functionality
is removed from pkg_create.

Finally note that the feature I think you're talking about is already
possible with the '-U' option:

     -U      Do not update the package file database with any file informa-
             tion.

Here's the comment from pkg_install/create/pl.c when this feature was
added: 

----------------------------
revision 1.20
date: 2001/05/18 13:21:38;  author: agc;  state: Exp;  lines: +7 -5
Add -U argument to pkg_create - by default, all files are added to the
pkgdb.byfile.db database. If -U is specified on command line to
pkg_create, don't add the PLIST entry to pkgdb.byfile.db.

Bump version number.
----------------------------


(I suppose PKG_DBDIR should probably be mentioned in pkg_create(1))


> Also, seems like pkg_create -O should refrain from interpreting the last
> '.' in the pkg-name argument as the beginning of a filename extension,
> e.g., etc-sysutil-rc-1.6U.0 yields '@name etc-sysutil-rc-1.6U.0', and
> etc-sysutil-rc-1.6U yields '@name etc-sysutil-rc-1'.

Well, such a package name is invalid in the first place, IIUC.

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>