From 9a2b4139a1d57fec1b21a363c5a6089133d002a8 Mon Sep 17 00:00:00 2001 From: Leonardo Neumann Date: Fri, 11 Nov 2022 14:01:52 -0300 Subject: 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 Signed-off-by: Georgy Yakovlev --- src/lib.rs | 5 +++-- src/license.rs | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 94ebf71..ec214c8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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() } -- cgit v1.2.3-65-gdbad