licence-forbidden: consider directly contain forbidden licenses

This commit is contained in:
lionellloh 2020-07-02 00:25:48 +08:00 committed by Lionell
parent e9ff0fac43
commit 80887e649b

View File

@ -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