Skip to main content

copyleft_introduced

Function copyleft_introduced 

Source
pub fn copyleft_introduced(
    old: &BTreeSet<String>,
    new: &BTreeSet<String>,
) -> bool
Expand description

detects whether a copyleft license was newly introduced between two license sets.

returns true iff new contains a copyleft license (per is_copyleft_license) that is not present in old. A copyleft license carried over from old is not an introduction, and permissive-only changes never fire.

ยงExample

use sbom_model::copyleft_introduced;
use std::collections::BTreeSet;

let old: BTreeSet<String> = ["MIT".into()].into();
let new: BTreeSet<String> = ["GPL-3.0-only".into()].into();
assert!(copyleft_introduced(&old, &new));

let permissive: BTreeSet<String> = ["Apache-2.0".into()].into();
assert!(!copyleft_introduced(&old, &permissive));