3 releases

0.1.8 Feb 22, 2024
0.1.7 Nov 29, 2023
0.1.2 Oct 28, 2023

#1432 in Parser implementations

Download history 544/week @ 2023-12-22 333/week @ 2023-12-29 120/week @ 2024-01-05 114/week @ 2024-01-12 339/week @ 2024-01-19 345/week @ 2024-01-26 184/week @ 2024-02-02 442/week @ 2024-02-09 434/week @ 2024-02-16 212/week @ 2024-02-23 331/week @ 2024-03-01 876/week @ 2024-03-08 300/week @ 2024-03-15 594/week @ 2024-03-22 703/week @ 2024-03-29 1301/week @ 2024-04-05

2,917 downloads per month
Used in 3 crates (via debian-analyzer)

Apache-2.0

52KB
1.5K SLoC

Lossless parser for Debian Copyright (DEP5) files

This crate contains a lossless parser for Debian Copyright files that use the DEP-5 file format.

Once parsed, the files can be introspected as well as changed before written back to disk.

Example:

let copyright: debian_copyright::Copyright = r#"\
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: lintian-brush
Upstream-Contact: Jelmer Vernooij <jelmer@debian.org>
Source: https://salsa.debian.org/jelmer/lintian-brush

Files: *
Copyright:
 2018-2019 Jelmer Vernooij <jelmer@debian.org>
License: GPL-2+

Files: lintian_brush/systemd.py
Copyright: 2001, 2002, 2003 Python Software Foundation
           2004-2008 Paramjit Oberoi <param.cs.wisc.edu>
           2007 Tim Lauridsen <tla@rasmil.dk>
           2019 Jelmer Vernooij <jelmer@jelmer.uk>
License: MIT

License: MIT
 Permission is hereby granted, free of charge, to any person obtaining a
 copy of this software and associated documentation files (the "Software"),
 to deal in the Software without restriction, including without limitation
 the rights to use, copy, modify, merge, publish, distribute, sublicense,
 and/or sell copies of the Software, and to permit persons to whom the
 Software is furnished to do so, subject to the following conditions:
 .
 The above copyright notice and this permission notice shall be included in
 all copies or substantial portions of the Software.
 .
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 DEALINGS IN THE SOFTWARE.

License: GPL-2+
 On Debian systems, the full text of the GNU General Public License is available
 in /usr/share/common-licenses/GPL-2.
"#.parse().unwrap();

let header = copyright.header().unwrap();

assert_eq!(
    "https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/",
    header.format_string().unwrap());

Dependencies

~3.5–5MB
~90K SLoC