Crate debian_copyright

source
Expand description

A library for parsing and manipulating debian/copyright files that use the DEP-5 format.

§Examples


use debian_copyright::Copyright;
use std::path::Path;

let text = r#"Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Author: John Doe <john@example>
Upstream-Name: example
Source: https://example.com/example

Files: *
License: GPL-3+
Copyright: 2019 John Doe

Files: debian/*
License: GPL-3+
Copyright: 2019 Jane Packager

License: GPL-3+
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
"#;

let c = text.parse::<Copyright>().unwrap();
let license = c.find_license_for_file(Path::new("debian/foo")).unwrap();
assert_eq!(license.name(), Some("GPL-3+"));

See the lossless module (behind the lossless feature) for a more forgiving parser that allows partial parsing, parsing files with errors and unknown fields and editing while preserving formatting.

Re-exports§

Modules§

  • A library for parsing and manipulating debian/copyright files that use the DEP-5 format.
  • A library for parsing and manipulating debian/copyright files that use the DEP-5 format.

Enums§

  • A license, which can be just a name, a text or a named license.

Constants§