From d45eac3d7c1399d96ae12f2337019a982704285e Mon Sep 17 00:00:00 2001 From: "Jonathan Pallant (Ferrous Systems)" Date: Tue, 21 Nov 2023 12:59:03 +0000 Subject: [PATCH] Report missing licenses or copyright text. Required because spdx-rs 0.5.3 added support for SPDX 2.3 documents and made these fields optional. --- src/tools/collect-license-metadata/src/reuse.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/collect-license-metadata/src/reuse.rs b/src/tools/collect-license-metadata/src/reuse.rs index c6a1818ce0d..a5d01935f76 100644 --- a/src/tools/collect-license-metadata/src/reuse.rs +++ b/src/tools/collect-license-metadata/src/reuse.rs @@ -17,9 +17,11 @@ pub(crate) fn collect( let mut result = Vec::new(); for file in document.file_information { + let concluded_license = file.concluded_license.expect("File should have licence info"); + let copyright_text = file.copyright_text.expect("File should have copyright text"); let license = interner.intern(License { - spdx: file.concluded_license.to_string(), - copyright: file.copyright_text.split('\n').map(|s| s.into()).collect(), + spdx: concluded_license.to_string(), + copyright: copyright_text.split('\n').map(|s| s.into()).collect(), }); result.push((file.file_name.into(), license));