BuildError: report options to analytics.
Without this it's not easy to make much sense of these failures.
This commit is contained in:
parent
1ef00aaf6f
commit
99c897acad
@ -352,6 +352,7 @@ end
|
||||
|
||||
class BuildError < RuntimeError
|
||||
attr_reader :formula, :env
|
||||
attr_accessor :options
|
||||
|
||||
def initialize(formula, cmd, args, env)
|
||||
@formula = formula
|
||||
|
||||
@ -261,17 +261,13 @@ class FormulaInstaller
|
||||
opoo "#{formula.full_name}: this formula has no #{option} option so it will be ignored!"
|
||||
end
|
||||
|
||||
options = []
|
||||
if formula.head?
|
||||
options << "--HEAD"
|
||||
elsif formula.devel?
|
||||
options << "--devel"
|
||||
options = display_options(formula)
|
||||
if show_header?
|
||||
oh1 "Installing #{Formatter.identifier(formula.full_name)} #{options}".strip
|
||||
end
|
||||
options += effective_build_options_for(formula).used_options.to_a
|
||||
oh1 "Installing #{Formatter.identifier(formula.full_name)} #{options.join " "}" if show_header?
|
||||
|
||||
if formula.tap && !formula.tap.private?
|
||||
action = ([formula.full_name] + options).join(" ")
|
||||
action = "#{formula.full_name} #{options}".strip
|
||||
Utils::Analytics.report_event("install", action)
|
||||
|
||||
if installed_on_request
|
||||
@ -475,6 +471,18 @@ class FormulaInstaller
|
||||
BuildOptions.new(args, dependent.options)
|
||||
end
|
||||
|
||||
def display_options(formula)
|
||||
options = []
|
||||
if formula.head?
|
||||
options << "--HEAD"
|
||||
elsif formula.devel?
|
||||
options << "--devel"
|
||||
end
|
||||
options += effective_build_options_for(formula).used_options.to_a
|
||||
return if options.empty?
|
||||
options.join(" ")
|
||||
end
|
||||
|
||||
def inherited_options_for(dep)
|
||||
inherited_options = Options.new
|
||||
u = Option.new("universal")
|
||||
@ -677,7 +685,8 @@ class FormulaInstaller
|
||||
if !formula.prefix.directory? || Keg.new(formula.prefix).empty_installation?
|
||||
raise "Empty installation"
|
||||
end
|
||||
rescue Exception
|
||||
rescue Exception => e
|
||||
e.options = display_options(formula) if e.is_a?(BuildError)
|
||||
ignore_interrupts do
|
||||
# any exceptions must leave us with nothing installed
|
||||
formula.update_head_version
|
||||
|
||||
@ -65,7 +65,11 @@ module Utils
|
||||
return unless exception.formula.tap
|
||||
return unless exception.formula.tap.installed?
|
||||
return if exception.formula.tap.private?
|
||||
report_event("BuildError", exception.formula.full_name)
|
||||
action = exception.formula.full_name
|
||||
if (options = exception.options)
|
||||
action = "#{action} #{options}".strip
|
||||
end
|
||||
report_event("BuildError", action)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user