debrepo
debrepo is an async-first Rust toolkit for working with Debian/Ubuntu binary
package repositories: parse APT metadata (Packages, Release), read .deb
artifacts, and compute consistent dependency solutions (via resolvo).
It powers the rdebootstrap rootfs builder in this repository, but is designed
as a set of reusable building blocks for other tooling too.
Why debrepo?
- Aims to be the most comprehensive Debian binary package tooling in Rust (built for real-world APT repository data).
- Async-first and optimized for streaming I/O and caching (indexes,
.deb, tar payloads). - Dependency solving over combined
Packagesinputs (solver backend:resolvo).
Status / compatibility
- Rust MSRV: 1.89 (see
Cargo.toml). - Stability: 0.x; API may change between releases.
- Async runtime: uses the
smolecosystem. Tokio integration is not tested or targeted; PRs welcome. - Platform: Unix-like only (uses Unix APIs; intended for Linux).
Quickstart
Add the dependency:
[]
= "0.1"
Examples
The snippets below are intentionally small and focus on the shape of the API.
Parse a Packages index
use Packages;
let pkgs: Packages = packages_text
.to_string
.try_into
.expect;
let bash = pkgs.package_by_name.expect;
println!;
Solve dependencies (Universe + resolvo)
use ;
let pkgs: Packages = packages_text.to_string.try_into.expect;
let mut u = new.expect;
let sol = u
.solve
.expect;
println!;
Read a .deb (control payload)
use DebReader;
// inside an `async fn` (smol-based I/O):
let f = open.await?;
let mut deb = new;
let control = deb.extract_control.await?;
println!;
What you get
Package/Packages: parse DebianPackagesindex files (binary package metadata).Version/VersionSet: Debian version parsing + ranges / constraints (e.g.(>= 1.0), epochs like2:1.0-3, anda | bdependencies).Release: parseReleasefiles and discover hashed index paths.HttpTransport(+ caching helpers): fetch repository content over HTTP(S).deb::DebReader: async.debreader for control/data payloads.tar: simple async tar reader/writer for common cases.universe::Universe: combine multiplePackagesinputs and solve withresolvo.StagingFileSystem: stage files into a target filesystem layout.Manifest/ lockfile support: manifest + lockfile structures used byrdebootstrap, including optional manifest imports and downstreamimported-universelock tracking.
Full API docs are on https://docs.rs/debrepo.
System dependencies
debrepo uses gpgme for OpenPGP-related operations (e.g. repository metadata
verification). On Debian/Ubuntu you will typically need libgpgme-dev and
pkg-config installed for builds.
Related
rdebootstrap: the end-to-end rootfs builder powered by this crate (in this repository).
Thanks
Special thanks to the authors of resolvo: https://github.com/prefix-dev/resolvo