Exception: BuildError

Inherits:
RuntimeError
  • Object
show all
Defined in:
Library/Homebrew/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(formula, cmd, args, env) ⇒ BuildError

Returns a new instance of BuildError



326
327
328
329
330
331
# File 'Library/Homebrew/exceptions.rb', line 326

def initialize(formula, cmd, args, env)
  @formula = formula
  @env = env
  args = args.map { |arg| arg.to_s.gsub " ", "\\ " }.join(" ")
  super "Failed executing: #{cmd} #{args}"
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env



324
325
326
# File 'Library/Homebrew/exceptions.rb', line 324

def env
  @env
end

#formulaObject (readonly)

Returns the value of attribute formula



324
325
326
# File 'Library/Homebrew/exceptions.rb', line 324

def formula
  @formula
end

Instance Method Details

#dumpObject



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'Library/Homebrew/exceptions.rb', line 344

def dump
  puts

  if ARGV.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"
    Homebrew.dump_build_env(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 && formula.tap.name == "homebrew/boneyard"
    onoe <<-EOS.undent
      #{formula} was moved to homebrew-boneyard because it has unfixable issues.
      Please do not file any issues about this. Sorry!
    EOS
    return
  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.undent
        If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
        #{Formatter.url(issues_url)}
      EOS
    else
      puts <<-EOS.undent
        If reporting this issue please do so to (not Homebrew/brew or Homebrew/core):
        #{formula.tap}
      EOS
    end
  else
    puts <<-EOS.undent
      Do not report this issue to Homebrew/brew or Homebrew/core!
    EOS
  end

  puts

  if issues && !issues.empty?
    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_issuesObject



337
338
339
340
341
342
# File 'Library/Homebrew/exceptions.rb', line 337

def fetch_issues
  GitHub.issues_for_formula(formula.name, tap: formula.tap)
rescue GitHub::RateLimitExceededError => e
  opoo e.message
  []
end

#issuesObject



333
334
335
# File 'Library/Homebrew/exceptions.rb', line 333

def issues
  @issues ||= fetch_issues
end