11 releases

0.1.10 Oct 5, 2023
0.1.9 Oct 5, 2023
0.1.6 Sep 27, 2023

#752 in Algorithms

Download history 190/week @ 2023-11-02 370/week @ 2023-11-09 253/week @ 2023-11-16 798/week @ 2023-11-23 625/week @ 2023-11-30 176/week @ 2023-12-07 284/week @ 2023-12-14 635/week @ 2023-12-21 441/week @ 2023-12-28 205/week @ 2024-01-04 174/week @ 2024-01-11 389/week @ 2024-01-18 423/week @ 2024-01-25 283/week @ 2024-02-01 603/week @ 2024-02-08 509/week @ 2024-02-15

1,973 downloads per month
Used in 6 crates (4 directly)

Apache-2.0

105KB
2.5K SLoC

Debian Changelog parser

This crate provides a parser for debian/changelog files, as described in the Debian policy, section 4.4.

The parser builds a CST. It is lossless - i.e. preserves formatting, and allows editing and partial parsing.

Example:


use std::io::Read;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let file = std::fs::File::open("/usr/share/doc/rustc/changelog.Debian.gz")?;
    let mut gz = flate2::read::GzDecoder::new(file);
    let mut contents = String::new();
    gz.read_to_string(&mut contents)?;
    let changelog: debian_changelog::ChangeLog = contents.parse()?;
    for entry in changelog.entries() {
        println!(
            "{}: {}",
            entry.package().unwrap(),
            entry.version().unwrap().to_string()
        );
    }
    Ok(())
}

lib.rs:

A lossless parser for Debian changelog files.

As documented in Debian Policy: https://www.debian.org/doc/debian-policy/ch-source.html#debian-changelog-debian-changelog

Example:

use std::io::Read;
let contents = r#"rustc (1.70.0+dfsg1-1) unstable; urgency=medium

  * Upload to unstable

 -- Jelmer Vernooij <jelmer@debian.org>  Wed, 20 Sep 2023 20:18:40 +0200
"#;
let changelog: debian_changelog::ChangeLog = contents.parse().unwrap();
assert_eq!(
    vec![("rustc".to_string(), "1.70.0+dfsg1-1".parse().unwrap())],
    changelog.entries().map(
        |e| (e.package().unwrap(), e.version().unwrap()))
    .collect::<Vec<_>>());

Dependencies

~4.5–6.5MB
~111K SLoC