File: license-for-file.rs

package info (click to toggle)
rust-debian-copyright 0.1.27-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 124 kB
  • sloc: makefile: 4
file content (28 lines) | stat: -rw-r--r-- 824 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use debian_copyright::Copyright;
use std::path::Path;

pub const TEXT: &str = 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.
"#;

pub fn main() {
    let c = TEXT.parse::<Copyright>().unwrap();
    let license = c.find_license_for_file(Path::new("debian/foo")).unwrap();
    println!("{}", license.name().unwrap());
}