diff --git a/CHANGELOG.md b/CHANGELOG.md index dd2ce99..a8dc14a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - ReleaseDate +### Fixed +- [PR#87](https://github.com/EmbarkStudios/spdx/pull/87) fixed a code generation bug introduced in [PR#86](https://github.com/EmbarkStudios/spdx/pull/86) that caused `LicenseId::text()` to return the incorrect license text. + ## [0.13.1] - 2025-12-03 ### Changed - [PR#86](https://github.com/EmbarkStudios/spdx/pull/86) changes the license detection for GNU licenses (GPL, AGPL, LGPL, GFDL). In 0.13.0 they would be detected as their deprecated (eg. `AGPL-3.0`) variant due to the variants (root, `-only`, and `-or-later`) using the exact same license text. GNU licenses are now detected as the `-or-later` version. This is an arbitrary decision, which I hope to not change, but if someone makes a convincing argument it could be. diff --git a/src/detection/cache.bin.zstd b/src/detection/cache.bin.zstd index e81b395..3119d2b 100644 --- a/src/detection/cache.bin.zstd +++ b/src/detection/cache.bin.zstd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0918c65d02d846e3f473d9555c01c7d62c09399f2ae9e6b704493e13155042bb -size 2020116 +oid sha256:01bd6fef74d25cb59b512d83e9d9d1e12f89684059116777f44c1eeb4362ef11 +size 2018889 diff --git a/src/text.rs b/src/text.rs index 6e5e556..0161752 100644 --- a/src/text.rs +++ b/src/text.rs @@ -1,5 +1,4 @@ pub const LICENSE_TEXTS: &[(&str, &str)] = &[ - ("NOASSERTION", ""), ("0BSD", include!("text/licenses/0BSD")), ("3D-Slicer-1.0", include!("text/licenses/3D-Slicer-1.0")), ("AAL", include!("text/licenses/AAL")), @@ -773,6 +772,7 @@ pub const LICENSE_TEXTS: &[(&str, &str)] = &[ ("NLOD-1.0", include!("text/licenses/NLOD-1.0")), ("NLOD-2.0", include!("text/licenses/NLOD-2.0")), ("NLPL", include!("text/licenses/NLPL")), + ("NOASSERTION", include!("text/licenses/NOASSERTION")), ("NOSL", include!("text/licenses/NOSL")), ("NPL-1.0", include!("text/licenses/NPL-1.0")), ("NPL-1.1", include!("text/licenses/NPL-1.1")), diff --git a/src/text/licenses/NOASSERTION b/src/text/licenses/NOASSERTION new file mode 100644 index 0000000..7b883a4 --- /dev/null +++ b/src/text/licenses/NOASSERTION @@ -0,0 +1 @@ +r#""# \ No newline at end of file diff --git a/tests/spdx_list.rs b/tests/spdx_list.rs index cb96b8f..d557d93 100644 --- a/tests/spdx_list.rs +++ b/tests/spdx_list.rs @@ -67,3 +67,17 @@ fn handles_copyleft() { assert!(gpl.is_copyleft()); assert_eq!(gpl.full_name, "GNU General Public License v3.0 or later"); } + +#[test] +#[cfg(feature = "text")] +fn has_correct_license_text() { + let mit = license_id("MIT").unwrap(); + + assert_eq!( + mit.text(), + spdx::text::LICENSE_TEXTS + .iter() + .find_map(|(name, text)| (*name == "MIT").then_some(*text)) + .unwrap() + ); +} diff --git a/update/src/main.rs b/update/src/main.rs index 34dd77d..865512c 100644 --- a/update/src/main.rs +++ b/update/src/main.rs @@ -165,7 +165,7 @@ fn write_license_texts( 'outer: for license in licenses { let license = license.as_ref(); if license == "NOASSERTION" { - writeln!(texts, " (\"{license}\", \"\"),")?; + text_map.insert("NOASSERTION".into(), ("".into(), Vec::new())); continue; }