Class: Homebrew::TestBot::FormulaeDependents Private
- Inherits:
-
TestFormulae
- Object
- Test
- TestFormulae
- Homebrew::TestBot::FormulaeDependents
- 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.
Instance Attribute Summary collapse
- #tested_formulae ⇒ Array<String> writeonly private
- #testing_formulae ⇒ Array<String> writeonly private
Attributes inherited from TestFormulae
#artifact_cache, #skipped_or_failed_formulae
Attributes inherited from Test
Instance Method Summary collapse
- #initialize(tap:, git:, dry_run:, fail_fast:, verbose:) ⇒ void constructor private
- #run!(args:) ⇒ void private
Methods included from OS::Linux::TestBot::TestFormulae
#previous_run_artifact_specifier
Methods included from OS::Mac::TestBot::TestFormulae
#previous_run_artifact_specifier
Methods inherited from Test
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, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_outdated, #pretty_uninstalled, #pretty_upgradable
Constructor Details
#initialize(tap:, git:, dry_run:, fail_fast:, verbose:) ⇒ 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.
25 26 27 28 29 30 31 32 33 |
# File 'test_bot/formulae_dependents.rb', line 25 def initialize(tap:, git:, dry_run:, fail_fast:, verbose:) super @testing_formulae_with_tested_dependents = T.let([], T::Array[String]) @tested_dependents_list = T.let(nil, T.nilable(Pathname)) @dependent_testing_formulae = T.let([], T::Array[String]) @tested_dependents = T.let([], T::Array[String]) @formulae_dependents_filter = T.let(nil, T.nilable(T::Array[String])) @dependent_pairs_by_formula = T.let({}, T::Hash[String, T::Array[DependentWithDependencies]]) end |
Instance Attribute Details
#tested_formulae=(value) ⇒ Array<String> (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.
14 15 16 |
# File 'test_bot/formulae_dependents.rb', line 14 def tested_formulae=(value) @tested_formulae = value end |
#testing_formulae=(value) ⇒ Array<String> (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.
11 12 13 |
# File 'test_bot/formulae_dependents.rb', line 11 def testing_formulae=(value) @testing_formulae = value end |
Instance Method Details
#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.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'test_bot/formulae_dependents.rb', line 36 def run!(args:) if args.formulae_dependents_shard.present? && !args.only_formulae_dependents? raise UsageError, "`--formulae-dependents-shard` requires `--only-formulae-dependents`." end 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:) download_artifacts_from_previous_run!("dependents{,_#{previous_run_artifact_specifier}*}", dry_run: args.dry_run?) @skip_candidates = T.let( if (tested_dependents_cache = artifact_cache/@tested_dependents_list).exist? tested_dependents_cache.read.split("\n") else [] end, T.nilable(T::Array[String]), ) if args.formulae_dependents_shard.present? dependent_pairs = @dependent_testing_formulae.flat_map do |formula_name| dependent_pairs_for_formula(Formulary.factory(formula_name), formula_name, args:) end dependent_pairs.uniq! { |dependent, _| dependent.full_name } @formulae_dependents_filter = dependents_for_shard(dependent_pairs, args.formulae_dependents_shard.to_s) .map { |dependent, _| dependent.full_name } end @dependent_testing_formulae.each do |formula_name| dependent_formulae!(formula_name, args:) puts end return unless GitHub::Actions.env_set? # 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 |