Crates.io | deb-version7 |
lib.rs | deb-version7 |
version | 0.1.1 |
source | src |
created_at | 2024-04-27 00:25:07.982704 |
updated_at | 2024-06-27 02:13:49.238924 |
description | Parsing and comparing of Debian package versions |
homepage | |
repository | https://salsa.debian.org/legoktm/deb-version7 |
max_upload_size | |
id | 1222146 |
size | 21,604 |
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.
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.
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).
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).