Skip to content

Commit

Permalink
formula_auditor: skip dependency conflict audit for OpenSSL migration
Browse files Browse the repository at this point in the history
We can't migrate the entire OpenSSL dependency tree in one go, so we'll
have to skip this audit in the interim.

See Homebrew/homebrew-core#133144.
  • Loading branch information
carlocab committed Jun 9, 2023
1 parent 8421b70 commit 8ff91a1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Library/Homebrew/formula_auditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,28 @@ def audit_deps
# TODO: remove this and check these there too.
return if Homebrew::SimulateSystem.simulating_or_running_on_linux?

# Skip the versioned dependencies conflict audit on the OpenSSL migration branch.
# TODO: Remove this when OpenSSL migration is complete.
ignore_openssl_conflict = if (github_event_path = ENV.fetch("GITHUB_EVENT_PATH", nil)).present?
event_payload = JSON.parse(File.read(github_event_path))
head_info = event_payload.dig("pull_request", "head")

# We need to read the head ref from `GITHUB_EVENT_PATH` because
# `git branch --show-current` returns `master` on PR branches.
openssl_migration_branch = head_info["ref"] == "openssl-migration"
homebrew_owned_repo = head_info.dig("repo", "owner", "login") == "Homebrew"
homebrew_core_pr = head_info.dig("repo", "name") == "homebrew-core"

openssl_migration_branch && homebrew_owned_repo && homebrew_core_pr
end

recursive_runtime_formulae = formula.runtime_formula_dependencies(undeclared: false)
version_hash = {}
version_conflicts = Set.new
recursive_runtime_formulae.each do |f|
name = f.name
unversioned_name, = name.split("@")
next if unversioned_name == "openssl" && ignore_openssl_conflict
# Allow use of the full versioned name (e.g. `[email protected]`) or an unversioned alias (`python`).
next if formula.tap&.audit_exception :versioned_formula_dependent_conflicts_allowlist, name
next if formula.tap&.audit_exception :versioned_formula_dependent_conflicts_allowlist, unversioned_name
Expand Down

0 comments on commit 8ff91a1

Please sign in to comment.