licence-forbidden: consider directly contain forbidden licenses
This commit is contained in:
parent
e9ff0fac43
commit
80887e649b
@ -346,13 +346,20 @@ end
|
|||||||
|
|
||||||
def forbidden_license_check(f)
|
def forbidden_license_check(f)
|
||||||
forbidden_licenses = ENV["HOMEBREW_FORBIDDEN_LICENSES"].split(" ")
|
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 = FormulaInstaller.new(f)
|
||||||
fi.compute_dependencies.each do |dep, _|
|
fi.compute_dependencies.each do |dep, _|
|
||||||
dep_f = dep.to_formula
|
dep_f = dep.to_formula
|
||||||
next unless forbidden_licenses.include? dep_f.license
|
next unless forbidden_licenses.include? dep_f.license
|
||||||
|
|
||||||
raise CannotInstallFormulaError, <<~EOS
|
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
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user