Subject: Re: Finding non-pkgsrc files with pkg_admin
To: Peter Bex <>
From: Hubert Feyrer <>
List: tech-pkg
Date: 04/18/2005 11:03:21
On Mon, 18 Apr 2005, Peter Bex wrote:
>>  	find /usr/pkg -type f -print0 | xargs -0 -n1 pkg_admin retrieve
> Fair enough, that's Unix style.  I should've thought of that :)
> Why doesn't pkg_info -L use pkgdb_retrieve, BTW?

Oh, it actually does if  you ask it nicely by using the -F switch, which 
does uses the pkgdb to look up pkgnames from filenames, and then operates 
as usual. The following example tells you what /usr/pkg/bin/tcsh 
belongs to:

 	miyu% pi -Fe /usr/pkg/bin/tcsh

And this lists all the files that belong to the same package that 
/usr/pkg/bin/tcsh belongs to:

 	miyu% pi -qFL /usr/pkg/bin/tcsh

>> There are some files created at runtime here that aren't put into
>> (binary) packages, and that are thus not listed as "normal" files in the
>> PLIST, but get created by some @exec call and removed via @unexec instead.
> I understand.  I don't see why @exec files have to be `manually' removed by
> @unexec though.  They have to be created dynamically, but they don't have
> to be `deleted dynamically', do they?  In the end it's just an RM statement
> on a file that was put in place by the pkg system.

The list of files is also used to create binary pkgs, and if it was 
included, it would not only be deleted, but also included into binary 
pkgs, which is not wanted.

> Wouldn't it be better to let these @exec statements also generate an entry
> in the database and let the removal of the files created by the @exec
> statements be handled by the usual deletion system?

I think that's more complex than needed, as you'd have to note what files 
the @exec calls create. You can just @unexec the necessary actions to 
remove them.

> That way, pkg_info -L is correct, too.  At least, the manpage for pkg_info
> doesn't mention the dynamically generated files at all.  ATM it creates
> the impression that it should list all files, which it doesn't exactly.

Feel free to send me a patch for pkg_info.1 that tells that files created 
by @exec are not included. :)

  - Hubert

NetBSD - Free AND Open!      (And of course secure, portable, yadda yadda)