Pass FormulaInstaller#display_options to BuildError.

This should improve the output in analytics.
This commit is contained in:
Mike McQuaid 2020-05-18 12:46:23 +01:00
parent 95a8217223
commit b9f493a7f6
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
2 changed files with 10 additions and 11 deletions

View File

@ -279,7 +279,7 @@ class FormulaInstaller
opoo "#{formula.full_name}: #{old_flag} was deprecated; using #{new_flag} instead!" opoo "#{formula.full_name}: #{old_flag} was deprecated; using #{new_flag} instead!"
end end
options = display_options(formula) options = display_options(formula).join(" ")
oh1 "Installing #{Formatter.identifier(formula.full_name)} #{options}".strip if show_header? oh1 "Installing #{Formatter.identifier(formula.full_name)} #{options}".strip if show_header?
unless formula.tap&.private? unless formula.tap&.private?
@ -529,16 +529,15 @@ class FormulaInstaller
end end
def display_options(formula) def display_options(formula)
options = [] options = if formula.head?
if formula.head? ["--HEAD"]
options << "--HEAD"
elsif formula.devel? elsif formula.devel?
options << "--devel" ["--devel"]
else
[]
end end
options += effective_build_options_for(formula).used_options.to_a options += effective_build_options_for(formula).used_options.to_a
return if options.empty? options
options.join(" ")
end end
def inherited_options_for(dep) def inherited_options_for(dep)
@ -793,7 +792,7 @@ class FormulaInstaller
rescue Exception => e # rubocop:disable Lint/RescueException rescue Exception => e # rubocop:disable Lint/RescueException
if e.is_a? BuildError if e.is_a? BuildError
e.formula = formula e.formula = formula
e.options = options e.options = display_options(formula)
end end
ignore_interrupts do ignore_interrupts do

View File

@ -67,8 +67,8 @@ module Utils
return if exception.formula.tap.private? return if exception.formula.tap.private?
action = exception.formula.full_name action = exception.formula.full_name
if (options = exception.options.to_a.presence) if (options = exception.options.to_a.map(&:to_s).join(" ").presence)
action = "#{action} #{options.map(&:to_s).join(" ")}".strip action = "#{action} #{options}".strip
end end
report_event("BuildError", action) report_event("BuildError", action)
end end