Rename "f" to "formula" in the installer
This commit is contained in:
parent
d1fae671f1
commit
1195718d0e
@ -70,7 +70,7 @@ end
|
|||||||
class FormulaAuditor
|
class FormulaAuditor
|
||||||
include FormulaCellarChecks
|
include FormulaCellarChecks
|
||||||
|
|
||||||
attr_reader :f, :text, :problems
|
attr_reader :formula, :text, :problems
|
||||||
|
|
||||||
BUILD_TIME_DEPS = %W[
|
BUILD_TIME_DEPS = %W[
|
||||||
autoconf
|
autoconf
|
||||||
@ -87,27 +87,27 @@ class FormulaAuditor
|
|||||||
swig
|
swig
|
||||||
]
|
]
|
||||||
|
|
||||||
def initialize f
|
def initialize(formula)
|
||||||
@f = f
|
@formula = formula
|
||||||
@problems = []
|
@problems = []
|
||||||
@text = f.text.without_patch
|
@text = formula.text.without_patch
|
||||||
@specs = %w{stable devel head}.map { |s| f.send(s) }.compact
|
@specs = %w{stable devel head}.map { |s| formula.send(s) }.compact
|
||||||
end
|
end
|
||||||
|
|
||||||
def audit_file
|
def audit_file
|
||||||
unless f.path.stat.mode.to_s(8) == "100644"
|
unless formula.path.stat.mode.to_s(8) == "100644"
|
||||||
problem "Incorrect file permissions: chmod 644 #{f.path}"
|
problem "Incorrect file permissions: chmod 644 #{formula.path}"
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.text.has_DATA? and not f.text.has_END?
|
if formula.text.has_DATA? and not formula.text.has_END?
|
||||||
problem "'DATA' was found, but no '__END__'"
|
problem "'DATA' was found, but no '__END__'"
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.text.has_END? and not f.text.has_DATA?
|
if formula.text.has_END? and not formula.text.has_DATA?
|
||||||
problem "'__END__' was found, but 'DATA' is not used"
|
problem "'__END__' was found, but 'DATA' is not used"
|
||||||
end
|
end
|
||||||
|
|
||||||
unless f.text.has_trailing_newline?
|
unless formula.text.has_trailing_newline?
|
||||||
problem "File should end with a newline"
|
problem "File should end with a newline"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -167,7 +167,7 @@ class FormulaAuditor
|
|||||||
end
|
end
|
||||||
|
|
||||||
def audit_conflicts
|
def audit_conflicts
|
||||||
f.conflicts.each do |c|
|
formula.conflicts.each do |c|
|
||||||
begin
|
begin
|
||||||
Formulary.factory(c.name)
|
Formulary.factory(c.name)
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
@ -177,7 +177,7 @@ class FormulaAuditor
|
|||||||
end
|
end
|
||||||
|
|
||||||
def audit_urls
|
def audit_urls
|
||||||
homepage = f.homepage
|
homepage = formula.homepage
|
||||||
|
|
||||||
unless homepage =~ %r[^https?://]
|
unless homepage =~ %r[^https?://]
|
||||||
problem "The homepage should start with http or https (URL is #{homepage})."
|
problem "The homepage should start with http or https (URL is #{homepage})."
|
||||||
@ -266,10 +266,10 @@ class FormulaAuditor
|
|||||||
end
|
end
|
||||||
|
|
||||||
def audit_specs
|
def audit_specs
|
||||||
problem "Head-only (no stable download)" if f.head_only?
|
problem "Head-only (no stable download)" if formula.head_only?
|
||||||
|
|
||||||
%w[Stable Devel HEAD].each do |name|
|
%w[Stable Devel HEAD].each do |name|
|
||||||
next unless spec = f.send(name.downcase)
|
next unless spec = formula.send(name.downcase)
|
||||||
|
|
||||||
ra = ResourceAuditor.new(spec).audit
|
ra = ResourceAuditor.new(spec).audit
|
||||||
problems.concat ra.problems.map { |problem| "#{name}: #{problem}" }
|
problems.concat ra.problems.map { |problem| "#{name}: #{problem}" }
|
||||||
@ -284,17 +284,17 @@ class FormulaAuditor
|
|||||||
spec.patches.select(&:external?).each { |p| audit_patch(p) }
|
spec.patches.select(&:external?).each { |p| audit_patch(p) }
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.stable && f.devel
|
if formula.stable && formula.devel
|
||||||
if f.devel.version < f.stable.version
|
if formula.devel.version < formula.stable.version
|
||||||
problem "devel version #{f.devel.version} is older than stable version #{f.stable.version}"
|
problem "devel version #{formula.devel.version} is older than stable version #{formula.stable.version}"
|
||||||
elsif f.devel.version == f.stable.version
|
elsif formula.devel.version == formula.stable.version
|
||||||
problem "stable and devel versions are identical"
|
problem "stable and devel versions are identical"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def audit_patches
|
def audit_patches
|
||||||
legacy_patches = Patch.normalize_legacy_patches(f.patches).grep(LegacyPatch)
|
legacy_patches = Patch.normalize_legacy_patches(formula.patches).grep(LegacyPatch)
|
||||||
if legacy_patches.any?
|
if legacy_patches.any?
|
||||||
problem "Use the patch DSL instead of defining a 'patches' method"
|
problem "Use the patch DSL instead of defining a 'patches' method"
|
||||||
legacy_patches.each { |p| audit_patch(p) }
|
legacy_patches.each { |p| audit_patch(p) }
|
||||||
|
@ -18,7 +18,7 @@ module FormulaCellarChecks
|
|||||||
|
|
||||||
def check_manpages
|
def check_manpages
|
||||||
# Check for man pages that aren't in share/man
|
# Check for man pages that aren't in share/man
|
||||||
return unless (f.prefix+'man').directory?
|
return unless (formula.prefix+'man').directory?
|
||||||
|
|
||||||
<<-EOS.undent
|
<<-EOS.undent
|
||||||
A top-level "man" directory was found
|
A top-level "man" directory was found
|
||||||
@ -29,7 +29,7 @@ module FormulaCellarChecks
|
|||||||
|
|
||||||
def check_infopages
|
def check_infopages
|
||||||
# Check for info pages that aren't in share/info
|
# Check for info pages that aren't in share/info
|
||||||
return unless (f.prefix+'info').directory?
|
return unless (formula.prefix+'info').directory?
|
||||||
|
|
||||||
<<-EOS.undent
|
<<-EOS.undent
|
||||||
A top-level "info" directory was found
|
A top-level "info" directory was found
|
||||||
@ -39,12 +39,12 @@ module FormulaCellarChecks
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_jars
|
def check_jars
|
||||||
return unless f.lib.directory?
|
return unless formula.lib.directory?
|
||||||
jars = f.lib.children.select { |g| g.extname == ".jar" }
|
jars = formula.lib.children.select { |g| g.extname == ".jar" }
|
||||||
return if jars.empty?
|
return if jars.empty?
|
||||||
|
|
||||||
<<-EOS.undent
|
<<-EOS.undent
|
||||||
JARs were installed to "#{f.lib}"
|
JARs were installed to "#{formula.lib}"
|
||||||
Installing JARs to "lib" can cause conflicts between packages.
|
Installing JARs to "lib" can cause conflicts between packages.
|
||||||
For Java software, it is typically better for the formula to
|
For Java software, it is typically better for the formula to
|
||||||
install to "libexec" and then symlink or wrap binaries into "bin".
|
install to "libexec" and then symlink or wrap binaries into "bin".
|
||||||
@ -55,18 +55,18 @@ module FormulaCellarChecks
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_non_libraries
|
def check_non_libraries
|
||||||
return unless f.lib.directory?
|
return unless formula.lib.directory?
|
||||||
|
|
||||||
valid_extensions = %w(.a .dylib .framework .jnilib .la .o .so
|
valid_extensions = %w(.a .dylib .framework .jnilib .la .o .so
|
||||||
.jar .prl .pm .sh)
|
.jar .prl .pm .sh)
|
||||||
non_libraries = f.lib.children.select do |g|
|
non_libraries = formula.lib.children.select do |g|
|
||||||
next if g.directory?
|
next if g.directory?
|
||||||
not valid_extensions.include? g.extname
|
not valid_extensions.include? g.extname
|
||||||
end
|
end
|
||||||
return if non_libraries.empty?
|
return if non_libraries.empty?
|
||||||
|
|
||||||
<<-EOS.undent
|
<<-EOS.undent
|
||||||
Non-libraries were installed to "#{f.lib}"
|
Non-libraries were installed to "#{formula.lib}"
|
||||||
Installing non-libraries to "lib" is discouraged.
|
Installing non-libraries to "lib" is discouraged.
|
||||||
The offending files are:
|
The offending files are:
|
||||||
#{non_libraries * "\n "}
|
#{non_libraries * "\n "}
|
||||||
@ -104,17 +104,17 @@ module FormulaCellarChecks
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_shadowed_headers
|
def check_shadowed_headers
|
||||||
return if f.name == "libtool" || f.name == "subversion"
|
return if formula.name == "libtool" || formula.name == "subversion"
|
||||||
return if f.keg_only? || !f.include.directory?
|
return if formula.keg_only? || !formula.include.directory?
|
||||||
|
|
||||||
files = relative_glob(f.include, "**/*.h")
|
files = relative_glob(formula.include, "**/*.h")
|
||||||
files &= relative_glob("#{MacOS.sdk_path}/usr/include", "**/*.h")
|
files &= relative_glob("#{MacOS.sdk_path}/usr/include", "**/*.h")
|
||||||
files.map! { |p| File.join(f.include, p) }
|
files.map! { |p| File.join(formula.include, p) }
|
||||||
|
|
||||||
return if files.empty?
|
return if files.empty?
|
||||||
|
|
||||||
<<-EOS.undent
|
<<-EOS.undent
|
||||||
Header files that shadow system header files were installed to "#{f.include}"
|
Header files that shadow system header files were installed to "#{formula.include}"
|
||||||
The offending files are:
|
The offending files are:
|
||||||
#{files * "\n "}
|
#{files * "\n "}
|
||||||
EOS
|
EOS
|
||||||
@ -135,9 +135,9 @@ module FormulaCellarChecks
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_openssl_links
|
def check_openssl_links
|
||||||
return unless f.prefix.directory?
|
return unless formula.prefix.directory?
|
||||||
return if f.name == "android-ndk"
|
return if formula.name == "android-ndk"
|
||||||
keg = Keg.new(f.prefix)
|
keg = Keg.new(formula.prefix)
|
||||||
system_openssl = keg.mach_o_files.select do |obj|
|
system_openssl = keg.mach_o_files.select do |obj|
|
||||||
dlls = obj.dynamically_linked_libraries
|
dlls = obj.dynamically_linked_libraries
|
||||||
dlls.any? { |dll| /\/usr\/lib\/lib(crypto|ssl).(\d\.)*dylib/.match dll }
|
dlls.any? { |dll| /\/usr\/lib\/lib(crypto|ssl).(\d\.)*dylib/.match dll }
|
||||||
@ -157,12 +157,12 @@ module FormulaCellarChecks
|
|||||||
audit_check_output(check_infopages)
|
audit_check_output(check_infopages)
|
||||||
audit_check_output(check_jars)
|
audit_check_output(check_jars)
|
||||||
audit_check_output(check_non_libraries)
|
audit_check_output(check_non_libraries)
|
||||||
audit_check_output(check_non_executables(f.bin))
|
audit_check_output(check_non_executables(formula.bin))
|
||||||
audit_check_output(check_generic_executables(f.bin))
|
audit_check_output(check_generic_executables(formula.bin))
|
||||||
audit_check_output(check_non_executables(f.sbin))
|
audit_check_output(check_non_executables(formula.sbin))
|
||||||
audit_check_output(check_generic_executables(f.sbin))
|
audit_check_output(check_generic_executables(formula.sbin))
|
||||||
audit_check_output(check_shadowed_headers)
|
audit_check_output(check_shadowed_headers)
|
||||||
audit_check_output(check_easy_install_pth(f.lib))
|
audit_check_output(check_easy_install_pth(formula.lib))
|
||||||
audit_check_output(check_openssl_links)
|
audit_check_output(check_openssl_links)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,15 +22,15 @@ class FormulaInstaller
|
|||||||
names.each { |name| define_method("#{name}?") { !!send(name) }}
|
names.each { |name| define_method("#{name}?") { !!send(name) }}
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :f
|
attr_reader :formula
|
||||||
attr_accessor :options
|
attr_accessor :options
|
||||||
mode_attr_accessor :show_summary_heading, :show_header
|
mode_attr_accessor :show_summary_heading, :show_header
|
||||||
mode_attr_accessor :build_from_source, :build_bottle, :force_bottle
|
mode_attr_accessor :build_from_source, :build_bottle, :force_bottle
|
||||||
mode_attr_accessor :ignore_deps, :only_deps, :interactive
|
mode_attr_accessor :ignore_deps, :only_deps, :interactive
|
||||||
mode_attr_accessor :verbose, :debug
|
mode_attr_accessor :verbose, :debug
|
||||||
|
|
||||||
def initialize ff
|
def initialize(formula)
|
||||||
@f = ff
|
@formula = formula
|
||||||
@show_header = false
|
@show_header = false
|
||||||
@ignore_deps = false
|
@ignore_deps = false
|
||||||
@only_deps = false
|
@only_deps = false
|
||||||
@ -49,19 +49,21 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pour_bottle? install_bottle_options={:warn=>false}
|
def pour_bottle? install_bottle_options={:warn=>false}
|
||||||
return true if Homebrew::Hooks::Bottles.formula_has_bottle?(f)
|
return true if Homebrew::Hooks::Bottles.formula_has_bottle?(formula)
|
||||||
|
|
||||||
return false if @pour_failed
|
return false if @pour_failed
|
||||||
return true if force_bottle? && f.bottle
|
|
||||||
|
bottle = formula.bottle
|
||||||
|
return true if force_bottle? && bottle
|
||||||
return false if build_from_source? || build_bottle? || interactive?
|
return false if build_from_source? || build_bottle? || interactive?
|
||||||
return false unless options.empty?
|
return false unless options.empty?
|
||||||
|
|
||||||
return true if f.local_bottle_path
|
return true if formula.local_bottle_path
|
||||||
return false unless f.bottle && f.pour_bottle?
|
return false unless bottle && formula.pour_bottle?
|
||||||
|
|
||||||
unless f.bottle.compatible_cellar?
|
unless bottle.compatible_cellar?
|
||||||
if install_bottle_options[:warn]
|
if install_bottle_options[:warn]
|
||||||
opoo "Building source; cellar of #{f.name}'s bottle is #{f.bottle.cellar}"
|
opoo "Building source; cellar of #{formula.name}'s bottle is #{bottle.cellar}"
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -70,7 +72,7 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def install_bottle_for?(dep, build)
|
def install_bottle_for?(dep, build)
|
||||||
return pour_bottle? if dep == f
|
return pour_bottle? if dep == formula
|
||||||
return false if build_from_source?
|
return false if build_from_source?
|
||||||
return false unless dep.bottle && dep.pour_bottle?
|
return false unless dep.bottle && dep.pour_bottle?
|
||||||
return false unless build.used_options.empty?
|
return false unless build.used_options.empty?
|
||||||
@ -86,7 +88,7 @@ class FormulaInstaller
|
|||||||
|
|
||||||
def verify_deps_exist
|
def verify_deps_exist
|
||||||
begin
|
begin
|
||||||
f.recursive_dependencies.map(&:to_formula)
|
formula.recursive_dependencies.map(&:to_formula)
|
||||||
rescue TapFormulaUnavailableError => e
|
rescue TapFormulaUnavailableError => e
|
||||||
if Homebrew.install_tap(e.user, e.repo)
|
if Homebrew.install_tap(e.user, e.repo)
|
||||||
retry
|
retry
|
||||||
@ -95,25 +97,25 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue FormulaUnavailableError => e
|
rescue FormulaUnavailableError => e
|
||||||
e.dependent = f.name
|
e.dependent = formula.name
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_install_sanity
|
def check_install_sanity
|
||||||
raise FormulaInstallationAlreadyAttemptedError, f if @@attempted.include? f
|
raise FormulaInstallationAlreadyAttemptedError, formula if @@attempted.include?(formula)
|
||||||
|
|
||||||
if f.installed?
|
if formula.installed?
|
||||||
msg = "#{f.name}-#{f.installed_version} already installed"
|
msg = "#{formula.name}-#{formula.installed_version} already installed"
|
||||||
msg << ", it's just not linked" unless f.linked_keg.symlink? or f.keg_only?
|
msg << ", it's just not linked" unless formula.linked_keg.symlink? or formula.keg_only?
|
||||||
raise FormulaAlreadyInstalledError, msg
|
raise FormulaAlreadyInstalledError, msg
|
||||||
end
|
end
|
||||||
|
|
||||||
unless ignore_deps?
|
unless ignore_deps?
|
||||||
unlinked_deps = f.recursive_dependencies.map(&:to_formula).select do |dep|
|
unlinked_deps = formula.recursive_dependencies.map(&:to_formula).select do |dep|
|
||||||
dep.installed? and not dep.keg_only? and not dep.linked_keg.directory?
|
dep.installed? and not dep.keg_only? and not dep.linked_keg.directory?
|
||||||
end
|
end
|
||||||
raise CannotInstallFormulaError,
|
raise CannotInstallFormulaError,
|
||||||
"You must `brew link #{unlinked_deps*' '}' before #{f.name} can be installed" unless unlinked_deps.empty?
|
"You must `brew link #{unlinked_deps*' '}' before #{formula.name} can be installed" unless unlinked_deps.empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -125,7 +127,7 @@ class FormulaInstaller
|
|||||||
def build_bottle_postinstall
|
def build_bottle_postinstall
|
||||||
@etc_var_postinstall = Dir[@etc_var_glob]
|
@etc_var_postinstall = Dir[@etc_var_glob]
|
||||||
(@etc_var_postinstall - @etc_var_preinstall).each do |file|
|
(@etc_var_postinstall - @etc_var_preinstall).each do |file|
|
||||||
Pathname.new(file).cp_path_sub(HOMEBREW_PREFIX, f.bottle_prefix)
|
Pathname.new(file).cp_path_sub(HOMEBREW_PREFIX, formula.bottle_prefix)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -133,11 +135,11 @@ class FormulaInstaller
|
|||||||
# not in initialize so upgrade can unlink the active keg before calling this
|
# not in initialize so upgrade can unlink the active keg before calling this
|
||||||
# function but after instantiating this class so that it can avoid having to
|
# function but after instantiating this class so that it can avoid having to
|
||||||
# relink the active keg if possible (because it is slow).
|
# relink the active keg if possible (because it is slow).
|
||||||
if f.linked_keg.directory?
|
if formula.linked_keg.directory?
|
||||||
# some other version is already installed *and* linked
|
# some other version is already installed *and* linked
|
||||||
raise CannotInstallFormulaError, <<-EOS.undent
|
raise CannotInstallFormulaError, <<-EOS.undent
|
||||||
#{f.name}-#{f.linked_keg.resolved_path.basename} already installed
|
#{formula.name}-#{formula.linked_keg.resolved_path.basename} already installed
|
||||||
To install this version, first `brew unlink #{f.name}'
|
To install this version, first `brew unlink #{formula.name}'
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -151,15 +153,15 @@ class FormulaInstaller
|
|||||||
raise "Unrecognized architecture for --bottle-arch: #{arch}"
|
raise "Unrecognized architecture for --bottle-arch: #{arch}"
|
||||||
end
|
end
|
||||||
|
|
||||||
f.active_spec.deprecated_flags.each do |deprecated_option|
|
formula.active_spec.deprecated_flags.each do |deprecated_option|
|
||||||
old_flag = deprecated_option.old_flag
|
old_flag = deprecated_option.old_flag
|
||||||
new_flag = deprecated_option.current_flag
|
new_flag = deprecated_option.current_flag
|
||||||
opoo "#{f.name}: #{old_flag} was deprecated; using #{new_flag} instead!"
|
opoo "#{formula.name}: #{old_flag} was deprecated; using #{new_flag} instead!"
|
||||||
end
|
end
|
||||||
|
|
||||||
oh1 "Installing #{Tty.green}#{f.name}#{Tty.reset}" if show_header?
|
oh1 "Installing #{Tty.green}#{formula.name}#{Tty.reset}" if show_header?
|
||||||
|
|
||||||
@@attempted << f
|
@@attempted << formula
|
||||||
|
|
||||||
if pour_bottle?(:warn => true)
|
if pour_bottle?(:warn => true)
|
||||||
begin
|
begin
|
||||||
@ -184,13 +186,13 @@ class FormulaInstaller
|
|||||||
|
|
||||||
build_bottle_postinstall if build_bottle?
|
build_bottle_postinstall if build_bottle?
|
||||||
|
|
||||||
opoo "Nothing was installed to #{f.prefix}" unless f.installed?
|
opoo "Nothing was installed to #{formula.prefix}" unless formula.installed?
|
||||||
end
|
end
|
||||||
|
|
||||||
# HACK: If readline is present in the dependency tree, it will clash
|
# HACK: If readline is present in the dependency tree, it will clash
|
||||||
# with the stdlib's Readline module when the debugger is loaded
|
# with the stdlib's Readline module when the debugger is loaded
|
||||||
def perform_readline_hack
|
def perform_readline_hack
|
||||||
if (f.recursive_dependencies.any? { |d| d.name == "readline" } || f.name == "readline") && debug?
|
if (formula.recursive_dependencies.any? { |d| d.name == "readline" } || formula.name == "readline") && debug?
|
||||||
ENV['HOMEBREW_NO_READLINE'] = '1'
|
ENV['HOMEBREW_NO_READLINE'] = '1'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -198,12 +200,12 @@ class FormulaInstaller
|
|||||||
def check_conflicts
|
def check_conflicts
|
||||||
return if ARGV.force?
|
return if ARGV.force?
|
||||||
|
|
||||||
conflicts = f.conflicts.reject do |c|
|
conflicts = formula.conflicts.reject do |c|
|
||||||
keg = Formulary.factory(c.name).prefix
|
keg = Formulary.factory(c.name).prefix
|
||||||
not keg.directory? && Keg.new(keg).linked?
|
not keg.directory? && Keg.new(keg).linked?
|
||||||
end
|
end
|
||||||
|
|
||||||
raise FormulaConflictError.new(f, conflicts) unless conflicts.empty?
|
raise FormulaConflictError.new(formula, conflicts) unless conflicts.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def compute_and_install_dependencies
|
def compute_and_install_dependencies
|
||||||
@ -213,10 +215,10 @@ class FormulaInstaller
|
|||||||
|
|
||||||
check_requirements(req_map)
|
check_requirements(req_map)
|
||||||
|
|
||||||
deps = expand_dependencies(req_deps + f.deps)
|
deps = expand_dependencies(req_deps + formula.deps)
|
||||||
|
|
||||||
if deps.empty? and only_deps?
|
if deps.empty? and only_deps?
|
||||||
puts "All dependencies for #{f.name} are satisfied."
|
puts "All dependencies for #{formula.name} are satisfied."
|
||||||
else
|
else
|
||||||
install_dependencies(deps)
|
install_dependencies(deps)
|
||||||
end
|
end
|
||||||
@ -244,10 +246,9 @@ class FormulaInstaller
|
|||||||
def expand_requirements
|
def expand_requirements
|
||||||
unsatisfied_reqs = Hash.new { |h, k| h[k] = [] }
|
unsatisfied_reqs = Hash.new { |h, k| h[k] = [] }
|
||||||
deps = []
|
deps = []
|
||||||
formulae = [f]
|
formulae = [formula]
|
||||||
|
|
||||||
while f = formulae.pop
|
while f = formulae.pop
|
||||||
|
|
||||||
f.recursive_requirements do |dependent, req|
|
f.recursive_requirements do |dependent, req|
|
||||||
build = effective_build_options_for(dependent)
|
build = effective_build_options_for(dependent)
|
||||||
|
|
||||||
@ -274,7 +275,7 @@ class FormulaInstaller
|
|||||||
def expand_dependencies(deps)
|
def expand_dependencies(deps)
|
||||||
inherited_options = {}
|
inherited_options = {}
|
||||||
|
|
||||||
expanded_deps = Dependency.expand(f, deps) do |dependent, dep|
|
expanded_deps = Dependency.expand(formula, deps) do |dependent, dep|
|
||||||
options = inherited_options[dep.name] = inherited_options_for(dep)
|
options = inherited_options[dep.name] = inherited_options_for(dep)
|
||||||
build = effective_build_options_for(
|
build = effective_build_options_for(
|
||||||
dependent,
|
dependent,
|
||||||
@ -295,7 +296,7 @@ class FormulaInstaller
|
|||||||
|
|
||||||
def effective_build_options_for(dependent, inherited_options=[])
|
def effective_build_options_for(dependent, inherited_options=[])
|
||||||
args = dependent.build.used_options
|
args = dependent.build.used_options
|
||||||
args |= dependent == f ? options : inherited_options
|
args |= dependent == formula ? options : inherited_options
|
||||||
args |= Tab.for_formula(dependent).used_options
|
args |= Tab.for_formula(dependent).used_options
|
||||||
BuildOptions.new(args, dependent.options)
|
BuildOptions.new(args, dependent.options)
|
||||||
end
|
end
|
||||||
@ -303,7 +304,7 @@ class FormulaInstaller
|
|||||||
def inherited_options_for(dep)
|
def inherited_options_for(dep)
|
||||||
inherited_options = Options.new
|
inherited_options = Options.new
|
||||||
u = Option.new("universal")
|
u = Option.new("universal")
|
||||||
if (options.include?(u) || f.require_universal_deps?) && !dep.build? && dep.to_formula.option_defined?(u)
|
if (options.include?(u) || formula.require_universal_deps?) && !dep.build? && dep.to_formula.option_defined?(u)
|
||||||
inherited_options << u
|
inherited_options << u
|
||||||
end
|
end
|
||||||
inherited_options
|
inherited_options
|
||||||
@ -311,7 +312,7 @@ class FormulaInstaller
|
|||||||
|
|
||||||
def install_dependencies(deps)
|
def install_dependencies(deps)
|
||||||
if deps.length > 1
|
if deps.length > 1
|
||||||
oh1 "Installing dependencies for #{f.name}: #{Tty.green}#{deps.map(&:first)*", "}#{Tty.reset}"
|
oh1 "Installing dependencies for #{formula.name}: #{Tty.green}#{deps.map(&:first)*", "}#{Tty.reset}"
|
||||||
end
|
end
|
||||||
|
|
||||||
deps.each { |dep, options| install_dependency(dep, options) }
|
deps.each { |dep, options| install_dependency(dep, options) }
|
||||||
@ -320,7 +321,7 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
class DependencyInstaller < FormulaInstaller
|
class DependencyInstaller < FormulaInstaller
|
||||||
def initialize ff
|
def initialize(*)
|
||||||
super
|
super
|
||||||
@ignore_deps = true
|
@ignore_deps = true
|
||||||
end
|
end
|
||||||
@ -355,7 +356,7 @@ class FormulaInstaller
|
|||||||
fi.verbose = verbose? unless verbose == :quieter
|
fi.verbose = verbose? unless verbose == :quieter
|
||||||
fi.debug = debug?
|
fi.debug = debug?
|
||||||
fi.prelude
|
fi.prelude
|
||||||
oh1 "Installing #{f.name} dependency: #{Tty.green}#{dep.name}#{Tty.reset}"
|
oh1 "Installing #{formula.name} dependency: #{Tty.green}#{dep.name}#{Tty.reset}"
|
||||||
fi.install
|
fi.install
|
||||||
fi.caveats
|
fi.caveats
|
||||||
fi.finish
|
fi.finish
|
||||||
@ -372,9 +373,9 @@ class FormulaInstaller
|
|||||||
def caveats
|
def caveats
|
||||||
return if only_deps?
|
return if only_deps?
|
||||||
|
|
||||||
audit_installed if ARGV.homebrew_developer? and not f.keg_only?
|
audit_installed if ARGV.homebrew_developer? and not formula.keg_only?
|
||||||
|
|
||||||
c = Caveats.new(f)
|
c = Caveats.new(formula)
|
||||||
|
|
||||||
unless c.empty?
|
unless c.empty?
|
||||||
@show_summary_heading = true
|
@show_summary_heading = true
|
||||||
@ -389,7 +390,7 @@ class FormulaInstaller
|
|||||||
|
|
||||||
install_plist
|
install_plist
|
||||||
|
|
||||||
keg = Keg.new(f.prefix)
|
keg = Keg.new(formula.prefix)
|
||||||
link(keg)
|
link(keg)
|
||||||
fix_install_names(keg) if OS.mac?
|
fix_install_names(keg) if OS.mac?
|
||||||
|
|
||||||
@ -408,7 +409,7 @@ class FormulaInstaller
|
|||||||
def summary
|
def summary
|
||||||
s = ""
|
s = ""
|
||||||
s << "#{emoji} " if MacOS.version >= :lion and not ENV['HOMEBREW_NO_EMOJI']
|
s << "#{emoji} " if MacOS.version >= :lion and not ENV['HOMEBREW_NO_EMOJI']
|
||||||
s << "#{f.prefix}: #{f.prefix.abv}"
|
s << "#{formula.prefix}: #{formula.prefix.abv}"
|
||||||
s << ", built in #{pretty_duration build_time}" if build_time
|
s << ", built in #{pretty_duration build_time}" if build_time
|
||||||
s
|
s
|
||||||
end
|
end
|
||||||
@ -436,12 +437,12 @@ class FormulaInstaller
|
|||||||
args << "--cc=#{ARGV.cc}" if ARGV.cc
|
args << "--cc=#{ARGV.cc}" if ARGV.cc
|
||||||
args << "--env=#{ARGV.env}" if ARGV.env
|
args << "--env=#{ARGV.env}" if ARGV.env
|
||||||
|
|
||||||
case f.active_spec
|
case formula.active_spec
|
||||||
when f.head then args << "--HEAD"
|
when formula.head then args << "--HEAD"
|
||||||
when f.devel then args << "--devel"
|
when formula.devel then args << "--devel"
|
||||||
end
|
end
|
||||||
|
|
||||||
f.options.each do |opt|
|
formula.options.each do |opt|
|
||||||
name = opt.name[/\A(.+)=\z$/, 1]
|
name = opt.name[/\A(.+)=\z$/, 1]
|
||||||
value = ARGV.value(name)
|
value = ARGV.value(name)
|
||||||
args << "--#{name}=#{value}" if name && value
|
args << "--#{name}=#{value}" if name && value
|
||||||
@ -455,7 +456,7 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def build
|
def build
|
||||||
FileUtils.rm Dir["#{HOMEBREW_LOGS}/#{f.name}/*"]
|
FileUtils.rm Dir["#{HOMEBREW_LOGS}/#{formula.name}/*"]
|
||||||
|
|
||||||
@start_time = Time.now
|
@start_time = Time.now
|
||||||
|
|
||||||
@ -472,7 +473,7 @@ class FormulaInstaller
|
|||||||
-I #{HOMEBREW_LIBRARY_PATH}
|
-I #{HOMEBREW_LIBRARY_PATH}
|
||||||
--
|
--
|
||||||
#{HOMEBREW_LIBRARY_PATH}/build.rb
|
#{HOMEBREW_LIBRARY_PATH}/build.rb
|
||||||
#{f.path}
|
#{formula.path}
|
||||||
].concat(build_argv)
|
].concat(build_argv)
|
||||||
|
|
||||||
# Ruby 2.0+ sets close-on-exec on all file descriptors except for
|
# Ruby 2.0+ sets close-on-exec on all file descriptors except for
|
||||||
@ -501,24 +502,24 @@ class FormulaInstaller
|
|||||||
raise "Suspicious installation failure" unless $?.success?
|
raise "Suspicious installation failure" unless $?.success?
|
||||||
end
|
end
|
||||||
|
|
||||||
raise "Empty installation" if Dir["#{f.prefix}/*"].empty?
|
raise "Empty installation" if Dir["#{formula.prefix}/*"].empty?
|
||||||
|
|
||||||
rescue Exception
|
rescue Exception
|
||||||
ignore_interrupts do
|
ignore_interrupts do
|
||||||
# any exceptions must leave us with nothing installed
|
# any exceptions must leave us with nothing installed
|
||||||
f.prefix.rmtree if f.prefix.directory?
|
formula.prefix.rmtree if formula.prefix.directory?
|
||||||
f.rack.rmdir_if_possible
|
formula.rack.rmdir_if_possible
|
||||||
end
|
end
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
|
|
||||||
def link(keg)
|
def link(keg)
|
||||||
if f.keg_only?
|
if formula.keg_only?
|
||||||
begin
|
begin
|
||||||
keg.optlink
|
keg.optlink
|
||||||
rescue Keg::LinkError => e
|
rescue Keg::LinkError => e
|
||||||
onoe "Failed to create #{f.opt_prefix}"
|
onoe "Failed to create #{formula.opt_prefix}"
|
||||||
puts "Things that depend on #{f.name} will probably not build."
|
puts "Things that depend on #{formula.name} will probably not build."
|
||||||
puts e
|
puts e
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
end
|
end
|
||||||
@ -548,7 +549,7 @@ class FormulaInstaller
|
|||||||
puts e
|
puts e
|
||||||
puts
|
puts
|
||||||
puts "You can try again using:"
|
puts "You can try again using:"
|
||||||
puts " brew link #{f.name}"
|
puts " brew link #{formula.name}"
|
||||||
@show_summary_heading = true
|
@show_summary_heading = true
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
@ -564,9 +565,9 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def install_plist
|
def install_plist
|
||||||
return unless f.plist
|
return unless formula.plist
|
||||||
f.plist_path.atomic_write(f.plist)
|
formula.plist_path.atomic_write(formula.plist)
|
||||||
f.plist_path.chmod 0644
|
formula.plist_path.chmod 0644
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
onoe "Failed to install plist file"
|
onoe "Failed to install plist file"
|
||||||
ohai e, e.backtrace if debug?
|
ohai e, e.backtrace if debug?
|
||||||
@ -574,11 +575,11 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def fix_install_names(keg)
|
def fix_install_names(keg)
|
||||||
keg.fix_install_names(:keg_only => f.keg_only?)
|
keg.fix_install_names(:keg_only => formula.keg_only?)
|
||||||
|
|
||||||
if @poured_bottle
|
if @poured_bottle
|
||||||
keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, HOMEBREW_PREFIX.to_s,
|
keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, HOMEBREW_PREFIX.to_s,
|
||||||
Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s, :keg_only => f.keg_only?
|
Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s, :keg_only => formula.keg_only?
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
onoe "Failed to fix install names"
|
onoe "Failed to fix install names"
|
||||||
@ -591,7 +592,7 @@ class FormulaInstaller
|
|||||||
|
|
||||||
def clean
|
def clean
|
||||||
ohai "Cleaning" if verbose?
|
ohai "Cleaning" if verbose?
|
||||||
Cleaner.new(f).clean
|
Cleaner.new(formula).clean
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
opoo "The cleaning step did not complete successfully"
|
opoo "The cleaning step did not complete successfully"
|
||||||
puts "Still, the installation was successful, so we will link it into your prefix"
|
puts "Still, the installation was successful, so we will link it into your prefix"
|
||||||
@ -601,42 +602,42 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def post_install
|
def post_install
|
||||||
f.post_install
|
formula.post_install
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
opoo "The post-install step did not complete successfully"
|
opoo "The post-install step did not complete successfully"
|
||||||
puts "You can try again using `brew postinstall #{f.name}`"
|
puts "You can try again using `brew postinstall #{formula.name}`"
|
||||||
ohai e, e.backtrace if debug?
|
ohai e, e.backtrace if debug?
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
@show_summary_heading = true
|
@show_summary_heading = true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pour
|
def pour
|
||||||
if Homebrew::Hooks::Bottles.formula_has_bottle?(f)
|
if Homebrew::Hooks::Bottles.formula_has_bottle?(formula)
|
||||||
return if Homebrew::Hooks::Bottles.pour_formula_bottle(f)
|
return if Homebrew::Hooks::Bottles.pour_formula_bottle(formula)
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.local_bottle_path
|
if formula.local_bottle_path
|
||||||
downloader = LocalBottleDownloadStrategy.new(f)
|
downloader = LocalBottleDownloadStrategy.new(formula)
|
||||||
else
|
else
|
||||||
downloader = f.bottle
|
downloader = formula.bottle
|
||||||
downloader.verify_download_integrity(downloader.fetch)
|
downloader.verify_download_integrity(downloader.fetch)
|
||||||
end
|
end
|
||||||
HOMEBREW_CELLAR.cd do
|
HOMEBREW_CELLAR.cd do
|
||||||
downloader.stage
|
downloader.stage
|
||||||
end
|
end
|
||||||
|
|
||||||
Pathname.glob("#{f.bottle_prefix}/{etc,var}/**/*") do |path|
|
Pathname.glob("#{formula.bottle_prefix}/{etc,var}/**/*") do |path|
|
||||||
path.extend(InstallRenamed)
|
path.extend(InstallRenamed)
|
||||||
path.cp_path_sub(f.bottle_prefix, HOMEBREW_PREFIX)
|
path.cp_path_sub(formula.bottle_prefix, HOMEBREW_PREFIX)
|
||||||
end
|
end
|
||||||
FileUtils.rm_rf f.bottle_prefix
|
FileUtils.rm_rf formula.bottle_prefix
|
||||||
|
|
||||||
CxxStdlib.check_compatibility(
|
CxxStdlib.check_compatibility(
|
||||||
f, f.recursive_dependencies,
|
formula, formula.recursive_dependencies,
|
||||||
Keg.new(f.prefix), MacOS.default_compiler
|
Keg.new(formula.prefix), MacOS.default_compiler
|
||||||
)
|
)
|
||||||
|
|
||||||
tab = Tab.for_keg(f.prefix)
|
tab = Tab.for_keg(formula.prefix)
|
||||||
tab.poured_from_bottle = true
|
tab.poured_from_bottle = true
|
||||||
tab.write
|
tab.write
|
||||||
end
|
end
|
||||||
@ -649,8 +650,8 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def audit_installed
|
def audit_installed
|
||||||
audit_check_output(check_PATH(f.bin))
|
audit_check_output(check_PATH(formula.bin))
|
||||||
audit_check_output(check_PATH(f.sbin))
|
audit_check_output(check_PATH(formula.sbin))
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -662,10 +663,10 @@ class FormulaInstaller
|
|||||||
|
|
||||||
def lock
|
def lock
|
||||||
if (@@locked ||= []).empty?
|
if (@@locked ||= []).empty?
|
||||||
f.recursive_dependencies.each do |dep|
|
formula.recursive_dependencies.each do |dep|
|
||||||
@@locked << dep.to_formula
|
@@locked << dep.to_formula
|
||||||
end unless ignore_deps?
|
end unless ignore_deps?
|
||||||
@@locked.unshift(f)
|
@@locked.unshift(formula)
|
||||||
@@locked.uniq!
|
@@locked.uniq!
|
||||||
@@locked.each(&:lock)
|
@@locked.each(&:lock)
|
||||||
@hold_locks = true
|
@hold_locks = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user