-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #1179 Deprecated SPDX license #1263
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,23 @@ func (l License) canReplace(other License) bool { | |
return false | ||
} | ||
|
||
// We want to replace deprecated licenses with non-deprecated counterparts | ||
// For more information, see: https://github.com/spdx/license-list-XML/issues/1676 | ||
if other.Deprecated { | ||
switch { | ||
case strings.ReplaceAll(l.ID, "-only", "") == other.ID: | ||
return true | ||
case strings.ReplaceAll(l.ID, "-or-later", "+") == other.ID: | ||
return true | ||
case l.ID == "BSD-2-Clause" && other.ID == "BSD-2-Clause-NetBSD": | ||
return true | ||
case l.ID == "BSD-2-Clause-Views" && other.ID == "BSD-2-Clause-FreeBSD": | ||
return true | ||
case l.ID == "bzip2-1.0.6" && other.ID == "bzip2-1.0.5": | ||
return true | ||
} | ||
} | ||
|
||
if l.Name != other.Name { | ||
return false | ||
} | ||
|
@@ -43,7 +60,7 @@ func (l License) canReplace(other License) bool { | |
} | ||
} | ||
|
||
return l.ID != other.ID | ||
return l.ID == other.ID | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did we have to flip this here? I admit it's a little hard to reason about this case since it's the last one checked with so many other chances of an early return There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the look @spiffcs -- this function is |
||
} | ||
|
||
func (ll LicenseList) findReplacementLicense(deprecated License) *License { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting that the casing has changed here, but just wanted to confirm for others who come across this that these are correct as of 3.18:
https://spdx.org/licenses/ <-- "or" and "only" are lower cased here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I believe these should be lower cased. I don't see any license with upper case variants.