diff --git a/Library/Homebrew/test/utils/spdx_spec.rb b/Library/Homebrew/test/utils/spdx_spec.rb index 40045647f9..c4852de199 100644 --- a/Library/Homebrew/test/utils/spdx_spec.rb +++ b/Library/Homebrew/test/utils/spdx_spec.rb @@ -132,10 +132,18 @@ describe SPDX do expect(described_class.deprecated_license?("GPL-1.0")).to eq true end + it "returns true for deprecated license identifier with plus" do + expect(described_class.deprecated_license?("GPL-1.0+")).to eq true + end + it "returns false for non-deprecated license identifier" do expect(described_class.deprecated_license?("MIT")).to eq false end + it "returns false for non-deprecated license identifier with plus" do + expect(described_class.deprecated_license?("EPL-1.0+")).to eq false + end + it "returns false for invalid license identifier" do expect(described_class.deprecated_license?("foo")).to eq false end diff --git a/Library/Homebrew/utils/spdx.rb b/Library/Homebrew/utils/spdx.rb index 675576c5d0..43e19401f7 100644 --- a/Library/Homebrew/utils/spdx.rb +++ b/Library/Homebrew/utils/spdx.rb @@ -78,6 +78,7 @@ module SPDX return false if ALLOWED_LICENSE_SYMBOLS.include? license return false unless valid_license?(license) + license = license.delete_suffix "+" license_data["licenses"].none? do |spdx_license| spdx_license["licenseId"] == license && !spdx_license["isDeprecatedLicenseId"] end