Class: Homebrew::TestBot::CleanupBefore Private

Inherits:
TestCleanup show all
Includes:
OS::Linux::TestBot::CleanupBefore, OS::Mac::TestBot::CleanupBefore
Defined in:
test_bot/cleanup_before.rb

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Instance Attribute Summary

Attributes inherited from Test

#steps

Instance Method Summary collapse

Methods inherited from Test

#failed_steps, #ignored_steps

Methods included from Utils::Output::Mixin

#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_outdated, #pretty_uninstalled, #pretty_upgradable

Instance Method Details

#cleanup_github_actions_hosted_runnervoid

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.



32
# File 'test_bot/cleanup_before.rb', line 32

def cleanup_github_actions_hosted_runner; end

#run!(args:) ⇒ 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:



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'test_bot/cleanup_before.rb', line 10

def run!(args:)
  test_header(:CleanupBefore)

  if tap.to_s != CoreTap.instance.name && CoreTap.instance.installed?
    reset_if_needed(CoreTap.instance.path.to_s)
  end

  Pathname.glob("*.bottle*.*").each(&:unlink)

  if ENV["HOMEBREW_GITHUB_ACTIONS"] && !ENV["GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED"]
    # minimally fix brew doctor failures (a full clean takes ~5m)
    cleanup_github_actions_hosted_runner
    untap_untrusted_taps
    test "brew", "cleanup", "--prune-prefix"
  end

  # Keep all "brew" invocations after cleanup_shared
  # (which cleans up Homebrew/brew)
  cleanup_shared
end

#untap_untrusted_tapsvoid

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.



35
36
37
38
39
40
# File 'test_bot/cleanup_before.rb', line 35

def untap_untrusted_taps
  taps_to_untap = Homebrew::Trust.untrusted_taps.reject { |untrusted_tap| untrusted_tap.name == tap&.name }
  return if taps_to_untap.empty?

  test "brew", "untap", *taps_to_untap.map(&:name)
end