summaryrefslogtreecommitdiffstats
path: root/vendor/spdx-rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/spdx-rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/spdx-rs')
-rw-r--r--vendor/spdx-rs/.cargo-checksum.json2
-rw-r--r--vendor/spdx-rs/CHANGELOG.md7
-rw-r--r--vendor/spdx-rs/Cargo.toml5
-rw-r--r--vendor/spdx-rs/src/models/checksum.rs14
-rw-r--r--vendor/spdx-rs/src/models/file_information.rs35
-rw-r--r--vendor/spdx-rs/src/models/package_information.rs94
-rw-r--r--vendor/spdx-rs/src/models/relationship.rs2
-rw-r--r--vendor/spdx-rs/src/models/snippet.rs28
-rw-r--r--vendor/spdx-rs/src/models/spdx_document.rs10
-rw-r--r--vendor/spdx-rs/src/parsers/mod.rs31
-rw-r--r--vendor/spdx-rs/src/parsers/tag_value.rs18
11 files changed, 199 insertions, 47 deletions
diff --git a/vendor/spdx-rs/.cargo-checksum.json b/vendor/spdx-rs/.cargo-checksum.json
index 953a24822..d8967e314 100644
--- a/vendor/spdx-rs/.cargo-checksum.json
+++ b/vendor/spdx-rs/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"0d93ccd65530c1e31e28b89a6f4f38a2bd37f78c2d9044f5d84ccb29543b5941","Cargo.toml":"d74368baf62c9472ac3bbbafda7fce42dc6f7e92fa069509dd666b3f2e69651c","LICENSE.txt":"b85dcd3e453d05982552c52b5fc9e0bdd6d23c6f8e844b984a88af32570b0cc0","LICENSES/CC0-1.0.txt":"a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499","LICENSES/MIT.txt":"b85dcd3e453d05982552c52b5fc9e0bdd6d23c6f8e844b984a88af32570b0cc0","README.md":"29147d67d15bd7abc2ed1e2b3fe6b82ce6477c9985234cb58d759c35f3ec252a","src/error.rs":"52d3645d8e9f6f330cd0de7262f332b99333b2d6095e4e53f0645d0de094095d","src/lib.rs":"8c4069be33582c176d96075a323985b9d368b2aee04a7d5e71dc97d9ad5d7807","src/models/annotation.rs":"17dd6efdb54dbf6705e87881d91adebb39bd304cb702f4423a9cb34556ed400f","src/models/checksum.rs":"ff5773b7301bdb1761057e61c7bfd8279a0f5527660b29e910dcdb7348e0ba90","src/models/document_creation_information.rs":"6951d156ab083bd0666213a0448289bfbb91517405b768ea1d999dbe3af443c5","src/models/file_information.rs":"d865474c1b48357541e2c68398e40ec5669a2ae2f5ec58401a8810af5f5cd33c","src/models/mod.rs":"d7d5a669738c8a6d9131ac88512c53cc3215ed621771180340658391c1fe230e","src/models/other_licensing_information_detected.rs":"c14194b1a7f8ebd54385456bd25b87dd4d3c59897476eb11f3a25e132505584c","src/models/package_information.rs":"99ba6b0c1e0229e7125e39eb22657e1906881201bcec1be44b29507da4d23139","src/models/relationship.rs":"2ff0766d6aaefa40b082c9fb3be67a3ac7def3167244a1e0fa31faadac734d27","src/models/snippet.rs":"2d6434622412bb783a503948c58d96d2d934117ead4171846ed551734146c64e","src/models/spdx_document.rs":"bad4e525b05788e9e072ee6c4df4fbf6140c208a55fce8949594aac3fd6481df","src/parsers/mod.rs":"5f9ec14ff137c3594458b0d495f436211eb86beaf9cba06367f2985afd36bbeb","src/parsers/tag_value.rs":"e58f8e9be5ff7b55493a21b5108153d40e21cc2054e389266e3156c812e4e8c2"},"package":"6b1ec09829bf2d82c175c121b20de11ffab2def83bd55979002099b1f9956c9b"} \ No newline at end of file
+{"files":{"CHANGELOG.md":"f063ec1b118f610f29dc7e67d6ff4939f66b2a5fade7733b0b50f9b03b88af33","Cargo.toml":"4537f8452791639d1b1461eaff011636f2c16aa06e1c096d151f1727cfcb34e4","LICENSE.txt":"b85dcd3e453d05982552c52b5fc9e0bdd6d23c6f8e844b984a88af32570b0cc0","LICENSES/CC0-1.0.txt":"a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499","LICENSES/MIT.txt":"b85dcd3e453d05982552c52b5fc9e0bdd6d23c6f8e844b984a88af32570b0cc0","README.md":"29147d67d15bd7abc2ed1e2b3fe6b82ce6477c9985234cb58d759c35f3ec252a","src/error.rs":"52d3645d8e9f6f330cd0de7262f332b99333b2d6095e4e53f0645d0de094095d","src/lib.rs":"8c4069be33582c176d96075a323985b9d368b2aee04a7d5e71dc97d9ad5d7807","src/models/annotation.rs":"17dd6efdb54dbf6705e87881d91adebb39bd304cb702f4423a9cb34556ed400f","src/models/checksum.rs":"7aa267e096822deb93fc8cd6838ad62a9afc5aa312834a2f807853435f47a42b","src/models/document_creation_information.rs":"6951d156ab083bd0666213a0448289bfbb91517405b768ea1d999dbe3af443c5","src/models/file_information.rs":"14ed2f11419610cd1d7c8b135494a2d2e6e44a20d3e39c0a693d441791375bcf","src/models/mod.rs":"d7d5a669738c8a6d9131ac88512c53cc3215ed621771180340658391c1fe230e","src/models/other_licensing_information_detected.rs":"c14194b1a7f8ebd54385456bd25b87dd4d3c59897476eb11f3a25e132505584c","src/models/package_information.rs":"1c0cef14c9259f2aa97b2e074e495f3d9c0ebc9e96fa0071c0d0c1f451b31904","src/models/relationship.rs":"a51d299fc5c9fec7f7adb2d25880c168309a867778805ea5b8c2c2486315042a","src/models/snippet.rs":"485c9e9f8a7c9d486eaaf4678445c15b828393478ce93f53bca8238bd8cfd314","src/models/spdx_document.rs":"0da508d925ef055983f80498b4436801a2509e8d1b13b517c69364996c1cdad4","src/parsers/mod.rs":"ae21906f80a2d0d5eb48005010165720c2ab2c9a15ebb1f0665d5603ffd25b93","src/parsers/tag_value.rs":"4fe53a67369cd473e2af19e5bbef55c23310f1fb5711bf3894cd38e7bc879825"},"package":"74f1f9cfa402cd27dd022fd1943f0f969b10dda75d5e50e3a78ccee9c0188e2a"} \ No newline at end of file
diff --git a/vendor/spdx-rs/CHANGELOG.md b/vendor/spdx-rs/CHANGELOG.md
index 97e907ae4..c0840f5ef 100644
--- a/vendor/spdx-rs/CHANGELOG.md
+++ b/vendor/spdx-rs/CHANGELOG.md
@@ -6,6 +6,13 @@ SPDX-License-Identifier: MIT
# Changelog
+## [0.5.3](https://github.com/doubleopen-project/spdx-rs/compare/v0.5.2...v0.5.3) (2023-06-29)
+
+
+### Features
+
+* add support for SPDX 2.3 documents ([10e67cb](https://github.com/doubleopen-project/spdx-rs/commit/10e67cb1f2af7bbfa04ecf1af254264b5f5c1cfa))
+
## [0.5.2](https://github.com/doubleopen-project/spdx-rs/compare/v0.5.1...v0.5.2) (2022-12-01)
diff --git a/vendor/spdx-rs/Cargo.toml b/vendor/spdx-rs/Cargo.toml
index 0bda65ca9..27463ba06 100644
--- a/vendor/spdx-rs/Cargo.toml
+++ b/vendor/spdx-rs/Cargo.toml
@@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "spdx-rs"
-version = "0.5.2"
+version = "0.5.3"
authors = ["Mikko Murto <mikko.murto@hhpartners.fi>"]
exclude = [
"/tests/",
@@ -62,5 +62,8 @@ version = "1"
version = "1"
features = ["v4"]
+[dev-dependencies.anyhow]
+version = "1"
+
[dev-dependencies.serde_json]
version = "1"
diff --git a/vendor/spdx-rs/src/models/checksum.rs b/vendor/spdx-rs/src/models/checksum.rs
index f8e2bc258..d66bd3612 100644
--- a/vendor/spdx-rs/src/models/checksum.rs
+++ b/vendor/spdx-rs/src/models/checksum.rs
@@ -43,4 +43,18 @@ pub enum Algorithm {
MD4,
MD5,
MD6,
+ #[serde(rename = "SHA3-256")]
+ SHA3256,
+ #[serde(rename = "SHA3-384")]
+ SHA3384,
+ #[serde(rename = "SHA3-512")]
+ SHA3512,
+ #[serde(rename = "BLAKE2b-256")]
+ BLAKE2B256,
+ #[serde(rename = "BLAKE2b-384")]
+ BLAKE2B384,
+ #[serde(rename = "BLAKE2b-512")]
+ BLAKE2B512,
+ BLAKE3,
+ ADLER32,
}
diff --git a/vendor/spdx-rs/src/models/file_information.rs b/vendor/spdx-rs/src/models/file_information.rs
index aba2defe7..a6d03bef4 100644
--- a/vendor/spdx-rs/src/models/file_information.rs
+++ b/vendor/spdx-rs/src/models/file_information.rs
@@ -29,11 +29,19 @@ pub struct FileInformation {
pub file_checksum: Vec<Checksum>,
/// <https://spdx.github.io/spdx-spec/4-file-information/#45-concluded-license>
- #[serde(rename = "licenseConcluded")]
- pub concluded_license: SpdxExpression,
+ #[serde(
+ rename = "licenseConcluded",
+ skip_serializing_if = "Option::is_none",
+ default
+ )]
+ pub concluded_license: Option<SpdxExpression>,
/// <https://spdx.github.io/spdx-spec/4-file-information/#46-license-information-in-file>
- #[serde(rename = "licenseInfoInFiles")]
+ #[serde(
+ rename = "licenseInfoInFiles",
+ skip_serializing_if = "Vec::is_empty",
+ default
+ )]
pub license_information_in_file: Vec<SimpleExpression>,
/// <https://spdx.github.io/spdx-spec/4-file-information/#47-comments-on-license>
@@ -45,7 +53,12 @@ pub struct FileInformation {
pub comments_on_license: Option<String>,
/// <https://spdx.github.io/spdx-spec/4-file-information/#48-copyright-text>
- pub copyright_text: String,
+ #[serde(
+ rename = "copyrightText",
+ skip_serializing_if = "Option::is_none",
+ default
+ )]
+ pub copyright_text: Option<String>,
/// <https://spdx.github.io/spdx-spec/4-file-information/#412-file-comment>
#[serde(rename = "comment", skip_serializing_if = "Option::is_none", default)]
@@ -80,10 +93,10 @@ impl Default for FileInformation {
file_spdx_identifier: "NOASSERTION".to_string(),
file_type: Vec::new(),
file_checksum: Vec::new(),
- concluded_license: SpdxExpression::parse("NOASSERTION").expect("will always succeed"),
+ concluded_license: None,
license_information_in_file: Vec::new(),
comments_on_license: None,
- copyright_text: "NOASSERTION".to_string(),
+ copyright_text: None,
file_comment: None,
file_notice: None,
file_contributor: Vec::new(),
@@ -98,7 +111,7 @@ impl FileInformation {
*id += 1;
Self {
file_name: name.to_string(),
- file_spdx_identifier: format!("SPDXRef-{}", id),
+ file_spdx_identifier: format!("SPDXRef-{id}"),
..Self::default()
}
}
@@ -241,7 +254,7 @@ mod test {
.unwrap();
assert_eq!(
spdx.file_information[0].concluded_license,
- SpdxExpression::parse("Apache-2.0").unwrap()
+ Some(SpdxExpression::parse("Apache-2.0").unwrap())
);
}
#[test]
@@ -273,7 +286,11 @@ mod test {
)
.unwrap();
assert_eq!(
- spdx.file_information[0].copyright_text,
+ spdx.file_information[0]
+ .copyright_text
+ .as_ref()
+ .unwrap()
+ .clone(),
"Copyright 2010, 2011 Source Auditor Inc.".to_string()
);
}
diff --git a/vendor/spdx-rs/src/models/package_information.rs b/vendor/spdx-rs/src/models/package_information.rs
index c5d73fb3f..dde62f1de 100644
--- a/vendor/spdx-rs/src/models/package_information.rs
+++ b/vendor/spdx-rs/src/models/package_information.rs
@@ -76,8 +76,12 @@ pub struct PackageInformation {
pub source_information: Option<String>,
/// <https://spdx.github.io/spdx-spec/3-package-information/#313-concluded-license>
- #[serde(rename = "licenseConcluded")]
- pub concluded_license: SpdxExpression,
+ #[serde(
+ rename = "licenseConcluded",
+ skip_serializing_if = "Option::is_none",
+ default
+ )]
+ pub concluded_license: Option<SpdxExpression>,
/// <https://spdx.github.io/spdx-spec/3-package-information/#314-all-licenses-information-from-files>
#[serde(
@@ -88,8 +92,12 @@ pub struct PackageInformation {
pub all_licenses_information_from_files: Vec<String>,
/// <https://spdx.github.io/spdx-spec/3-package-information/#315-declared-license>
- #[serde(rename = "licenseDeclared")]
- pub declared_license: SpdxExpression,
+ #[serde(
+ rename = "licenseDeclared",
+ skip_serializing_if = "Option::is_none",
+ default
+ )]
+ pub declared_license: Option<SpdxExpression>,
/// <https://spdx.github.io/spdx-spec/3-package-information/#316-comments-on-license>
#[serde(
@@ -100,7 +108,12 @@ pub struct PackageInformation {
pub comments_on_license: Option<String>,
/// <https://spdx.github.io/spdx-spec/3-package-information/#317-copyright-text>
- pub copyright_text: String,
+ #[serde(
+ rename = "copyrightText",
+ skip_serializing_if = "Option::is_none",
+ default
+ )]
+ pub copyright_text: Option<String>,
/// <https://spdx.github.io/spdx-spec/3-package-information/#318-package-summary-description>
#[serde(rename = "summary", skip_serializing_if = "Option::is_none", default)]
@@ -142,6 +155,30 @@ pub struct PackageInformation {
#[serde(skip_serializing_if = "Vec::is_empty", default)]
pub annotations: Vec<Annotation>,
+
+ #[serde(rename = "builtDate", skip_serializing_if = "Option::is_none", default)]
+ pub built_date: Option<String>,
+
+ #[serde(
+ rename = "releaseDate",
+ skip_serializing_if = "Option::is_none",
+ default
+ )]
+ pub release_date: Option<String>,
+
+ #[serde(
+ rename = "validUntilDate",
+ skip_serializing_if = "Option::is_none",
+ default
+ )]
+ pub valid_until_date: Option<String>,
+
+ #[serde(
+ rename = "primaryPackagePurpose",
+ skip_serializing_if = "Option::is_none",
+ default
+ )]
+ pub primary_package_purpose: Option<PrimaryPackagePurpose>,
}
impl Default for PackageInformation {
@@ -159,11 +196,11 @@ impl Default for PackageInformation {
package_checksum: Vec::new(),
package_home_page: None,
source_information: None,
- concluded_license: SpdxExpression::parse("NONE").expect("will always succeed"),
+ concluded_license: None,
all_licenses_information_from_files: Vec::new(),
- declared_license: SpdxExpression::parse("NONE").expect("will always succeed"),
+ declared_license: None,
comments_on_license: None,
- copyright_text: "NOASSERTION".to_string(),
+ copyright_text: None,
package_summary_description: None,
package_detailed_description: None,
package_comment: None,
@@ -171,6 +208,10 @@ impl Default for PackageInformation {
package_attribution_text: Vec::new(),
files: Vec::new(),
annotations: Vec::new(),
+ built_date: None,
+ release_date: None,
+ valid_until_date: None,
+ primary_package_purpose: None,
}
}
}
@@ -181,7 +222,7 @@ impl PackageInformation {
*id += 1;
Self {
package_name: name.to_string(),
- package_spdx_identifier: format!("SPDXRef-{}", id),
+ package_spdx_identifier: format!("SPDXRef-{id}"),
..Self::default()
}
}
@@ -263,6 +304,23 @@ pub enum ExternalPackageReferenceCategory {
Other,
}
+#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Copy)]
+#[serde(rename_all = "SCREAMING-KEBAB-CASE")]
+pub enum PrimaryPackagePurpose {
+ Application,
+ Framework,
+ Library,
+ Container,
+ OperatingSystem,
+ Device,
+ Firmware,
+ Source,
+ Archive,
+ File,
+ Install,
+ Other,
+}
+
#[cfg(test)]
mod test {
use std::fs::read_to_string;
@@ -432,7 +490,11 @@ mod test {
)
.unwrap();
assert_eq!(
- spdx.package_information[0].concluded_license,
+ spdx.package_information[0]
+ .concluded_license
+ .as_ref()
+ .unwrap()
+ .clone(),
SpdxExpression::parse("(LGPL-2.0-only OR LicenseRef-3)").unwrap()
);
}
@@ -459,7 +521,11 @@ mod test {
)
.unwrap();
assert_eq!(
- spdx.package_information[0].declared_license,
+ spdx.package_information[0]
+ .declared_license
+ .as_ref()
+ .unwrap()
+ .clone(),
SpdxExpression::parse("(LGPL-2.0-only AND LicenseRef-3)").unwrap()
);
}
@@ -481,7 +547,11 @@ mod test {
)
.unwrap();
assert_eq!(
- spdx.package_information[0].copyright_text,
+ spdx.package_information[0]
+ .copyright_text
+ .as_ref()
+ .unwrap()
+ .clone(),
"Copyright 2008-2010 John Smith".to_string()
);
}
diff --git a/vendor/spdx-rs/src/models/relationship.rs b/vendor/spdx-rs/src/models/relationship.rs
index 6430a796f..7d074eaab 100644
--- a/vendor/spdx-rs/src/models/relationship.rs
+++ b/vendor/spdx-rs/src/models/relationship.rs
@@ -87,6 +87,8 @@ pub enum RelationshipType {
Amends,
PrerequisiteFor,
HasPrerequisite,
+ RequirementDescriptionFor,
+ SpecificationFor,
Other,
}
diff --git a/vendor/spdx-rs/src/models/snippet.rs b/vendor/spdx-rs/src/models/snippet.rs
index 7585a0087..1de31f94b 100644
--- a/vendor/spdx-rs/src/models/snippet.rs
+++ b/vendor/spdx-rs/src/models/snippet.rs
@@ -20,8 +20,12 @@ pub struct Snippet {
pub ranges: Vec<Range>,
/// <https://spdx.github.io/spdx-spec/5-snippet-information/#55-snippet-concluded-license>
- #[serde(rename = "licenseConcluded")]
- pub snippet_concluded_license: SpdxExpression,
+ #[serde(
+ rename = "licenseConcluded",
+ skip_serializing_if = "Option::is_none",
+ default
+ )]
+ pub snippet_concluded_license: Option<SpdxExpression>,
/// <https://spdx.github.io/spdx-spec/5-snippet-information/#56-license-information-in-snippet>
#[serde(
@@ -40,8 +44,12 @@ pub struct Snippet {
pub snippet_comments_on_license: Option<String>,
/// <https://spdx.github.io/spdx-spec/5-snippet-information/#58-snippet-copyright-text>
- #[serde(rename = "copyrightText")]
- pub snippet_copyright_text: String,
+ #[serde(
+ rename = "copyrightText",
+ skip_serializing_if = "Option::is_none",
+ default
+ )]
+ pub snippet_copyright_text: Option<String>,
/// <https://spdx.github.io/spdx-spec/5-snippet-information/#59-snippet-comment>
#[serde(rename = "comment", skip_serializing_if = "Option::is_none", default)]
@@ -175,7 +183,11 @@ mod test {
)
.unwrap();
assert_eq!(
- spdx.snippet_information[0].snippet_concluded_license,
+ spdx.snippet_information[0]
+ .snippet_concluded_license
+ .as_ref()
+ .unwrap()
+ .clone(),
SpdxExpression::parse("GPL-2.0-only").unwrap()
);
}
@@ -208,7 +220,11 @@ mod test {
)
.unwrap();
assert_eq!(
- spdx.snippet_information[0].snippet_copyright_text,
+ spdx.snippet_information[0]
+ .snippet_copyright_text
+ .as_ref()
+ .unwrap()
+ .clone(),
"Copyright 2008-2010 John Smith".to_string()
);
}
diff --git a/vendor/spdx-rs/src/models/spdx_document.rs b/vendor/spdx-rs/src/models/spdx_document.rs
index df619e5dc..385685086 100644
--- a/vendor/spdx-rs/src/models/spdx_document.rs
+++ b/vendor/spdx-rs/src/models/spdx_document.rs
@@ -155,9 +155,11 @@ impl SPDX {
let mut license_ids = HashSet::new();
for file in &self.file_information {
- for license in &file.concluded_license.identifiers() {
- if license != "NOASSERTION" && license != "NONE" {
- license_ids.insert(license.clone());
+ if let Some(concluded_license) = &file.concluded_license {
+ for license in concluded_license.identifiers() {
+ if license != "NOASSERTION" && license != "NONE" {
+ license_ids.insert(license.clone());
+ }
}
}
}
@@ -228,7 +230,7 @@ mod test {
assert_eq!(
file.0.concluded_license,
- SpdxExpression::parse("LicenseRef-1").unwrap()
+ Some(SpdxExpression::parse("LicenseRef-1").unwrap())
);
}
diff --git a/vendor/spdx-rs/src/parsers/mod.rs b/vendor/spdx-rs/src/parsers/mod.rs
index 48c863fca..543a7872f 100644
--- a/vendor/spdx-rs/src/parsers/mod.rs
+++ b/vendor/spdx-rs/src/parsers/mod.rs
@@ -350,7 +350,7 @@ fn process_atom_for_packages(
}
Atom::PackageLicenseConcluded(value) => {
if let Some(package) = &mut package_in_progress {
- package.concluded_license = SpdxExpression::parse(value).unwrap();
+ package.concluded_license = Some(SpdxExpression::parse(value).unwrap());
}
}
Atom::PackageLicenseInfoFromFiles(value) => {
@@ -362,7 +362,7 @@ fn process_atom_for_packages(
}
Atom::PackageLicenseDeclared(value) => {
if let Some(package) = &mut package_in_progress {
- package.declared_license = SpdxExpression::parse(value).unwrap();
+ package.declared_license = Some(SpdxExpression::parse(value).unwrap());
}
}
Atom::PackageLicenseComments(value) => {
@@ -372,7 +372,7 @@ fn process_atom_for_packages(
}
Atom::PackageCopyrightText(value) => {
if let Some(package) = &mut package_in_progress {
- package.copyright_text = value.clone();
+ package.copyright_text = Some(value.clone());
}
}
Atom::PackageSummary(value) => {
@@ -461,7 +461,7 @@ fn process_atom_for_files(
}
Atom::LicenseConcluded(value) => {
if let Some(file) = &mut file_in_progress {
- file.concluded_license = SpdxExpression::parse(value).unwrap();
+ file.concluded_license = Some(SpdxExpression::parse(value).unwrap());
}
}
Atom::LicenseInfoInFile(value) => {
@@ -477,7 +477,7 @@ fn process_atom_for_files(
}
Atom::FileCopyrightText(value) => {
if let Some(file) = &mut file_in_progress {
- file.copyright_text = value.clone();
+ file.copyright_text = Some(value.clone());
}
}
Atom::FileNotice(value) => {
@@ -533,7 +533,7 @@ fn process_atom_for_snippets(
}
Atom::SnippetLicenseConcluded(value) => {
if let Some(snippet) = &mut snippet_in_progress {
- snippet.snippet_concluded_license = SpdxExpression::parse(value).unwrap();
+ snippet.snippet_concluded_license = Some(SpdxExpression::parse(value).unwrap());
}
}
Atom::LicenseInfoInSnippet(value) => {
@@ -550,7 +550,7 @@ fn process_atom_for_snippets(
}
Atom::SnippetCopyrightText(value) => {
if let Some(snippet) = &mut snippet_in_progress {
- snippet.snippet_copyright_text = value.to_string();
+ snippet.snippet_copyright_text = Some(value.to_string());
}
}
Atom::SnippetComment(value) => {
@@ -850,7 +850,7 @@ compatible system run time libraries."
Some("uses glibc-2_11-branch from git://sourceware.org/git/glibc.git.".to_string())
);
assert_eq!(
- glibc.concluded_license.identifiers(),
+ glibc.concluded_license.as_ref().unwrap().identifiers(),
HashSet::from_iter(["LGPL-2.0-only".to_string(), "LicenseRef-3".to_string()])
);
assert_eq!(
@@ -858,11 +858,14 @@ compatible system run time libraries."
vec!["GPL-2.0-only", "LicenseRef-2", "LicenseRef-1"]
);
assert_eq!(
- glibc.declared_license.identifiers(),
+ glibc.declared_license.as_ref().unwrap().identifiers(),
HashSet::from_iter(["LGPL-2.0-only".to_string(), "LicenseRef-3".to_string()])
);
assert_eq!(glibc.comments_on_license, Some("The license for this project changed with the release of version x.y. The version of the project included here post-dates the license change.".to_string()));
- assert_eq!(glibc.copyright_text, "Copyright 2008-2010 John Smith");
+ assert_eq!(
+ glibc.copyright_text.as_ref().unwrap().clone(),
+ "Copyright 2008-2010 John Smith"
+ );
assert_eq!(
glibc.package_summary_description,
Some("GNU C library.".to_string())
@@ -925,7 +928,7 @@ This information was found in the COPYING.txt file in the xyz directory.".to_str
]
);
assert_eq!(
- fooc.concluded_license.identifiers(),
+ fooc.concluded_license.as_ref().unwrap().identifiers(),
HashSet::from_iter(["LGPL-2.0-only".to_string(), "LicenseRef-2".to_string(),])
);
assert_eq!(
@@ -937,7 +940,7 @@ This information was found in the COPYING.txt file in the xyz directory.".to_str
);
assert_eq!(fooc.comments_on_license, Some("The concluded license was taken from the package level that the file was included in.".to_string()));
assert_eq!(
- fooc.copyright_text,
+ fooc.copyright_text.as_ref().unwrap().clone(),
"Copyright 2008-2010 John Smith".to_string()
);
assert_eq!(
@@ -997,13 +1000,13 @@ THE SOFTWARE IS PROVIDED �AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMP
.iter()
.any(|snip| snip.end_pointer == Pointer::new_line(None, 23)));
assert_eq!(
- snippet.snippet_concluded_license,
+ snippet.snippet_concluded_license.unwrap(),
SpdxExpression::parse("GPL-2.0-only").unwrap()
);
assert_eq!(snippet.license_information_in_snippet, vec!["GPL-2.0-only"]);
assert_eq!(snippet.snippet_comments_on_license, Some("The concluded license was taken from package xyz, from which the snippet was copied into the current file. The concluded license information was found in the COPYING.txt file in package xyz.".to_string()));
assert_eq!(
- snippet.snippet_copyright_text,
+ snippet.snippet_copyright_text.as_ref().unwrap().clone(),
"Copyright 2008-2010 John Smith"
);
assert_eq!(snippet.snippet_comment, Some("This snippet was identified as significant and highlighted in this Apache-2.0 file, when a commercial scanner identified it as being derived from file foo.c in package xyz which is licensed under GPL-2.0.".to_string()));
diff --git a/vendor/spdx-rs/src/parsers/tag_value.rs b/vendor/spdx-rs/src/parsers/tag_value.rs
index 765348d2f..16859a2dc 100644
--- a/vendor/spdx-rs/src/parsers/tag_value.rs
+++ b/vendor/spdx-rs/src/parsers/tag_value.rs
@@ -60,6 +60,10 @@ pub(super) enum Atom {
ExternalRef(ExternalPackageReference),
ExternalRefComment(String),
PackageAttributionText(String),
+ PrimaryPackagePurpose(String),
+ BuiltDate(String),
+ ReleaseDate(String),
+ ValidUntilDate(String),
// File Information
FileName(String),
@@ -168,6 +172,10 @@ fn tag_value_to_atom(i: &str) -> IResult<&str, Atom, VerboseError<&str>> {
)),
"ExternalRefComment" => Ok((i, Atom::ExternalRefComment(key_value.1.to_string()))),
"PackageAttributionText" => Ok((i, Atom::PackageAttributionText(key_value.1.to_string()))),
+ "PrimaryPackagePurpose" => Ok((i, Atom::PrimaryPackagePurpose(key_value.1.to_string()))),
+ "BuiltDate" => Ok((i, Atom::BuiltDate(key_value.1.to_string()))),
+ "ReleaseDate" => Ok((i, Atom::ReleaseDate(key_value.1.to_string()))),
+ "ValidUntilDate" => Ok((i, Atom::ValidUntilDate(key_value.1.to_string()))),
// File Information
"FileName" => Ok((i, Atom::FileName(key_value.1.to_string()))),
@@ -329,6 +337,8 @@ fn relationship(i: &str) -> IResult<&str, Relationship, VerboseError<&str>> {
"AMENDS" => RelationshipType::Amends,
"PREREQUISITE_FOR" => RelationshipType::PrerequisiteFor,
"HAS_PREREQUISITE" => RelationshipType::HasPrerequisite,
+ "SPECIFICATION_FOR" => RelationshipType::SpecificationFor,
+ "REQUIREMENT_DESCRIPTION_FOR" => RelationshipType::RequirementDescriptionFor,
"OTHER" => RelationshipType::Other,
// TODO: Proper error.
_ => {
@@ -413,6 +423,14 @@ fn checksum(i: &str) -> IResult<&str, Checksum, VerboseError<&str>> {
"MD4" => Algorithm::MD4,
"MD5" => Algorithm::MD5,
"MD6" => Algorithm::MD6,
+ "SHA3-256" => Algorithm::SHA3256,
+ "SHA3-384" => Algorithm::SHA3384,
+ "SHA3-512" => Algorithm::SHA3512,
+ "BLAKE2b-256" => Algorithm::BLAKE2B256,
+ "BLAKE2b-384" => Algorithm::BLAKE2B384,
+ "BLAKE2b-512" => Algorithm::BLAKE2B512,
+ "BLAKE3" => Algorithm::BLAKE3,
+ "ADLER32" => Algorithm::ADLER32,
// TODO: Use proper error.
_ => todo!(),
};