#debian #version #dpkg

debversion

Debian version parsing, manipulation and comparison

20 releases

0.4.4 Oct 2, 2024
0.4.1 Jul 29, 2024
0.3.0 Mar 9, 2024
0.2.2 Sep 27, 2023
0.2.0 Jul 17, 2023

#742 in Parser implementations

Download history 987/week @ 2024-07-20 2652/week @ 2024-07-27 3050/week @ 2024-08-03 2383/week @ 2024-08-10 2877/week @ 2024-08-17 2950/week @ 2024-08-24 2978/week @ 2024-08-31 2666/week @ 2024-09-07 1014/week @ 2024-09-14 2191/week @ 2024-09-21 1948/week @ 2024-09-28 1061/week @ 2024-10-05 823/week @ 2024-10-12 1081/week @ 2024-10-19 1058/week @ 2024-10-26 908/week @ 2024-11-02

3,905 downloads per month
Used in 18 crates (14 directly)

Apache-2.0

43KB
1K SLoC

debian version handling in rust

This simple crate provides a struct for parsing, validating, manipulating and comparing Debian version strings.

It aims to follow the version specification as described in Debian policy 5.6.12 and consistent with the behaviour of dpkg.

Example:

use debversion::Version;

let version: Version = "1.0-1".parse()?;
assert_eq!(version.epoch, Some(0));
assert_eq!(version.upstream_version, "1.0");
assert_eq!(version.debian_revision, Some("1"));

let version1: Version = "1.0-0".parse()?;
let version2: Version = "1.0".parse()?;
assert_eq!(version1, version2);

let version1: Version = "1.0-1".parse()?;
let version2: Version = "1.0~alpha1-1".parse()?;
assert!(version2 < version1);

Features

sqlx

The sqlx feature adds serialization support for the postgres debversion extension when using sqlx.

python-debian

The python-debian feature provides conversion support between the debversion Rust type and the Version class provided by python-debian, when using pyo3.

serde

The serde feature enables serialization to and from simple strings when using serde.

Dependencies

~3–16MB
~222K SLoC