Fork me on GitHub

pkgin, a binary package manager for pkgsrc

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.

Quickstart

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 git 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 uses sqlite3 as a package database backend, in order to provide good speed on older architectures.

If you wish to build pkgin from sources, the following dependencies must be met

Since NetBSD 6.0, all of those are provided as part of the base system, except for libnbcompat.

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

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

$ git clone https://github.com/NetBSDfr/pkgin.git

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 a repository 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

Install a package and its dependencies using a "glob" syntax (pkgin 0.5 and up):

# pkgin install 'foo<5.0'

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

Export your keep-list (in pkg_chk(8) format, pkgin 0.5 and up):

# pkgin export > my-packages

Import a package list (in pkg_chk(8) format, pkgin 0.5 and up):

# pkgin import my-packages

Shows what a package provides (pkgin 0.5 and up):

# pkgin provides foo

Shows what a package requires (pkgin 0.5 and up):

# pkgin requires foo

Show packages belonging to category (pkgin 0.6 and up):

# pkgin show-category www

Show package's category (pkgin 0.6 and up):

# pkgin show-pkg-category foo

Show remote package's content (pkgin 0.6 and up):

# pkgin pkg-content foo

Show remote package's long-description (pkgin 0.6 and up):

# pkgin pkg-descr foo

Show remote package's build definitions (pkgin 0.6 and up):

# pkgin pkg-build-defs 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.