Forbidden license logic adapt to Array

This commit is contained in:
lionellloh 2020-07-12 12:50:50 +08:00 committed by Lionell
parent 557b1d09a2
commit 14d18a9731

View File

@ -1123,18 +1123,18 @@ class FormulaInstaller
next if @ignore_deps next if @ignore_deps
dep_f = dep.to_formula dep_f = dep.to_formula
next unless forbidden_licenses.include? dep_f.license next unless dep_f.license.all?{ |lic| forbidden_licenses.include? lic }
raise CannotInstallFormulaError, <<~EOS raise CannotInstallFormulaError, <<~EOS
The installation of #{formula.name} has a dependency on #{dep.name} with a forbidden license #{dep_f.license}. The installation of #{formula.name} has a dependency on #{dep.name} where all its licenses are forbidden: #{dep_f.license}.
EOS EOS
end end
return if @only_deps return if @only_deps
return unless forbidden_licenses.include? formula.license return unless formula.license.all? { |lic| forbidden_licenses.include? lic }
raise CannotInstallFormulaError, <<~EOS raise CannotInstallFormulaError, <<~EOS
#{formula.name} has a forbidden license #{formula.license}. #{formula.name}'s licenses are all forbidden: #{formula.license}.
EOS EOS
end end
end end