The pkgsrc project is currently using packaging tools derived from FreeBSD's pkg_install. It is the backbone of the framework and old, underdocumented code.
pkg_install in the current incarnation consists of tools to create, register, install and remove packages. It also contains tools to query and alter the state of the pkgsrc database.
Frontends for package management have to parse the output of the tools because no direct library interface exists. Updates are barely supportable by hacking the meta data directly. Corruptions of (optional) indices happen and can result in crashes of the tools involved. Both interface and file formats are best documented by the code -- which isn't exactly something nice to read.
The goal of the project is to replace the old pkg_install with a properly designed, fully documented and robust set of libraries and tools.
Mandatory (must-have) components:
Optional (would-be-nice) components:
pkgsrc: The complete reference