2012/09/22: FreeBSD pkgng: pkg_* to pkg cheat sheet
Today I updated my
port upgrade scripts
(background) to also work with pkg(8), aka
PKGNG. This is the translation I used.
- To find out, if pkg(8) is used, I verify the output of
make -f /dev/null -V WITH_PKGNG
- pkg_info -q -O category/port becomes
pkg query '%n-%v' category/port
- pkg_info -q -R package becomes
pkg query '%rn-%rv' package
- pkg_create -b package becomes
pkg create package
- pkg_info -q -L package becomes
pkg info -q -l package
- pkg_delete -f package become
pkg delete -f -y package
- pkg_add package.tbz become
pkg add package.txz
- Populating /var/db/pkg/package/+REQUIRED_BY is no longer
necessary, as sqlite takes care itself of updating its indices
for reverse dependencies.
- Changing @pkgdep and @comment DEPORIGIN: lines in all
applicable /var/db/pkg/package/+CONTENTS files
now becomes an
UPDATE deps SET name = newname, version = newversion, origin = neworigin
WHERE name = oldname AND version = oldversion
in the sqlite3 database /var/db/pkg/local.sqlite.
The last item is a bit critical, as there is no guarantee that the
database scheme stays stable; it works for me with version 1.0 of
pkg. It is nothing you would do in a world of binary packages
(changing the dependency requirements of an installed package), but it
is kind of natural if you think of packages as just a convenient way
of tracking which ports you have installed.