Exception: BuildError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- BuildError
- Defined in:
- exceptions.rb
Overview
Raised when an error occurs during a formula build.
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#cmd ⇒ Object
readonly
Returns the value of attribute cmd.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#formula ⇒ Object
Returns the value of attribute formula.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#dump(verbose: false) ⇒ Object
-
#fetch_issues ⇒ Object
-
#initialize(formula, cmd, args, env) ⇒ BuildError
constructor
A new instance of BuildError.
-
#issues ⇒ Object
Constructor Details
#initialize(formula, cmd, args, env) ⇒ BuildError
Returns a new instance of BuildError.
477 478 479 480 481 482 483 484 |
# File 'exceptions.rb', line 477 def initialize(formula, cmd, args, env) @formula = formula @cmd = cmd @args = args @env = env pretty_args = Array(args).map { |arg| arg.to_s.gsub(/[\\ ]/, "\\\\\\0") }.join(" ") super "Failed executing: #{cmd} #{pretty_args}".strip end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
474 475 476 |
# File 'exceptions.rb', line 474 def args @args end |
#cmd ⇒ Object (readonly)
Returns the value of attribute cmd.
474 475 476 |
# File 'exceptions.rb', line 474 def cmd @cmd end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
474 475 476 |
# File 'exceptions.rb', line 474 def env @env end |
#formula ⇒ Object
Returns the value of attribute formula.
475 476 477 |
# File 'exceptions.rb', line 475 def formula @formula end |
#options ⇒ Object
Returns the value of attribute options.
475 476 477 |
# File 'exceptions.rb', line 475 def @options end |
Instance Method Details
#dump(verbose: false) ⇒ Object
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 |
# File 'exceptions.rb', line 497 def dump(verbose: false) puts if verbose require "system_config" require "build_environment" ohai "Formula" puts "Tap: #{formula.tap}" if formula.tap? puts "Path: #{formula.path}" ohai "Configuration" SystemConfig.dump_verbose_config ohai "ENV" BuildEnvironment.dump env puts onoe "#{formula.full_name} #{formula.version} did not build" unless (logs = Dir["#{formula.logs}/*"]).empty? puts "Logs:" puts logs.map { |fn| " #{fn}" }.join("\n") end end if formula.tap && defined?(OS::ISSUES_URL) if formula.tap.official? puts Formatter.error(Formatter.url(OS::ISSUES_URL), label: "READ THIS") elsif (issues_url = formula.tap.issues_url) puts <<~EOS If reporting this issue please do so at (not Homebrew/brew or Homebrew/core): #{Formatter.url(issues_url)} EOS else puts <<~EOS If reporting this issue please do so to (not Homebrew/brew or Homebrew/core): #{formula.tap} EOS end else puts <<~EOS Do not report this issue to Homebrew/brew or Homebrew/core! EOS end puts if issues.present? puts "These open issues may also help:" puts issues.map { |i| "#{i["title"]} #{i["html_url"]}" }.join("\n") end require "diagnostic" checks = Homebrew::Diagnostic::Checks.new checks.build_error_checks.each do |check| out = checks.send(check) next if out.nil? puts ofail out end end |
#fetch_issues ⇒ Object
490 491 492 493 494 495 |
# File 'exceptions.rb', line 490 def fetch_issues GitHub.issues_for_formula(formula.name, tap: formula.tap, state: "open") rescue GitHub::API::RateLimitExceededError => e opoo e. [] end |
#issues ⇒ Object
486 487 488 |
# File 'exceptions.rb', line 486 def issues @issues ||= fetch_issues end |