pkgin, a tool to manage pkgsrc binary packages

pkgin is aimed at being an apt / yum like tool for managing pkgsrc binary packages. It relies on pkg_summary(5) for installation, removal and upgrade of packages and associated dependencies, using a remote repository.

Rationale

Many so-called GNU/Linux distributions provide a convenient way of searching, installing and upgrading software by using binary archives found on "repositories". NetBSD, and more widely, all operating systems relying on pkgsrc have tools like pkg_add and pkg_delete, but those are unable to correctly handle binary upgrades, and sometimes even installation itself.

This is the purpose of pkgin, to provide the user a convenient way to handle binary packages, using the same working mechanisms than tools like apt-get.

Disclaimer

As pkgin CVS code may change quite deeply, please do not forget to look at the CHANGES file if you chose to track development version.

Prerequisites

pkgin is developed using the C language. It only depends on databases/sqlite3, a lightweight database used to keep a good speed on older architectures. SQLite has no dependencies, you can simply install it with pkg_add:

# PKG_PATH=ftp://ftp.<mirror>.NetBSD.org/pub/pkgsrc/packages/NetBSD/<arch>/<version>/All pkg_add -v sqlite3
			

Pkgin is available via CVS, pkgsrc-wip and is available in pkgsrc as pkgtools/pkgin.

While installing via pkgsrc is the preferred method, you may want to track CVS version to help improving pkgin's quality. To check it out, use the following commands:

$ cvs -d :pserver:anoncvs@cvs.gcu.info:/cvs login
passwd: anoncvs
$ cvs -d :pserver:anoncvs@cvs.gcu.info:/cvs co pkgin

Invoke the configure script, for example:

$ ./configure --prefix=/usr/pkg --with-libraries=/usr/pkg/lib --with-includes=/usr/pkg/include

And finally build the binary:

$ make

pkgin is ready to run !

Usage

First thing to do before using pkgin is to setup one or more repositories in the ${PREFIX}/etc/pkgin/repositories.conf file :

$ echo ftp://ftp.fr.netbsd.org/pub/pkgsrc/packages/NetBSD/i386/5.0/All > /usr/pkg/etc/pkgin/repositories.conf

Now you can build the initial database:

# pkgin update

This operation will download the pkg_summary(5) file from the repository and then populate the SQLite database.

Once this is completed, pkgin is fully functionnal.

The pkgin update command must be run regularly in order to keep the database synchronized with the repository.

Usage examples

List available packages:

# pkgin avail

List installed packages:

# pkgin list

Search for a regular expression in the database:

# pkgin search foo.*bar

Install a package and its dependencies:

# pkgin install foo

Install many packages and their dependencies:

# pkgin install foo bar baz

Remove a package and its reverse dependencies:

# pkgin remove foo

Upgrade a package:

# pkgin install foo

Remove orphan dependencies:

# pkgin autoremove

Mark a package as "keepable", i.e. a package that probably has not been installed by pkgin but that is not an orphan dependency:

# pkgin keep foo

Mark a package as "non-keepable":

# pkgin unkeep foo

Upgrade keepable packages to their newer versions present in the repository. If the installed dependencies match the listed needed dependencies, don't upgrade them:

# pkgin upgrade

Upgrade all packages to their newer versions present in the repository:

# pkgin full-upgrade

Delete downloaded packages from the cache directory:

# pkgin clean

Show package direct dependencies:

# pkgin show-deps foo

Show package full dependency tree:

# pkgin show-full-deps foo

Show package reverse dependency tree (packages depending directly or indirectly):

# pkgin show-rev-deps foo

Assume "yes" for all questions:

# pkgin -y install foo

Every command has a shortcut, pkgin -h will show them.

Platforms

pkgin is known to work and have been tested under the following platforms :

Contact

Please do not hesitate to contact me, either by mail at imil@NetBSD.org or iMil on the Freenode IRC Network.