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