Module: OS::Mac::Reinstall::ClassMethods Private

Extended by:
T::Helpers
Includes:
Utils::Output::Mixin
Defined in:
extend/os/mac/reinstall.rb

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.

Instance Method Summary collapse

Methods included from Utils::Output::Mixin

#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled

Instance Method Details

#reinstall_pkgconf_if_needed!(dry_run: false) ⇒ 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.

Parameters:

  • dry_run (Boolean) (defaults to: false)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'extend/os/mac/reinstall.rb', line 17

def reinstall_pkgconf_if_needed!(dry_run: false)
  mismatch = Homebrew::Pkgconf.macos_sdk_mismatch
  return unless mismatch

  if dry_run
    opoo "pkgconf would be reinstalled due to macOS version mismatch"
    return
  end

  pkgconf = ::Formula["pkgconf"]

  context = T.unsafe(self).build_install_context(pkgconf, flags: [])

  begin
    Homebrew::Install.fetch_formulae([context.formula_installer])
    T.unsafe(self).reinstall_formula(context)
    ohai "Reinstalled pkgconf due to macOS version mismatch"
  rescue
    ofail Homebrew::Pkgconf.mismatch_warning_message(mismatch)
  end
end