aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Neumann <leonardo@neumann.dev.br>2022-11-11 14:01:52 -0300
committerGeorgy Yakovlev <gyakovlev@gentoo.org>2023-01-04 11:51:06 -0800
commit9a2b4139a1d57fec1b21a363c5a6089133d002a8 (patch)
tree59a65ad76d42a41b55765b2bfb7c054031b6e013
parentdco check: update syntax (diff)
downloadcargo-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.rs5
-rw-r--r--src/license.rs3
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()
}