diff options
author | 2022-11-11 14:01:52 -0300 | |
---|---|---|
committer | 2023-01-04 11:51:06 -0800 | |
commit | 9a2b4139a1d57fec1b21a363c5a6089133d002a8 (patch) | |
tree | 59a65ad76d42a41b55765b2bfb7c054031b6e013 | |
parent | dco check: update syntax (diff) | |
download | cargo-ebuild-9a2b4139a1d57fec1b21a363c5a6089133d002a8.tar.gz cargo-ebuild-9a2b4139a1d57fec1b21a363c5a6089133d002a8.tar.bz2 cargo-ebuild-9a2b4139a1d57fec1b21a363c5a6089133d002a8.zip |
Ignore SPDX parentheses and add crate name to the license error message
Closes: https://github.com/gentoo/cargo-ebuild/issues/27
Closes: https://github.com/gentoo/cargo-ebuild/pull/28
Signed-off-by: Leonardo Neumann <leonardo@neumann.dev.br>
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
-rw-r--r-- | src/lib.rs | 5 | ||||
-rw-r--r-- | src/license.rs | 3 |
2 files changed, 6 insertions, 2 deletions
@@ -78,8 +78,9 @@ pub fn gen_ebuild_data( manifest_path: Option<&Path> } else { // Add the unknown license name to be corrected manually println!( - "WARNING: unknown license \"{}\", please correct manually", - &lic + "WARNING: unknown license \"{}\" at package \"{}\", please correct manually", + &lic, + &pkg.name, ); licenses.insert(lic.to_string()); } diff --git a/src/license.rs b/src/license.rs index f4a397f..99d5278 100644 --- a/src/license.rs +++ b/src/license.rs @@ -160,6 +160,9 @@ pub fn split_spdx_license(str: &str) -> Vec<&str> { str.split('/') .flat_map(|l| l.split(" OR ")) .flat_map(|l| l.split(" AND ")) + .flat_map(|l| l.split("(")) + .flat_map(|l| l.split(")")) + .filter(|l| !l.is_empty()) .map(str::trim) .collect() } |