Merge pull request #15574 from carlocab/dependencies-conflict-audit

formula_auditor: adjust deps audit for a staging branch
This commit is contained in:
Mike McQuaid 2023-06-20 16:17:26 +01:00 committed by GitHub
commit 366fd85d4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -116,7 +116,8 @@ module Homebrew
new_formula = args.new_formula? new_formula = args.new_formula?
strict = new_formula || args.strict? strict = new_formula || args.strict?
online = new_formula || args.online? online = new_formula || args.online?
skip_style = args.skip_style? || args.no_named? || args.tap tap_audit = args.tap.present?
skip_style = args.skip_style? || args.no_named? || tap_audit
no_named_args = T.let(false, T::Boolean) no_named_args = T.let(false, T::Boolean)
ENV.activate_extensions! ENV.activate_extensions!
@ -202,6 +203,7 @@ module Homebrew
spdx_license_data: spdx_license_data, spdx_license_data: spdx_license_data,
spdx_exception_data: spdx_exception_data, spdx_exception_data: spdx_exception_data,
style_offenses: style_offenses&.for_path(f.path), style_offenses: style_offenses&.for_path(f.path),
tap_audit: tap_audit,
}.compact }.compact
errors = os_arch_combinations.flat_map do |os, arch| errors = os_arch_combinations.flat_map do |os, arch|

View File

@ -35,6 +35,7 @@ module Homebrew
@specs = %w[stable head].map { |s| formula.send(s) }.compact @specs = %w[stable head].map { |s| formula.send(s) }.compact
@spdx_license_data = options[:spdx_license_data] @spdx_license_data = options[:spdx_license_data]
@spdx_exception_data = options[:spdx_exception_data] @spdx_exception_data = options[:spdx_exception_data]
@tap_audit = options[:tap_audit]
end end
def audit_style def audit_style
@ -345,17 +346,17 @@ module Homebrew
# TODO: remove this and check these there too. # TODO: remove this and check these there too.
return if Homebrew::SimulateSystem.simulating_or_running_on_linux? return if Homebrew::SimulateSystem.simulating_or_running_on_linux?
# Skip the versioned dependencies conflict audit on the OpenSSL migration branch. # Skip the versioned dependencies conflict audit for OpenSSL on the OpenSSL migration staging branch.
# TODO: Remove this when OpenSSL migration is complete. # TODO: Remove this when OpenSSL migration is complete.
ignore_openssl_conflict = if (github_event_path = ENV.fetch("GITHUB_EVENT_PATH", nil)).present? ignore_openssl_conflict = if @tap_audit && (github_event_path = ENV.fetch("GITHUB_EVENT_PATH", nil)).present?
event_payload = JSON.parse(File.read(github_event_path)) event_payload = JSON.parse(File.read(github_event_path))
head_info = event_payload.dig("pull_request", "head").to_h # handle `nil` base_info = event_payload.dig("pull_request", "base").to_h # handle `nil`
# We need to read the head ref from `GITHUB_EVENT_PATH` because # We need to read the head ref from `GITHUB_EVENT_PATH` because
# `git branch --show-current` returns `master` on PR branches. # `git branch --show-current` returns `master` on PR branches.
openssl_migration_branch = head_info["ref"] == "openssl-migration" openssl_migration_branch = base_info["ref"] == "openssl-migration-staging"
homebrew_owned_repo = head_info.dig("repo", "owner", "login") == "Homebrew" homebrew_owned_repo = base_info.dig("repo", "owner", "login") == "Homebrew"
homebrew_core_pr = head_info.dig("repo", "name") == "homebrew-core" homebrew_core_pr = base_info.dig("repo", "name") == "homebrew-core"
openssl_migration_branch && homebrew_owned_repo && homebrew_core_pr openssl_migration_branch && homebrew_owned_repo && homebrew_core_pr
end end