deb-version7

Crates.iodeb-version7
lib.rsdeb-version7
version0.1.1
sourcesrc
created_at2024-04-27 00:25:07.982704
updated_at2024-06-27 02:13:49.238924
descriptionParsing and comparing of Debian package versions
homepage
repositoryhttps://salsa.debian.org/legoktm/deb-version7
max_upload_size
id1222146
size21,604
Kunal Mehta (legoktm)

documentation

README

deb-version(7)

This is a Rust port of the version-related code in dpkg, the base layer of package management in Debian. The goal is to match the behavior of dpkg as closely as possible, while providing convenient Rust abstractions. The specification can be found in the deb-version(7) man page.

Functionality

You can parse and validate versions, as well as check equality and sort in the same way dpkg would.

use deb_version7::DebVersion;
use std::str::FromStr;

let first = DebVersion::from_str("1.0.0-1").unwrap();
let second = DebVersion::from_str("1.0.0-1~bpo12+1").unwrap();
assert!(first > second);

While the DebVersion is created using the Rust String/&str type, deb versions are ASCII-only. Any non-ASCII characters will be immediately rejected.

Implementation

The port was done using version f268c3733 of the dpkg Git repository.

The rough structure of the upstream C code was retained to ease future updates. No effort has been made into evaluating performance (yet).

Credits

deb-version7 is available under the GPL v3, or at your option, any later version. The primary copyright holders are Ian Jackson and Guillem Jover, who wrote the original C code. Kunal Mehta (with the assistance of ChatGPT 3.5) did the Rust port.

Each source file contains where the code originally came from in the dpkg codebase retains the required license headers (with minimal syntax changes).

Commit count: 0

cargo fmt