1 unstable release

new 0.1.0 Dec 7, 2024

#2791 in Parser implementations

Download history 102/week @ 2024-12-02

102 downloads per month

Apache-2.0

620KB
2.5K SLoC

A library for parsing and manipulating APT source files that use the DEB822 format to hold package repositories specifications.

Currently only lossy serialization is implemented, lossless support retaining file sequence and comments would come at later date.

Examples


use apt_sources::Repositories;
use std::path::Path;

let text = r#"Types: deb
URIs: http://ports.ubuntu.com/
Suites: noble
Components: stable
Architectures: arm64
Signed-By:
 -----BEGIN PGP PUBLIC KEY BLOCK-----
 .
 mDMEY865UxYJKwYBBAHaRw8BAQdAd7Z0srwuhlB6JKFkcf4HU4SSS/xcRfwEQWzr
 crf6AEq0SURlYmlhbiBTdGFibGUgUmVsZWFzZSBLZXkgKDEyL2Jvb2t3b3JtKSA8
 ZGViaWFuLXJlbGVhc2VAbGlzdHMuZGViaWFuLm9yZz6IlgQTFggAPhYhBE1k/sEZ
 wgKQZ9bnkfjSWFuHg9SBBQJjzrlTAhsDBQkPCZwABQsJCAcCBhUKCQgLAgQWAgMB
 Ah4BAheAAAoJEPjSWFuHg9SBSgwBAP9qpeO5z1s5m4D4z3TcqDo1wez6DNya27QW
 WoG/4oBsAQCEN8Z00DXagPHbwrvsY2t9BCsT+PgnSn9biobwX7bDDg==
 =5NZE
 -----END PGP PUBLIC KEY BLOCK-----"#;

let r = text.parse::<Repositories>().unwrap();
let suites = r[0].suites();
assert_eq!(suites[0], "noble");

Dependencies

~5–7MB
~123K SLoC