aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2017-06-09 14:53:01 +0300
committerMike McQuaid2017-06-09 14:53:01 +0300
commit99c897acadc002d5e3b741f406ca372956c345ea (patch)
treed127b5f9c580b12eb0043e39742a08ffbb9f1b38 /Library/Homebrew
parent1ef00aaf6f9945170f6db5a67d9c0e9b359e906a (diff)
downloadbrew-99c897acadc002d5e3b741f406ca372956c345ea.tar.bz2
BuildError: report options to analytics.
Without this it's not easy to make much sense of these failures.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/exceptions.rb1
-rw-r--r--Library/Homebrew/formula_installer.rb27
-rw-r--r--Library/Homebrew/utils/analytics.rb6
3 files changed, 24 insertions, 10 deletions
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index 488ef7064..a5388c2f4 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -352,6 +352,7 @@ end
class BuildError < RuntimeError
attr_reader :formula, :env
+ attr_accessor :options
def initialize(formula, cmd, args, env)
@formula = formula
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 3f85b2c17..2a5120342 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -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
diff --git a/Library/Homebrew/utils/analytics.rb b/Library/Homebrew/utils/analytics.rb
index 8c69a2980..23000f8dd 100644
--- a/Library/Homebrew/utils/analytics.rb
+++ b/Library/Homebrew/utils/analytics.rb
@@ -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