PKG_INFO(1)

NAME
pkg_info - a utility for displaying information on software packages

SYNOPSIS
pkg_info [-BbcDdFfhIikLmNnpqRrSsVv] [-e package] [-K pkg_dbdir] [-l prefix] pkg-name ...
pkg_info [-a flags]

DESCRIPTION
The pkg_info command is used to dump out information for packages, which may be either packed up in files or already installed on the system with the pkg_create(1) command.

The pkg-name may be the name of an installed package (with our without version), a pattern matching several installed packages (see the -e switch for a description of possible patterns), the pathname to a package distribution file, a filename belonging to an installed package (if -F is also given), or a URL to an ftp-available package.

The following command-line options are supported:

-a  Show information for all currently installed packages.

-B  Show some of the important definitions used when building the binary package (the "Build information") for each package.

-b  Show the NetBSD RCS Id strings from the files used in the construction of the binary package (the "Build version") for each package. These files are the package Makefile, any patch files, any checksum files, and the packing list file.

-c  Show the one-line comment field for each package.

-D  Show the install-message file (if any) for each package.

-d  Show the long-description field for each package.

-e pkg-name
    This option allows you to test for the presence of another (perhaps prerequisite) package from a script. If the package identified by pkg-name is currently installed, return 0, otherwise return 1. In addition, the names of any package(s) found installed are printed to stdout unless turned off using the -q option.

    If the given pkg-name contains a shell meta character, it will be matched against all installed packages using fnmatch(3). csh(1) style {,} alternates have also been implemented in addition to this. Package version numbers can also be matched in a relational manner using the,, and operators. For example, pkg_info -e 'name1.3' will match versions 1.3 and later of the name package. The collating sequence of the various package version numbers is unusual, but strives to be consistent. The magic string ``alpha'' equates to alpha version and sorts before a beta version. The magic string ``beta'' equates to beta version and sorts before a release candidate. The magic string ``rc'' equates to release candidate and sorts before a release. For example, name-1.3rc3 will sort before name-1.3 and after name-1.2.9 Similarily name-1.3alpha2 will sort before name-1.3beta1 and they both sort before name-1.3rc1 In addition, alphabetic characters sort in the same place as their numeric counterparts, so that name-1.2e has the same sorting value as name-1.2.5 The magic string ``pl'' equates to a patch level and has the same value as a dot in the dewey-decimal ordering schemes.

-F  Interpret any pkg-name given as filename, and translate it to a package name using the Package Database. This can be used to query information on a per-file basis, e.g. in conjunction with the -e flag to find out which package a file belongs to.

-f  Show the packing list instructions for each package.

-I  Show the index entry for each package.

-i  Show the install script (if any) for each package.

-K pkg_dbdir
    Set pkg_dbdir as the package database directory. If this option isn't specified, then the package database directory is taken from the value of the environment variable PKG_DBDIR if it's set, otherwise it defaults to /var/db/pkg.

-k  Show the de-install script (if any) for each package.

-L  Show the files within each package. This is different from just viewing the packing list, since full pathnames for everything are generated.

-l str
    Prefix each information category header (see -q) shown with str. This is primarily of use to front-end programs that want to request a lot of different information fields at once for a package, but don't necessary want the output intermingled in such a way that they can't organize it. This lets you add a special token to the start of each field.

-m  Show the mtree file (if any) for each package.

-N  Show which packages each package was built with (exact dependencies), if any.

-n  Show which packages each package needs (depends upon), if any.

-p  Show the installation prefix for each package.

-q  Be ``quiet'' in emitting report headers and such, just dump the raw info (basically, assume a non-human reading).

-R  Show which packages are required by each package.

-r  Show the requirements script (if any) for each package.

-S  Show the size of this package and all the packages it requires, in bytes.

-s  Show the size of this package in bytes. The size is calculated by adding up the size of each file of the package.

-V  Print version number and exit.

-v  Turn on verbose output.

ENVIRONMENT

PKG_DBDIR
    If the -K flag isn't given, then PKG_DBDIR is the location of the package database directory. The default package database directory is /var/db/pkg.

PKG_PATH
    This can be used to specify a semicolon-separated list of paths and URLs to search for package files. If PKG_PATH is used, the suffix .tgz is automatically appended to the pkg-name, whereas searching in the current directory uses pkg-name literally.

PKG_TMPDIR, TMPDIR
    These are tried in turn (if set) as candidate directories in which to create a ``staging area'' for any files extracted by pkg_info from package files. If neither PKG_TMPDIR nor TMPDIR yields a suitable scratch directory, /var/tmp, /tmp, and /usr/tmp are tried in turn. Note that /usr/tmp may be created, if it doesn't already exist.

    Since pkg_info requires very little information to be extracted from any package files examined, it is unlikely that these environment variables would ever need to be used to work around limited available space in the default locations.

TECHNICAL DETAILS
Package info is either extracted from package files named on the command line, or from already installed package information in /var/db/pkg/pkg-name.

A filename can be given instead of a (installed) package name to query information on the package this file belongs to. This filename is then resolved to a package name using the Package Database. For this translation to take place, the -F flag must be given. The filename must be absolute, compare the output of pkg_info -aF.

SEE ALSO
pkg_add(1), pkg_admin(1), pkg_create(1), pkg_delete(1), mktemp(3), packages(7), mtree(8)

AUTHORS
Jordan Hubbard
    most of the work
John Kohl
    refined it for NetBSD
Hubert Feyrer
    NetBSD wildcard dependency processing, pkgdb, depends displaying, pkg size display etc.