Class: Homebrew::TestBot::FormulaeDependents Private

Inherits:
TestFormulae show all
Defined in:
test_bot/formulae_dependents.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.

Constant Summary

Constants included from Kernel

Kernel::IGNORE_INTERRUPTS_MUTEX

Instance Attribute Summary collapse

Attributes inherited from TestFormulae

#artifact_cache, #skipped_or_failed_formulae

Attributes inherited from Test

#steps

Instance Method Summary collapse

Methods inherited from TestFormulae

#initialize

Methods included from Kernel

#disk_usage_readable, #ensure_executable!, #exec_browser, #exec_editor, #ignore_interrupts, #interactive_shell, #number_readable, #quiet_system, #redact_secrets, #redirect_stdout, #safe_system, #tap_and_name_comparison, #truncate_text_to_approximate_size, #which, #which_editor, #with_custom_locale, #with_env, #with_homebrew_path

Methods inherited from Test

#failed_steps, #ignored_steps

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

Constructor Details

This class inherits a constructor from Homebrew::TestBot::TestFormulae

Instance Attribute Details

#tested_formulae=(value) ⇒ Object (writeonly)

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.



7
8
9
# File 'test_bot/formulae_dependents.rb', line 7

def tested_formulae=(value)
  @tested_formulae = value
end

#testing_formulae=(value) ⇒ Object (writeonly)

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.



7
8
9
# File 'test_bot/formulae_dependents.rb', line 7

def testing_formulae=(value)
  @testing_formulae = value
end

Instance Method Details

#run!(args:) ⇒ Object

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.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'test_bot/formulae_dependents.rb', line 9

def run!(args:)
  test "brew", "untap", "--force", "homebrew/cask" if !tap&.core_cask_tap? && CoreCaskTap.instance.installed?

  installable_bottles = @tested_formulae - @skipped_or_failed_formulae
  unneeded_formulae = @tested_formulae - @testing_formulae
  @skipped_or_failed_formulae += unneeded_formulae

  info_header "Skipped or failed formulae:"
  puts skipped_or_failed_formulae

  @testing_formulae_with_tested_dependents = []
  @tested_dependents_list = Pathname("tested-dependents-#{Utils::Bottles.tag}.txt")

  @dependent_testing_formulae = sorted_formulae - skipped_or_failed_formulae

  install_formulae_if_needed_from_bottles!(installable_bottles, args:)

  # TODO: move to extend/os
  # rubocop:todo Homebrew/MoveToExtendOS
  artifact_specifier = if OS.linux?
    "{linux,ubuntu}"
  else
    "{macos-#{MacOS.version},#{MacOS.version}-#{Hardware::CPU.arch}}"
  end
  # rubocop:enable Homebrew/MoveToExtendOS

  download_artifacts_from_previous_run!("dependents{,_#{artifact_specifier}*}", dry_run: args.dry_run?)
  @skip_candidates = if (tested_dependents_cache = artifact_cache/@tested_dependents_list).exist?
    tested_dependents_cache.read.split("\n")
  else
    []
  end

  @dependent_testing_formulae.each do |formula_name|
    dependent_formulae!(formula_name, args:)
    puts
  end

  return unless ENV["GITHUB_ACTIONS"]

  # Remove `bash` after it is tested, since leaving a broken `bash`
  # installation in the environment can cause issues with subsequent
  # GitHub Actions steps.
  return unless @dependent_testing_formulae.include?("bash")

  test "brew", "uninstall", "--formula", "--force", "bash"
end