Merge pull request #7874 from chenrui333/disable-license-check-for-new-formulae
disable license check for new formulae
This commit is contained in:
commit
05a7a2ccc8
@ -333,23 +333,21 @@ module Homebrew
|
||||
].freeze
|
||||
|
||||
def audit_license
|
||||
if formula.license.present?
|
||||
if @spdx_data["licenses"].any? { |lic| lic["licenseId"] == formula.license }
|
||||
return unless @online
|
||||
return if formula.license.blank?
|
||||
|
||||
user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if @new_formula
|
||||
return if user.blank?
|
||||
if @spdx_data["licenses"].any? { |lic| lic["licenseId"] == formula.license }
|
||||
return unless @online
|
||||
|
||||
github_license = GitHub.get_repo_license(user, repo)
|
||||
return if github_license && (github_license == formula.license)
|
||||
user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if @new_formula
|
||||
return if user.blank?
|
||||
|
||||
problem "License mismatch - GitHub license is: #{github_license}, "\
|
||||
"but Formulae license states: #{formula.license}."
|
||||
else
|
||||
problem "#{formula.license} is not a standard SPDX license."
|
||||
end
|
||||
elsif @new_formula
|
||||
problem "No license specified for package."
|
||||
github_license = GitHub.get_repo_license(user, repo)
|
||||
return if github_license && (github_license == formula.license)
|
||||
|
||||
problem "License mismatch - GitHub license is: #{github_license}, "\
|
||||
"but Formulae license states: #{formula.license}."
|
||||
else
|
||||
problem "#{formula.license} is not a standard SPDX license."
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -99,18 +99,6 @@ module Homebrew
|
||||
expect(fa.problems).to be_empty
|
||||
end
|
||||
|
||||
it "detects no license info" do
|
||||
fa = formula_auditor "foo", <<~RUBY, spdx_data: spdx_data, new_formula: true
|
||||
class Foo < Formula
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
license ""
|
||||
end
|
||||
RUBY
|
||||
|
||||
fa.audit_license
|
||||
expect(fa.problems.first).to match "No license specified for package."
|
||||
end
|
||||
|
||||
it "detects if license is not a standard spdx-id" do
|
||||
fa = formula_auditor "foo", <<~RUBY, spdx_data: spdx_data, new_formula: true
|
||||
class Foo < Formula
|
||||
|
Loading…
x
Reference in New Issue
Block a user