Module control

Module control 

Source
Expand description

This module provides a lossless representation of a Debian control file.

§Example

use debian_control::lossless::Control;
use debian_control::relations::VersionConstraint;
let input = r###"Source: dulwich
# Comments are preserved
Maintainer: Jelmer Vernooij <jelmer@jelmer.uk>
Build-Depends: python3, debhelper-compat (= 12)

Package: python3-dulwich
Architecture: amd64
Description: Pure-python git implementation
"###;

let mut control: Control = input.parse().unwrap();

// Bump debhelper-compat
let source = control.source().unwrap();
let bd = source.build_depends().unwrap();

// Get entry with index 1 in Build-Depends, then set the version
let entry = bd.get_entry(1).unwrap();
let mut debhelper = entry.relations().next().unwrap();
assert_eq!(debhelper.name(), "debhelper-compat");
debhelper.set_version(Some((VersionConstraint::Equal, "13".parse().unwrap())));

assert_eq!(source.to_string(), r###"Source: dulwich
# Comments are preserved
Maintainer: Jelmer Vernooij <jelmer@jelmer.uk>
Build-Depends: python3, debhelper-compat (= 12)
"###);

Structs§

Binary
A binary package paragraph
Control
A Debian control file
Source
A source package paragraph