mirror of
https://github.com/anchore/syft.git
synced 2026-11-05 00:46:38 +01:00
fix: "or-later" suffix updated to consider deprecated "+" operator (#1907)
* fix: or-later suffix has been updated to consider deprecated + If a given license has the suffix "or-later" it previously could have been considered or represented with a "+". Example "GFDL-1.0-or-later" could have been represented as "GFDL-1.0+". This PR allows the license list generation to consider "or-later" as == to "+" when generating permutations for upgrading deprecated licenses. --------- Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
This commit is contained in:
@@ -77,11 +77,16 @@ func (l License) canReplace(deprecated License) bool {
|
||||
|
||||
func buildLicenseIDPermutations(cleanID string) (perms []string) {
|
||||
lv := findLicenseVersion(cleanID)
|
||||
addPlusPermutation := strings.HasSuffix(cleanID, "orlater")
|
||||
vp := versionPermutations(lv)
|
||||
|
||||
permSet := strset.New()
|
||||
version := strings.Join(lv, ".")
|
||||
for _, p := range vp {
|
||||
if addPlusPermutation {
|
||||
base := strings.TrimSuffix(cleanID, "orlater")
|
||||
plus := p + "+"
|
||||
permSet.Add(strings.Replace(base, version, plus, 1))
|
||||
}
|
||||
permSet.Add(strings.Replace(cleanID, version, p, 1))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user