Moved code from install -> formula_installer
This commit is contained in:
parent
56bde378f3
commit
f0222c3eb7
@ -259,7 +259,6 @@ module Homebrew
|
|||||||
|
|
||||||
formulae.each do |f|
|
formulae.each do |f|
|
||||||
Migrator.migrate_if_needed(f)
|
Migrator.migrate_if_needed(f)
|
||||||
forbidden_license_check(f)
|
|
||||||
install_formula(f)
|
install_formula(f)
|
||||||
Cleanup.install_formula_clean!(f)
|
Cleanup.install_formula_clean!(f)
|
||||||
end
|
end
|
||||||
@ -342,30 +341,4 @@ module Homebrew
|
|||||||
rescue CannotInstallFormulaError => e
|
rescue CannotInstallFormulaError => e
|
||||||
ofail e.message
|
ofail e.message
|
||||||
end
|
end
|
||||||
|
|
||||||
def env_forbidden_licenses
|
|
||||||
Homebrew::EnvConfig.forbidden_licenses.split(" ")
|
|
||||||
end
|
|
||||||
|
|
||||||
def forbidden_license_check(f)
|
|
||||||
return if ENV["HOMEBREW_FORBIDDEN_LICENSES"].blank?
|
|
||||||
|
|
||||||
forbidden_licenses = env_forbidden_licenses
|
|
||||||
|
|
||||||
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}.
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -149,7 +149,7 @@ class FormulaInstaller
|
|||||||
def prelude
|
def prelude
|
||||||
Tab.clear_cache
|
Tab.clear_cache
|
||||||
verify_deps_exist unless ignore_deps?
|
verify_deps_exist unless ignore_deps?
|
||||||
Homebrew.forbidden_license_check(formula)
|
forbidden_license_check(formula)
|
||||||
|
|
||||||
check_install_sanity
|
check_install_sanity
|
||||||
end
|
end
|
||||||
@ -1105,4 +1105,30 @@ class FormulaInstaller
|
|||||||
|
|
||||||
$stderr.puts @requirement_messages
|
$stderr.puts @requirement_messages
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def env_forbidden_licenses
|
||||||
|
Homebrew::EnvConfig.forbidden_licenses.split(" ")
|
||||||
|
end
|
||||||
|
|
||||||
|
def forbidden_license_check(f)
|
||||||
|
return if ENV["HOMEBREW_FORBIDDEN_LICENSES"].blank?
|
||||||
|
|
||||||
|
forbidden_licenses = env_forbidden_licenses
|
||||||
|
|
||||||
|
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}.
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user