diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 176aae7720..c90a229f74 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -333,6 +333,7 @@ module Homebrew non_standard_licenses = [] formula.license.each do |lic| next if @spdx_data["licenses"].any? { |standard_lic| standard_lic["licenseId"] == lic } + non_standard_licenses << lic end @@ -340,17 +341,16 @@ module Homebrew problem "Formula #{formula.name} contains non standard SPDX license: #{non_standard_licenses}." end - return unless @online + return unless @online - user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if @new_formula - return if user.blank? + user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if @new_formula + return if user.blank? - github_license = GitHub.get_repo_license(user, repo) - return if github_license && (formula.license + ["NOASSERTION"]).include?(github_license) - - problem "License mismatch - GitHub license is: #{Array(github_license)}, "\ - "but Formulae license states: #{formula.license}." + github_license = GitHub.get_repo_license(user, repo) + return if github_license && (formula.license + ["NOASSERTION"]).include?(github_license) + problem "License mismatch - GitHub license is: #{Array(github_license)}, "\ + "but Formulae license states: #{formula.license}." elsif @new_formula problem "No license specified for package." diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 4cb64c7add..fc790ab329 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2214,11 +2214,11 @@ class Formula #
license "BSD-2-Clause"
def license(args = nil) if args.nil? - return @licenses + @licenses else @licenses = Array(args) unless args == "" puts @licenses - # license. + # license. end end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 30a572c617..7d7938a8fb 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -1123,7 +1123,7 @@ class FormulaInstaller next if @ignore_deps dep_f = dep.to_formula - next unless dep_f.license.all?{ |lic| forbidden_licenses.include? lic } + next unless dep_f.license.all? { |lic| forbidden_licenses.include? lic } raise CannotInstallFormulaError, <<~EOS The installation of #{formula.name} has a dependency on #{dep.name} where all its licenses are forbidden: #{dep_f.license}.