| Crates.io | pkgsrc |
| lib.rs | pkgsrc |
| version | 0.8.0 |
| created_at | 2019-08-12 15:37:42.776675+00 |
| updated_at | 2026-01-23 09:50:18.160915+00 |
| description | Rust interface to pkgsrc packages and infrastructure |
| homepage | https://github.com/jperkin/pkgsrc-rs |
| repository | https://github.com/jperkin/pkgsrc-rs |
| max_upload_size | |
| id | 156152 |
| size | 8,147,528 |
A Rust interface to the pkgsrc infrastructure, binary package archives, and the pkg_install pkgdb.
This is being developed alongside:
You should expect things to change over time as each interface adapts to better support these utilities, though I will still make sure to use semver versioning accordingly to avoid gratuitously breaking downstream utilities.
This is a simple implementation of pkg_info(8) that supports the default
output format, i.e. list all currently installed packages and their single-line
comment.
use anyhow::Result;
use pkgsrc::metadata::FileRead;
use pkgsrc::pkgdb::PkgDB;
fn main() -> Result<()> {
let pkgdb = PkgDB::open("/var/db/pkg")?;
for pkg in pkgdb {
let pkg = pkg?;
println!("{:<19} {}", pkg.pkgname(), pkg.comment()?);
}
Ok(())
}
See examples/pkg_info.rs
for a more complete implementation.
archive: Read and write
binary packages, supporting both unsigned (compressed tarballs) and signed
(ar(1) archives with GPG signatures) formats. Includes low-level streaming
API and high-level Package type for fast metadata access.digest: Cryptographic
hashing using BLAKE2s, MD5, RMD160, SHA1, SHA256, and SHA512, with special
handling for pkgsrc patch files.distinfo: Parse and
process distinfo files containing checksums for distfiles and patches.kv: Key-value parsing utilities.pkgdb: Handle local pkg
databases, supporting the regular file-backed repository.plist: Parse and generate
packing lists (PLIST files) with support for all @ commands.summary: Parse and generate
pkg_summary(5) metadata with full validation and span-aware error reporting.Pattern,
Depend,
Dewey: Package
matching with pkg_match() semantics, verified correct against a large corpus
of real-world matches.The current requirements are:
edition = "2024"rust-version = "1.85.1"This project is licensed under the ISC license.