diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 42af74c223..9976d5bd64 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -346,13 +346,20 @@ end def forbidden_license_check(f) forbidden_licenses = ENV["HOMEBREW_FORBIDDEN_LICENSES"].split(" ") + + if forbidden_licenses.include? f.license + raise CannotInstallFormulaError , <<~EOS + #{f.name} has a forbidden license #{f.license}. + EOS + end + fi = FormulaInstaller.new(f) fi.compute_dependencies.each do |dep, _| dep_f = dep.to_formula next unless forbidden_licenses.include? dep_f.license raise CannotInstallFormulaError, <<~EOS - #The installation of {f.name} has a dependency on #{dep.name} with a forbidden license #{dep_f.license} + The installation of #{f.name} has a dependency on #{dep.name} with a forbidden license #{dep_f.license}. EOS end end