commit:     9a2b4139a1d57fec1b21a363c5a6089133d002a8
Author:     Leonardo Neumann <leonardo <AT> neumann <DOT> dev <DOT> br>
AuthorDate: Fri Nov 11 17:01:52 2022 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Wed Jan  4 19:51:06 2023 +0000
URL:        https://gitweb.gentoo.org/proj/cargo-ebuild.git/commit/?id=9a2b4139

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 <AT> neumann.dev.br>
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 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()
 }

Reply via email to