pkgdb
, pkg_which
—
tools to manage and search the package database
pkgdb |
[-ahfFiLOQQquv ] [-o
pkgname] [-s
/old/new/] |
pkg_which |
[-hQQq ] [-c
pkgname] [file]
... |
The pkgdb
command is a tool to create or update the
system package database which is used by the
portupgrade(1)
tool suite. It maintains a hash that maps an installed file to a package name,
a hash that maps a package to an origin, and a list of installed packages.
pkg_which
looks in the package database to
tell which package each specified file came from. If the database is
outdated but you do not have permission to update it, it delegates tasks to
pkg_info(1).
Actually, pkgdb
and
pkg_which
are the same command, and are
equivalent.
The pkgdb
command also works as an
interactive tool for fixing the package registry database when
-F
is specified. It helps you resolve stale
dependencies, unlink cyclic dependencies, complete stale or missing origins
and remove duplicates. You should run this command periodically so
portupgrade(1)
and other pkg_*
tools can work effectively and
reliably.
The following command line arguments are supported:
- file
- Inquire which package file came from. If the
file is not present,
pkg_which
calls
which(1)
to search PATH
for the file.
-h
-
--help
- Show help and exit.
-a
-
--auto
- Turn on automatic mode when
-F
is also specified.
pkgdb
only fixes discrepancies that can be fixed
securely and leaves the others.
--autofix
- Shorthand of
--auto
--fix
(-aF
).
-c
PKGNAME
-
--collate
PKGNAME
- Show files installed by the given package that have been overwritten by
other packages.
-f
-
--force
- Force; Specified with
-u
, update database
regardless of timestamps. Specified with -F
, fix
"held" packages too.
-F
-
--fix
- Interactively fix the package registry database.
-i
-
--interactive
- Turn on interactive mode.
-L
-
--fix-lost
- Check and restore lost dependencies against the ports tree.
-o
PKGNAME
-
--origin
PKGNAME
- Look up the origin of the given package in the package database.
-O
-
--omit-check
- Specified with -F, turn off check dependencies against the ports tree.
Useful if you need a speed-up.
-Q
-
--quiet
- Do not write anything to stdout. Specified twice, do not write anything to
stderr either. This is for internal use.
-q
-
--noconfig
- Do not read the configuration file -
$PREFIX/etc/pkgtools.conf.
-s
/OLD/NEW/
-
--substitute
/OLD/NEW/
- Substitute all the dependencies recorded as OLD with
NEW and exit.
-u
-
--update
- Update or create the package database file
pkgdb.db in $PKG_DBDIR,
which is /var/db/pkg by default.
Note: if the ports database files are stale, pkgdb will
automatically update them before proceeding, so manual updating is not
mandatory.
-v
-
--verbose
- Turn on verbose output.
PKG_DBDIR
- Alternative location for the installed package database. Default is
“/var/db/pkg”.
PORTSDIR
- Alternative location for the ports tree. Default is
“/usr/ports”.
PORTS_INDEX
- Alternative location for the ports INDEX file. Default is
“$PORTSDIR/INDEX”.
PORTS_DBDIR
- Alternative location for the ports database files. Default is
“$PORTSDIR”. The database files in
the directory are automatically created or updated as necessary. See
portsdb(1)
for details.
PKGTOOLS_CONF
- Configuration file for the pkgtools suite. Default is
“$PREFIX/etc/pkgtools.conf”.
- /var/db/pkg
- Default location of the package database.
- $PREFIX/etc/pkgtools.conf
- Default location of the pkgtools configuration file.
The idea of pkgdb.db was taken from
NetBSD.
Akinori MUSHA ⟨knu@iDaemons.org⟩
Sergey Matveychuk ⟨sem@FreeBSD.org⟩
Sometimes a database may get corrupt, and the pkgtools commands may abort with a
segmentation fault. In such cases, run “pkgdb
-fu
” to rebuild the database, and the problems should go away.