Module: Homebrew::Diagnostic Private
- Extended by:
- Utils::Output::Mixin
- Defined in:
- diagnostic.rb,
diagnostic/finding.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Module containing diagnostic checks.
Defined Under Namespace
Class Method Summary collapse
- .checks(type, fatal: true) ⇒ Array<Integer, Symbol> private
- .formula_build_finding(formula, build_options: []) ⇒ Finding? private
- .report_support_tier ⇒ void private
-
.support_tier(formula: nil, build_options: []) ⇒ Integer, Symbol
private
Include host checks for commands that have not run preinstall diagnostics.
- .support_tiers ⇒ Array<Integer, Symbol> private
Methods included from Utils::Output::Mixin
issue_reporting_message, odebug, odeprecated, odie, odisabled, ofail, oh1, oh1_title, ohai, ohai_title, onoe, opoo, opoo_once, opoo_outside_github_actions, opoo_without_github_actions_annotation, pretty_cannot_install, pretty_deprecated, pretty_disabled, pretty_duration, pretty_incompatible, pretty_install_status, pretty_installed, pretty_removed, pretty_uninstalled, pretty_unmarked, pretty_upgradable, pretty_warning
Class Method Details
.checks(type, fatal: true) ⇒ Array<Integer, Symbol>
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'diagnostic.rb', line 78 def self.checks(type, fatal: true) checks = Checks.new tiers = [] checks.public_send(type).each do |check| Array(checks.public_send(check)).each do |finding| tiers << finding.tier if fatal ofail finding.to_s else opoo finding.to_s # Commands that continue after a failed build print their own blank line. $stderr.puts if type != :build_error_checks && finding.to_s.include?("\n") end end end support_tiers.concat(tiers) exit 1 if fatal && tiers.any? tiers end |
.formula_build_finding(formula, build_options: []) ⇒ Finding?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'diagnostic.rb', line 36 def self.formula_build_finding(formula, build_options: []) reason = if formula.head? || .include?("--HEAD") "was built from an unstable upstream --HEAD" elsif formula.disabled? "is disabled" elsif formula.deprecated? "is deprecated" elsif (.intersect?(%w[--build-bottle --build-from-source]) && .exclude?("HOMEBREW_DEVELOPER=1")) || .any? { |flag| flag.start_with?("--cc=") } "was built from source with non-default build options" end Finding.new("#{formula.name}'s formula #{reason}.", tier: 3) if reason end |
.report_support_tier ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
69 70 71 72 73 |
# File 'diagnostic.rb', line 69 def self.report_support_tier = Finding.(tier: Finding.support_tier(support_tiers)) support_tiers.clear $stderr.puts "\n", if end |
.support_tier(formula: nil, build_options: []) ⇒ Integer, Symbol
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Include host checks for commands that have not run preinstall diagnostics.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'diagnostic.rb', line 53 def self.support_tier(formula: nil, build_options: []) checks = Checks.new configuration_checks = formula ? checks.build_error_checks : checks.supported_configuration_checks tiers = configuration_checks.flat_map do |check| Array(checks.public_send(check)).map(&:tier) end if formula finding = formula_build_finding(formula, build_options:) tiers << finding.tier if finding else tiers.concat(support_tiers) end Finding.support_tier(tiers) end |
.support_tiers ⇒ Array<Integer, Symbol>
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
31 32 33 |
# File 'diagnostic.rb', line 31 def self.support_tiers @support_tiers ||= T.let([], T.nilable(T::Array[T.any(Integer, Symbol)])) end |