Merge branch 'Homebrew:master' into mohammad
This commit is contained in:
commit
1abb51f2e8
@ -1,6 +1,8 @@
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cask/staged"
|
||||
|
||||
module Cask
|
||||
class DSL
|
||||
# Class corresponding to the `preflight` stanza.
|
||||
|
||||
@ -7,7 +7,6 @@ require "utils/topological_hash"
|
||||
|
||||
require "cask/config"
|
||||
require "cask/download"
|
||||
require "cask/staged"
|
||||
require "cask/quarantine"
|
||||
|
||||
require "cgi"
|
||||
@ -20,12 +19,6 @@ module Cask
|
||||
extend T::Sig
|
||||
|
||||
extend Predicable
|
||||
# TODO: it is unwise for Cask::Staged to be a module, when we are
|
||||
# dealing with both staged and unstaged casks here. This should
|
||||
# either be a class which is only sometimes instantiated, or there
|
||||
# should be explicit checks on whether staged state is valid in
|
||||
# every method.
|
||||
include Staged
|
||||
|
||||
def initialize(cask, command: SystemCommand, force: false,
|
||||
skip_cask_deps: false, binaries: true, verbose: false,
|
||||
|
||||
@ -368,6 +368,45 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
def pr_check_conflicts(name, tap_remote_repo, pr)
|
||||
hash_template = proc { |h, k| h[k] = [] }
|
||||
long_build_pr_files = GitHub.search_issues(
|
||||
"org:#{name}", repo: tap_remote_repo, state: "open", label: "\"no long build conflict\""
|
||||
).each_with_object(Hash.new(hash_template)) do |long_build_pr, hash|
|
||||
number = long_build_pr["number"]
|
||||
GitHub.get_pull_request_changed_files(name, tap_remote_repo, number).each do |file|
|
||||
key = file["filename"]
|
||||
hash[key] << number
|
||||
end
|
||||
end
|
||||
|
||||
this_pr_files = GitHub.get_pull_request_changed_files(name, tap_remote_repo, pr)
|
||||
|
||||
conflicts = this_pr_files.each_with_object(Hash.new(hash_template)) do |file, hash|
|
||||
filename = file["filename"]
|
||||
next unless long_build_pr_files.key?(filename)
|
||||
|
||||
long_build_pr_files[filename].each do |pr_number|
|
||||
key = "#{tap_remote_repo}/pull/#{pr_number}"
|
||||
hash[key] << filename
|
||||
end
|
||||
end
|
||||
return if conflicts.blank?
|
||||
|
||||
# Raise an error, display the conflicting PR. For example:
|
||||
# Error: You are trying to merge a pull request that conflicts with a long running build in:
|
||||
# {
|
||||
# "homebrew-core/pull/98809": [
|
||||
# "Formula/icu4c.rb",
|
||||
# "Formula/node@10.rb"
|
||||
# ]
|
||||
# }
|
||||
odie <<~EOS
|
||||
You are trying to merge a pull request that conflicts with a long running build in:
|
||||
#{JSON.pretty_generate(conflicts)}
|
||||
EOS
|
||||
end
|
||||
|
||||
def pr_pull
|
||||
args = pr_pull_args.parse
|
||||
|
||||
@ -397,6 +436,8 @@ module Homebrew
|
||||
opoo "Current branch is #{tap.path.git_branch}: do you need to pull inside #{tap.path.git_origin_branch}?"
|
||||
end
|
||||
|
||||
pr_check_conflicts(user, repo, pr)
|
||||
|
||||
ohai "Fetching #{tap} pull request ##{pr}"
|
||||
Dir.mktmpdir pr do |dir|
|
||||
cd dir do
|
||||
|
||||
@ -33,6 +33,18 @@ class Keg
|
||||
lib_path = "#{new_prefix}/lib"
|
||||
rpath << lib_path unless rpath.include? lib_path
|
||||
|
||||
# Add GCC's lib directory (as of GCC 12+) to RPATH when there is existing linkage.
|
||||
# This fixes linkage for newly-poured bottles.
|
||||
if !name.match?(Version.formula_optionally_versioned_regex(:gcc)) &&
|
||||
rpath.any? { |rp| rp.match?(%r{lib/gcc/\d+$}) }
|
||||
# TODO: Replace with
|
||||
# rpath.map! { |path| path = path.sub(%r{lib/gcc/\d+$}, "lib/gcc/current") }
|
||||
# when
|
||||
# 1. Homebrew/homebrew-core#106755 is merged
|
||||
# 2. No formula has a runtime dependency on a versioned GCC (see `envoy.rb`)
|
||||
rpath.prepend HOMEBREW_PREFIX/"opt/gcc/lib/gcc/current"
|
||||
end
|
||||
|
||||
rpath.join(":")
|
||||
end
|
||||
updated[:rpath] = new_rpath if old_rpath != new_rpath
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
OFFICIAL_CASK_TAPS = %w[
|
||||
cask
|
||||
versions
|
||||
cask-versions
|
||||
].freeze
|
||||
|
||||
OFFICIAL_CMD_TAPS = {
|
||||
|
||||
@ -479,8 +479,9 @@ module GitHub
|
||||
|
||||
def check_for_duplicate_pull_requests(name, tap_remote_repo, state:, file:, args:, version: nil)
|
||||
pull_requests = fetch_pull_requests(name, tap_remote_repo, state: state, version: version).select do |pr|
|
||||
pr_files = API.open_rest(url_to("repos", tap_remote_repo, "pulls", pr["number"], "files"))
|
||||
pr_files.any? { |f| f["filename"] == file }
|
||||
get_pull_request_changed_files(
|
||||
name, tap_remote_repo, pr["number"]
|
||||
).any? { |f| f["filename"] == file }
|
||||
end
|
||||
return if pull_requests.blank?
|
||||
|
||||
@ -501,6 +502,10 @@ module GitHub
|
||||
end
|
||||
end
|
||||
|
||||
def get_pull_request_changed_files(name, tap_remote_repo, pr)
|
||||
API.open_rest(url_to("repos", name, tap_remote_repo, "pulls", pr, "files"))
|
||||
end
|
||||
|
||||
def forked_repo_info!(tap_remote_repo, org: nil)
|
||||
response = create_fork(tap_remote_repo, org: org)
|
||||
# GitHub API responds immediately but fork takes a few seconds to be ready.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user