Merge branch 'master' into codecov-action

This commit is contained in:
Tom Hu 2021-02-10 18:47:57 -05:00 committed by GitHub
commit 9dff3236a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
288 changed files with 757 additions and 202 deletions

View File

@ -8,20 +8,22 @@ on:
- Library/Homebrew/extend/os/diagnostic.rb
- Library/Homebrew/extend/os/mac/diagnostic.rb
- Library/Homebrew/os/mac/xcode.rb
branches-ignore:
- master
env:
HOMEBREW_DEVELOPER: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
jobs:
tests:
strategy:
matrix:
version: [10.15, 10.14, 10.13]
version: ['11-arm', '11.0', '10.15', '10.14']
fail-fast: false
runs-on: ${{ matrix.version }}
env:
PATH: "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
PATH: "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
defaults:
run:
working-directory: /tmp
steps:
- name: Set up Homebrew
id: set-up-homebrew

View File

@ -40,11 +40,6 @@ jobs:
brew install vale
vale docs/
- name: Lint Dockerfile
run: |
brew install hadolint
hadolint Dockerfile
tap-syntax:
name: tap syntax (Linux)
if: startsWith(github.repository, 'Homebrew/')

View File

@ -41,17 +41,25 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
- name: Vendor Gems
env:
GEM_NAME: ${{ steps.checkout.outputs.gem_name }}
run: |
if [[ '${{ steps.checkout.outputs.gem_name }}' == 'sorbet' ]]; then
set -u
if [[ "${GEM_NAME}" == 'sorbet' ]]; then
brew vendor-gems --update sorbet,sorbet-runtime
else
brew vendor-gems
fi
- name: Update RBI files
env:
GEM_NAME: ${{ steps.checkout.outputs.gem_name }}
run: |
set -u
if brew typecheck --update --fail-if-not-changed; then
if git add Library/Homebrew/sorbet; then
git commit -m "Update RBI files for ${{ steps.checkout.outputs.gem_name }}."
git commit -m "Update RBI files for ${GEM_NAME}."
fi
git reset --hard

View File

@ -36,8 +36,9 @@ Metrics/PerceivedComplexity:
Max: 90
Metrics/MethodLength:
Max: 260
# TODO: Reduce to 600 after refactoring utils/github
Metrics/ModuleLength:
Max: 600
Max: 620
Exclude:
- "test/**/*"

View File

@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.1.1)
activesupport (6.1.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
@ -9,7 +9,7 @@ GEM
zeitwerk (~> 2.3)
ast (2.4.2)
bindata (2.4.8)
bootsnap (1.7.0)
bootsnap (1.7.2)
msgpack (~> 1.0)
byebug (11.1.3)
coderay (1.1.3)
@ -28,7 +28,7 @@ GEM
hpricot (0.8.6)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.8.7)
i18n (1.8.8)
concurrent-ruby (~> 1.0)
mechanize (2.7.7)
domain_name (~> 0.5, >= 0.5.1)
@ -137,11 +137,11 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.2)
sorbet (0.5.6262)
sorbet-static (= 0.5.6262)
sorbet-runtime (0.5.6262)
sorbet (0.5.6274)
sorbet-static (= 0.5.6274)
sorbet-runtime (0.5.6267)
sorbet-runtime-stub (0.2.0)
sorbet-static (0.5.6262-universal-darwin-14)
sorbet-static (0.5.6274-universal-darwin-14)
spoom (1.0.7)
colorize
sorbet (~> 0.5.5)

View File

@ -169,6 +169,8 @@ module Cask
def to_h
{
"token" => token,
"full_token" => full_name,
"tap" => tap&.name,
"name" => name,
"desc" => desc,
"homepage" => homepage,

View File

@ -88,6 +88,8 @@ module Homebrew
share/pypy3/*
share/info/dir
share/man/whatis
share/mime/*
texlive/*
].freeze
def list_unbrewed

View File

@ -14,6 +14,8 @@ module Homebrew
description <<~EOS
Remove a tapped formula repository.
EOS
switch "-f", "--force",
description: "Untap even if formulae or casks from this tap are currently installed."
named_args :tap, min: 1
end

View File

@ -17,7 +17,7 @@ module Homebrew
def update_preinstall_header(args:)
@update_preinstall_header ||= begin
ohai "Auto-updated Homebrew!" if args.preinstall?
ohai_stdout_or_stderr "Auto-updated Homebrew!" if args.preinstall?
true
end
end
@ -50,8 +50,8 @@ module Homebrew
print "\a"
# Use an extra newline and bold to avoid this being missed.
ohai "Homebrew has enabled anonymous aggregate formula and cask analytics."
puts <<~EOS
ohai_stdout_or_stderr "Homebrew has enabled anonymous aggregate formula and cask analytics."
puts_stdout_or_stderr <<~EOS
#{Tty.bold}Read the analytics documentation (and how to opt-out) here:
#{Formatter.url("https://docs.brew.sh/Analytics")}#{Tty.reset}
No analytics have been recorded yet (nor will be during this `brew` run).
@ -63,8 +63,8 @@ module Homebrew
end
if Settings.read("donationmessage") != "true" && !args.quiet?
ohai "Homebrew is run entirely by unpaid volunteers. Please consider donating:"
puts " #{Formatter.url("https://github.com/Homebrew/brew#donations")}\n"
ohai_stdout_or_stderr "Homebrew is run entirely by unpaid volunteers. Please consider donating:"
puts_stdout_or_stderr " #{Formatter.url("https://github.com/Homebrew/brew#donations")}\n"
# Consider the message possibly missed if not a TTY.
Settings.write "donationmessage", true if $stdout.tty?
@ -81,7 +81,8 @@ module Homebrew
if initial_revision != current_revision
update_preinstall_header args: args
puts "Updated Homebrew from #{shorten_revision(initial_revision)} to #{shorten_revision(current_revision)}."
puts_stdout_or_stderr \
"Updated Homebrew from #{shorten_revision(initial_revision)} to #{shorten_revision(current_revision)}."
updated = true
old_tag = Settings.read "latesttag"
@ -119,13 +120,14 @@ module Homebrew
unless updated_taps.empty?
update_preinstall_header args: args
puts "Updated #{updated_taps.count} #{"tap".pluralize(updated_taps.count)} (#{updated_taps.to_sentence})."
puts_stdout_or_stderr \
"Updated #{updated_taps.count} #{"tap".pluralize(updated_taps.count)} (#{updated_taps.to_sentence})."
updated = true
end
if updated
if hub.empty?
puts "No changes to formulae." unless args.quiet?
puts_stdout_or_stderr "No changes to formulae." unless args.quiet?
else
hub.dump(updated_formula_report: !args.preinstall?)
hub.reporters.each(&:migrate_tap_migration)
@ -137,7 +139,7 @@ module Homebrew
end
puts if args.preinstall?
elsif !args.preinstall? && !ENV["HOMEBREW_UPDATE_FAILED"]
puts "Already up-to-date." unless args.quiet?
puts_stdout_or_stderr "Already up-to-date." unless args.quiet?
end
Commands.rebuild_commands_completion_list
@ -148,8 +150,8 @@ module Homebrew
if failed_fetch_dirs.present?
failed_fetch_taps = failed_fetch_dirs.map { |dir| Tap.from_path(dir) }
puts Formatter.headline "Some taps failed to update!", color: :red
puts <<~EOS
ofail <<~EOS
Some taps failed to update!
The following taps can not read their remote branches:
#{failed_fetch_taps.join("\n ")}
This is happening because the remote branch was renamed or deleted.
@ -159,14 +161,14 @@ module Homebrew
return if new_repository_version.blank?
ohai "Homebrew was updated to version #{new_repository_version}"
ohai_stdout_or_stderr "Homebrew was updated to version #{new_repository_version}"
if new_repository_version.split(".").last == "0"
puts <<~EOS
puts_stdout_or_stderr <<~EOS
More detailed release notes are available on the Homebrew Blog:
#{Formatter.url("https://brew.sh/blog/#{new_repository_version}")}
EOS
else
puts <<~EOS
puts_stdout_or_stderr <<~EOS
The changelog can be found at:
#{Formatter.url("https://github.com/Homebrew/brew/releases/tag/#{new_repository_version}")}
EOS
@ -355,13 +357,13 @@ class Reporter
new_tap = Tap.fetch(new_tap_name)
new_tap.install unless new_tap.installed?
ohai "#{name} has been moved to Homebrew.", <<~EOS
ohai_stdout_or_stderr "#{name} has been moved to Homebrew.", <<~EOS
To uninstall the cask, run:
brew uninstall --cask --force #{name}
EOS
next if (HOMEBREW_CELLAR/new_name.split("/").last).directory?
ohai "Installing #{new_name}..."
ohai_stdout_or_stderr "Installing #{new_name}..."
system HOMEBREW_BREW_FILE, "install", new_full_name
begin
unless Formulary.factory(new_full_name).keg_only?
@ -382,12 +384,12 @@ class Reporter
# For formulae migrated to cask: Auto-install cask or provide install instructions.
if new_tap_name.start_with?("homebrew/cask")
if new_tap.installed? && (HOMEBREW_PREFIX/"Caskroom").directory?
ohai "#{name} has been moved to Homebrew Cask."
ohai "brew unlink #{name}"
ohai_stdout_or_stderr "#{name} has been moved to Homebrew Cask."
ohai_stdout_or_stderr "brew unlink #{name}"
system HOMEBREW_BREW_FILE, "unlink", name
ohai "brew cleanup"
ohai_stdout_or_stderr "brew cleanup"
system HOMEBREW_BREW_FILE, "cleanup"
ohai "brew install --cask #{new_name}"
ohai_stdout_or_stderr "brew install --cask #{new_name}"
system HOMEBREW_BREW_FILE, "install", "--cask", new_name
ohai <<~EOS
#{name} has been moved to Homebrew Cask.
@ -396,7 +398,7 @@ class Reporter
brew uninstall --force #{name}
EOS
else
ohai "#{name} has been moved to Homebrew Cask.", <<~EOS
ohai_stdout_or_stderr "#{name} has been moved to Homebrew Cask.", <<~EOS
To uninstall the formula and install the cask, run:
brew uninstall --force #{name}
brew tap #{new_tap_name}
@ -483,7 +485,10 @@ class ReporterHub
dump_formula_report :M, "Updated Formulae"
else
updated = select_formula(:M).count
ohai "Updated Formulae", "Updated #{updated} #{"formula".pluralize(updated)}." if updated.positive?
if updated.positive?
ohai_stdout_or_stderr "Updated Formulae",
"Updated #{updated} #{"formula".pluralize(updated)}."
end
end
dump_formula_report :R, "Renamed Formulae"
dump_formula_report :D, "Deleted Formulae"
@ -492,7 +497,10 @@ class ReporterHub
dump_formula_report :MC, "Updated Casks"
else
updated = select_formula(:MC).count
ohai "Updated Casks", "Updated #{updated} #{"cask".pluralize(updated)}." if updated.positive?
if updated.positive?
ohai_stdout_or_stderr "Updated Casks",
"Updated #{updated} #{"cask".pluralize(updated)}."
end
end
dump_formula_report :DC, "Deleted Casks"
end

View File

@ -78,6 +78,7 @@ end
#
# @api private
class CompilerSelector
extend T::Sig
include CompilerConstants
Compiler = Struct.new(:name, :version)
@ -109,11 +110,16 @@ class CompilerSelector
raise CompilerSelectionError, formula
end
sig { returns(String) }
def self.preferred_gcc
"gcc"
end
private
def gnu_gcc_versions
# prioritize gcc version provided by gcc formula.
v = Formulary.factory("gcc").version.to_s.slice(/\d+/)
v = Formulary.factory(CompilerSelector.preferred_gcc).version.to_s.slice(/\d+/)
GNU_GCC_VERSIONS - [v] + [v] # move the version to the end of the list
rescue FormulaUnavailableError
GNU_GCC_VERSIONS
@ -150,3 +156,5 @@ class CompilerSelector
end
end
end
require "extend/os/compilers"

View File

@ -74,7 +74,7 @@ end
# This can be used to match any given option against the given list of arguments:
# * to add condition on interdependent options
# * to ddd condition on mutually exclusive options
# * to add condition on mutually exclusive options
#
# Usage examples (for `completion -n '...'`):
# * `__fish_brew_opt -s --long` returns true if _either_ `-s` _or_ `--long` is present

View File

@ -88,7 +88,7 @@ module Homebrew
readme.read[/(Homebrew's \[Technical Steering Committee.*\.)/, 1]
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
variables[:linux] =
readme.read[%r{(Homebrew/brew's Linux maintainers .*\.)}, 1]
readme.read[/(Homebrew's Linux maintainers .*\.)/, 1]
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
variables[:maintainers] =
readme.read[/(Homebrew's other current maintainers .*\.)/, 1]

View File

@ -0,0 +1,67 @@
# typed: false
# frozen_string_literal: true
require "cli/parser"
require "utils/github"
module Homebrew
extend T::Sig
module_function
sig { returns(CLI::Parser) }
def update_maintainers_args
Homebrew::CLI::Parser.new do
description <<~EOS
Update the list of maintainers in the `Homebrew/brew` README.
EOS
named_args :none
end
end
def update_maintainers
update_maintainers_args.parse
# We assume that only public members wish to be included in the README
public_members = GitHub.public_member_usernames("Homebrew")
members = {
plc: GitHub.members_by_team("Homebrew", "plc"),
tsc: GitHub.members_by_team("Homebrew", "tsc"),
linux: GitHub.members_by_team("Homebrew", "linux"),
}
members[:other] = GitHub.members_by_team("Homebrew", "maintainers")
.except(*members.values.map(&:keys).flatten.uniq)
sentences = {}
members.each do |group, hash|
hash.slice!(*public_members)
hash.each { |login, name| hash[login] = "[#{name}](https://github.com/#{login})" }
sentences[group] = hash.values.sort.to_sentence
end
readme = HOMEBREW_REPOSITORY/"README.md"
content = readme.read
content.gsub!(/(Homebrew's \[Project Leadership Committee.*) is .*\./,
"\\1 is #{sentences[:plc]}.")
content.gsub!(/(Homebrew's \[Technical Steering Committee.*) is .*\./,
"\\1 is #{sentences[:tsc]}.")
content.gsub!(/(Homebrew's Linux maintainers are).*\./,
"\\1 #{sentences[:linux]}.")
content.gsub!(/(Homebrew's other current maintainers are).*\./,
"\\1 #{sentences[:other]}.")
File.open(readme, "w+") { |f| f.write(content) }
diff = system_command "git", args: [
"-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "README.md"
]
if diff.status.success?
puts "No changes to list of maintainers."
else
puts "List of maintainers updated in README."
end
end
end

View File

@ -872,7 +872,6 @@ module Homebrew
"N/A"
end
end
add_info "Java", SystemConfig.describe_java
nil
end

View File

@ -238,7 +238,6 @@ module SharedEnvExtension
# Snow Leopard defines an NCURSES value the opposite of most distros.
# @see https://bugs.python.org/issue6848
# Currently only used by aalib in core.
sig { void }
def ncurses_define
odeprecated "ENV.ncurses_define"

View File

@ -97,7 +97,7 @@ module Stdenv
old
end
%w[O3 O2 O1 O0 Os].each do |opt|
%w[O3 O2 Os].each do |opt|
define_method opt do
odisabled "ENV.#{opt}"
@ -106,6 +106,13 @@ module Stdenv
end
end
%w[O1 O0].each do |opt|
define_method opt do
send(:remove_from_cflags, /-O./)
send(:append_to_cflags, "-#{opt}")
end
end
sig { returns(T.any(String, Pathname)) }
def determine_cc
s = super

View File

@ -344,7 +344,7 @@ module Superenv
append_to_cccfg "O"
end
%w[O3 O2 O1 O0 Os].each do |opt|
%w[O3 O2 Os].each do |opt|
define_method opt do
odisabled "ENV.#{opt}"
@ -352,6 +352,12 @@ module Superenv
end
end
%w[O1 O0].each do |opt|
define_method opt do
send(:[]=, "HOMEBREW_OPTIMIZATION_LEVEL", opt)
end
end
sig { void }
def set_x11_env_if_installed
odisabled "ENV.set_x11_env_if_installed"

View File

@ -0,0 +1,4 @@
# typed: strict
# frozen_string_literal: true
require "extend/os/linux/compilers" if OS.linux?

View File

@ -0,0 +1,11 @@
# typed: strict
# frozen_string_literal: true
class CompilerSelector
sig { returns(String) }
def self.preferred_gcc
# gcc-5 is the lowest gcc version we support on Linux.
# gcc-5 is the default gcc in Ubuntu 16.04 (used for our CI)
"gcc@5"
end
end

View File

@ -1,6 +1,8 @@
# typed: true
# frozen_string_literal: true
require "compilers"
class Keg
def relocate_dynamic_linkage(relocation)
# Patching the dynamic linker of glibc breaks it.
@ -84,7 +86,7 @@ class Keg
def self.bottle_dependencies
@bottle_dependencies ||= begin
formulae = relocation_formulae
gcc = Formula["gcc"]
gcc = Formulary.factory(CompilerSelector.preferred_gcc)
if !Homebrew::EnvConfig.force_homebrew_on_linux? &&
DevelopmentTools.non_apple_gcc_version("gcc") < gcc.version.to_i
formulae += gcc.recursive_dependencies.map(&:name)

View File

@ -1,6 +1,8 @@
# typed: true
# frozen_string_literal: true
require "compilers"
class LinkageChecker
# Libraries provided by glibc and gcc.
SYSTEM_LIBRARY_ALLOWLIST = %w[
@ -30,6 +32,6 @@ class LinkageChecker
@unwanted_system_dylibs = @system_dylibs.reject do |s|
SYSTEM_LIBRARY_ALLOWLIST.include? File.basename(s)
end
@undeclared_deps -= ["gcc", "glibc"]
@undeclared_deps -= [CompilerSelector.preferred_gcc, "glibc"]
end
end

View File

@ -1,6 +1,7 @@
# typed: true
# frozen_string_literal: true
require "compilers"
require "os/linux/glibc"
require "system_command"
@ -46,7 +47,7 @@ module SystemConfig
out.puts "Host glibc: #{host_glibc_version}"
out.puts "/usr/bin/gcc: #{host_gcc_version}"
out.puts "/usr/bin/ruby: #{host_ruby_version}" if RUBY_PATH != HOST_RUBY_PATH
["glibc", "gcc", "xorg"].each do |f|
["glibc", CompilerSelector.preferred_gcc, "xorg"].each do |f|
out.puts "#{f}: #{formula_linked_version(f)}"
end
end

View File

@ -42,8 +42,20 @@ module Homebrew
end
class Checks
undef fatal_build_from_source_checks, fatal_setup_build_environment_checks,
supported_configuration_checks, build_from_source_checks
undef fatal_preinstall_checks, fatal_build_from_source_checks,
fatal_setup_build_environment_checks, supported_configuration_checks,
build_from_source_checks
def fatal_preinstall_checks
checks = %w[
check_access_directories
]
# We need the developer tools for `codesign`.
checks << "check_for_installed_developer_tools" if Hardware::CPU.arm?
checks.freeze
end
def fatal_build_from_source_checks
%w[
@ -405,6 +417,7 @@ module Homebrew
end
def check_if_supported_sdk_available
return unless DevelopmentTools.installed?
return unless MacOS.sdk_root_needed?
return if MacOS.sdk

View File

@ -1766,6 +1766,7 @@ class Formula
hsh = {
"name" => name,
"full_name" => full_name,
"tap" => tap&.name,
"oldname" => oldname,
"aliases" => aliases.sort,
"versioned_formulae" => versioned_formulae.map(&:name),
@ -1821,25 +1822,7 @@ class Formula
"revision" => stable.specs[:revision],
}
if bottle_defined?
bottle_spec = stable.bottle_specification
bottle_info = {
"rebuild" => bottle_spec.rebuild,
"cellar" => (cellar = bottle_spec.cellar).is_a?(Symbol) ? cellar.inspect : cellar,
"prefix" => bottle_spec.prefix,
"root_url" => bottle_spec.root_url,
}
bottle_info["files"] = {}
bottle_spec.collector.each_key do |os|
bottle_url = "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild).bintray}"
checksum = bottle_spec.collector[os][:checksum]
bottle_info["files"][os] = {
"url" => bottle_url,
"sha256" => checksum.hexdigest,
}
end
hsh["bottle"]["stable"] = bottle_info
end
hsh["bottle"]["stable"] = bottle_hash if bottle_defined?
end
hsh["options"] = options.map do |opt|
@ -1873,6 +1856,27 @@ class Formula
hsh
end
# Returns the bottle information for a formula
def bottle_hash
bottle_spec = stable.bottle_specification
hash = {
"rebuild" => bottle_spec.rebuild,
"cellar" => (cellar = bottle_spec.cellar).is_a?(Symbol) ? cellar.inspect : cellar,
"prefix" => bottle_spec.prefix,
"root_url" => bottle_spec.root_url,
"files" => {},
}
bottle_spec.collector.each_key do |os|
bottle_url = "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild).bintray}"
checksum = bottle_spec.collector[os][:checksum]
hash["files"][os] = {
"url" => bottle_url,
"sha256" => checksum.hexdigest,
}
end
hash
end
# @private
def fetch(verify_download_integrity: true)
active_spec.fetch(verify_download_integrity: verify_download_integrity)
@ -2447,11 +2451,11 @@ class Formula
#
# <pre>bottle do
# root_url "https://example.com" # Optional root to calculate bottle URLs.
# cellar "/opt/homebrew/Cellar" # Optional HOMEBREW_CELLAR in which the bottles were built.
# rebuild 1 # Marks the old bottle as outdated without bumping the version/revision of the formula.
# sha256 "ef65c759c5097a36323fa9c77756468649e8d1980a3a4e05695c05e39568967c" => :catalina
# sha256 "28f4090610946a4eb207df102d841de23ced0d06ba31cb79e040d883906dcd4f" => :mojave
# sha256 "91dd0caca9bd3f38c439d5a7b6f68440c4274945615fae035ff0a369264b8a2f" => :high_sierra
# # Optionally specify the HOMEBREW_CELLAR in which the bottles were built.
# sha256 cellar: "/brew/Cellar", catalina: "ef65c759c5097a36323fa9c77756468649e8d1980a3a4e05695c05e39568967c"
# sha256 cellar: :any, mojave: "28f4090610946a4eb207df102d841de23ced0d06ba31cb79e040d883906dcd4f"
# sha256 high_sierra: "91dd0caca9bd3f38c439d5a7b6f68440c4274945615fae035ff0a369264b8a2f"
# end</pre>
#
# Homebrew maintainers aim to bottle all formulae that require compilation.

View File

@ -399,7 +399,7 @@ module Homebrew
end
def audit_github_repository_archived
return if formula.deprecated?
return if formula.deprecated? || formula.disabled?
user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if @online
return if user.blank?
@ -411,7 +411,7 @@ module Homebrew
end
def audit_gitlab_repository_archived
return if formula.deprecated?
return if formula.deprecated? || formula.disabled?
user, repo = get_repo_data(%r{https?://gitlab\.com/([^/]+)/([^/]+)/?.*}) if @online
return if user.blank?

View File

@ -14,25 +14,29 @@ if !ENV["HOMEBREW_NO_BOOTSNAP"] &&
begin
require "bootsnap"
rescue LoadError
raise if ENV["HOMEBREW_BOOTSNAP_RETRY"]
unless ENV["HOMEBREW_BOOTSNAP_RETRY"]
require "utils/gems"
Homebrew.install_bundler_gems!
require "utils/gems"
Homebrew.install_bundler_gems!
ENV["HOMEBREW_BOOTSNAP_RETRY"] = "1"
exec ENV["HOMEBREW_BREW_FILE"], *ARGV
ENV["HOMEBREW_BOOTSNAP_RETRY"] = "1"
exec ENV["HOMEBREW_BREW_FILE"], *ARGV
end
end
ENV.delete("HOMEBREW_BOOTSNAP_RETRY")
cache = ENV["HOMEBREW_CACHE"] || ENV["HOMEBREW_DEFAULT_CACHE"]
# Can't use .blank? here because we haven't required active_support yet.
raise "Needs HOMEBREW_CACHE or HOMEBREW_DEFAULT_CACHE!" if cache.nil? || cache.empty? # rubocop:disable Rails/Blank
if defined?(Bootsnap)
cache = ENV["HOMEBREW_CACHE"] || ENV["HOMEBREW_DEFAULT_CACHE"]
# Can't use .blank? here because we haven't required active_support yet.
raise "Needs HOMEBREW_CACHE or HOMEBREW_DEFAULT_CACHE!" if cache.nil? || cache.empty? # rubocop:disable Rails/Blank
Bootsnap.setup(
cache_dir: cache,
load_path_cache: true,
compile_cache_iseq: true,
compile_cache_yaml: true,
)
Bootsnap.setup(
cache_dir: cache,
load_path_cache: true,
compile_cache_iseq: true,
compile_cache_yaml: true,
)
else
$stderr.puts "Error: HOMEBREW_BOOTSNAP could not `require \"bootsnap\"`!\n\n"
end
end

View File

@ -352,11 +352,11 @@ module Homebrew
case formula_or_cask
when Formula
urls << formula_or_cask.head.url if formula_or_cask.head
if formula_or_cask.stable
urls << formula_or_cask.stable.url
urls.concat(formula_or_cask.stable.mirrors)
end
urls << formula_or_cask.head.url if formula_or_cask.head
urls << formula_or_cask.homepage if formula_or_cask.homepage
when Cask::Cask
urls << formula_or_cask.appcast.to_s if formula_or_cask.appcast

View File

@ -20,10 +20,10 @@ module OS
# This may be a beta version for a beta macOS.
sig { returns(String) }
def latest_version
latest_stable = "12.3"
latest_stable = "12.4"
case MacOS.version
when "11" then latest_stable
when "10.15" then "12.3"
when "10.15" then "12.4"
when "10.14" then "11.3.1"
when "10.13" then "10.1"
when "10.12" then "9.2"
@ -280,7 +280,7 @@ module OS
sig { returns(String) }
def latest_clang_version
case MacOS.version
when "11", "10.15" then "1200.0.32.27"
when "11", "10.15" then "1200.0.32.29"
when "10.14" then "1100.0.33.17"
when "10.13" then "1000.10.44.2"
when "10.12" then "900.0.39.2"

View File

@ -110,7 +110,7 @@ module RuboCop
end
def check_on_os_block_content(component_precedence_list, on_os_block)
on_os_allowed_methods = %w[depends_on patch resource deprecate! disable!]
on_os_allowed_methods = %w[depends_on patch resource deprecate! disable! conflicts_with]
_, offensive_node = check_order(component_precedence_list, on_os_block.body)
component_problem(*offensive_node) if offensive_node
child_nodes = on_os_block.body.begin_type? ? on_os_block.body.child_nodes : [on_os_block.body]

View File

@ -371,6 +371,14 @@ class BottleSpecification
end
def cellar(val = nil)
# TODO: (3.1) uncomment to deprecate the old bottle syntax
# if val.present?
# odeprecated(
# "`cellar` in a bottle block",
# "`brew style --fix` on the formula to update the style or use `sha256` with a `cellar:` argument",
# )
# end
return collector.dig(Utils::Bottles.tag, :cellar) || @all_tags_cellar if val.nil?
@all_tags_cellar = val
@ -422,6 +430,14 @@ class BottleSpecification
digest, tag = hash.find do |key, value|
key.is_a?(String) && value.is_a?(Symbol) && key.match?(sha256_regex)
end
# TODO: (3.1) uncomment to deprecate the old bottle syntax
# if digest && tag
# odeprecated(
# '`sha256 "digest" => :tag` in a bottle block',
# '`brew style --fix` on the formula to update the style or use `sha256 tag: "digest"`',
# )
# end
end
cellar ||= all_tags_cellar
@ -435,7 +451,10 @@ class BottleSpecification
def checksums
tags = collector.keys.sort_by do |tag|
"#{OS::Mac::Version.from_symbol(tag)}_#{tag}"
version = OS::Mac::Version.from_symbol(tag)
# Give arm64 bottles a higher priority so they are first
priority = version.arch == :arm64 ? "2" : "1"
"#{priority}.#{version}_#{tag}"
rescue MacOSVersionError
# Sort non-MacOS tags below MacOS tags.
"0.#{tag}"

View File

@ -0,0 +1,8 @@
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `codecov` gem.
# Please instead update this file by running `tapioca sync`.
# typed: true
# THIS IS AN EMPTY RBI FILE.
# see https://github.com/Shopify/tapioca/blob/master/README.md#manual-gem-requires

View File

@ -2999,6 +2999,8 @@ end
module Bootsnap::LoadPathCache::PathScanner
def self.call(path); end
def self.os_path(path); end
def self.walk(absolute_dir_path, relative_dir_path, &block); end
end
@ -3062,6 +3064,8 @@ module Bootsnap
def self.instrumentation=(callback); end
def self.iseq_cache_supported?(); end
def self.log!(); end
def self.logger(); end
@ -6111,6 +6115,11 @@ class CompilerSelector::Compiler
def self.members(); end
end
class CompilerSelector
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks
end
class Concurrent::Promises::AbstractEventFuture
include ::Concurrent::Promises::InternalStates
end
@ -29490,7 +29499,7 @@ end
class Time
def self.===(other); end
def self.at_with_coercion(*args); end
def self.at_with_coercion(*args, **kwargs); end
def self.at_without_coercion(*_); end

View File

@ -113,16 +113,6 @@ module SystemConfig
`uname -m`.chomp
end
sig { returns(String) }
def describe_java
return "N/A" unless which "java"
_, err, status = system_command("java", args: ["-version"], print_stderr: false)
return "N/A" unless status.success?
err[/java version "([\d._]+)"/, 1] || "N/A"
end
sig { returns(String) }
def describe_git
return "N/A" unless Utils::Git.available?
@ -132,7 +122,7 @@ module SystemConfig
sig { returns(String) }
def describe_curl
out, = system_command(curl_executable, args: ["--version"])
out, = system_command(curl_executable, args: ["--version"], verbose: false)
if /^curl (?<curl_version>[\d.]+)/ =~ out
"#{curl_version} => #{curl_executable}"
@ -194,7 +184,6 @@ module SystemConfig
f.puts "Clang: #{describe_clang}"
f.puts "Git: #{describe_git}"
f.puts "Curl: #{describe_curl}"
f.puts "Java: #{describe_java}" if describe_java != "N/A"
end
def dump_verbose_config(f = $stdout)

View File

@ -296,6 +296,10 @@ class Tap
$stderr.ohai "Tapping #{name}" unless quiet
args = %W[clone #{requested_remote} #{path}]
# Override possible user configs like:
# git config --global clone.defaultRemoteName notorigin
args << "--origin=origin"
args << "--depth=1" unless full_clone
args << "-q" if quiet

View File

@ -84,10 +84,10 @@ describe Cask::Cmd::List, :cask do
end
describe "lists json" do
let(:casks) { ["local-caffeine", "local-transmission"] }
let(:casks) { ["local-caffeine", "local-transmission", "third-party/tap/third-party-cask"] }
let(:expected_output) {
<<~EOS
[{"token":"local-caffeine","name":[],"desc":null,"homepage":"https://brew.sh/","url":"file:///usr/local/Homebrew/Library/Homebrew/test/support/fixtures/cask/caffeine.zip","appcast":null,"version":"1.2.3","installed":"1.2.3","outdated":false,"sha256":"67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94","artifacts":[["Caffeine.app"]],"caveats":null,"depends_on":{},"conflicts_with":null,"container":null,"auto_updates":null},{"token":"local-transmission","name":["Transmission"],"desc":"BitTorrent client","homepage":"https://transmissionbt.com/","url":"file:///usr/local/Homebrew/Library/Homebrew/test/support/fixtures/cask/transmission-2.61.dmg","appcast":null,"version":"2.61","installed":"2.61","outdated":false,"sha256":"e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68","artifacts":[["Transmission.app"]],"caveats":null,"depends_on":{},"conflicts_with":null,"container":null,"auto_updates":null}]
[{"token":"local-caffeine","full_token":"local-caffeine","tap":"homebrew/cask","name":[],"desc":null,"homepage":"https://brew.sh/","url":"file:///usr/local/Homebrew/Library/Homebrew/test/support/fixtures/cask/caffeine.zip","appcast":null,"version":"1.2.3","installed":"1.2.3","outdated":false,"sha256":"67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94","artifacts":[["Caffeine.app"]],"caveats":null,"depends_on":{},"conflicts_with":null,"container":null,"auto_updates":null},{"token":"local-transmission","full_token":"local-transmission","tap":"homebrew/cask","name":["Transmission"],"desc":"BitTorrent client","homepage":"https://transmissionbt.com/","url":"file:///usr/local/Homebrew/Library/Homebrew/test/support/fixtures/cask/transmission-2.61.dmg","appcast":null,"version":"2.61","installed":"2.61","outdated":false,"sha256":"e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68","artifacts":[["Transmission.app"]],"caveats":null,"depends_on":{},"conflicts_with":null,"container":null,"auto_updates":null},{"token":"third-party-cask","full_token":"third-party/tap/third-party-cask","tap":"third-party/tap","name":[],"desc":null,"homepage":"https://brew.sh/","url":"https://brew.sh/ThirdParty.dmg","appcast":null,"version":"1.2.3","installed":"1.2.3","outdated":false,"sha256":"8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b","artifacts":[["ThirdParty.app"]],"caveats":null,"depends_on":{},"conflicts_with":null,"container":null,"auto_updates":null}]
EOS
}
@ -103,7 +103,7 @@ describe Cask::Cmd::List, :cask do
it "of given Casks" do
expect {
described_class.run("--json", "local-caffeine", "local-transmission")
described_class.run("--json", "local-caffeine", "local-transmission", "third-party/tap/third-party-cask")
}.to output(expected_output).to_stdout
end
end

View File

@ -22,6 +22,7 @@ describe CompilerSelector do
case name
when "gcc-7" then Version.create("7.1")
when "gcc-6" then Version.create("6.1")
when "gcc-5" then Version.create("5.1")
else Version::NULL
end
end
@ -42,16 +43,31 @@ describe CompilerSelector do
expect(selector.compiler).to eq("gcc-7")
end
it "returns gcc-6 if gcc formula offers gcc-6" do
it "returns gcc-6 if gcc formula offers gcc-6 on mac", :needs_macos do
software_spec.fails_with(:clang)
allow(Formulary).to receive(:factory).with("gcc").and_return(double(version: "6.0"))
expect(selector.compiler).to eq("gcc-6")
end
it "returns gcc-5 if gcc formula offers gcc-5 on linux", :needs_linux do
software_spec.fails_with(:clang)
allow(Formulary).to receive(:factory).with("gcc@5").and_return(double(version: "5.0"))
expect(selector.compiler).to eq("gcc-5")
end
it "returns gcc-6 if gcc formula offers gcc-6 and fails with gcc-5 and gcc-7 on linux", :needs_linux do
software_spec.fails_with(:clang)
software_spec.fails_with(gcc: "5")
software_spec.fails_with(gcc: "7")
allow(Formulary).to receive(:factory).with("gcc@5").and_return(double(version: "5.0"))
expect(selector.compiler).to eq("gcc-6")
end
it "raises an error when gcc or llvm is missing" do
software_spec.fails_with(:clang)
software_spec.fails_with(gcc: "7")
software_spec.fails_with(gcc: "6")
software_spec.fails_with(gcc: "5")
expect { selector.compiler }.to raise_error(CompilerSelectionError)
end

View File

@ -50,6 +50,17 @@ describe "brew bottle" do
end
before do
Pathname("#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json").write stub_hash(
name: "testball",
version: "1.0",
path: "#{core_tap.path}/Formula/testball.rb",
cellar: "any_skip_relocation",
os: "arm64_big_sur",
filename: "testball-1.0.arm64_big_sur.bottle.tar.gz",
local_filename: "testball--1.0.arm64_big_sur.bottle.tar.gz",
sha256: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149",
)
Pathname("#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json").write stub_hash(
name: "testball",
version: "1.0",
@ -74,6 +85,7 @@ describe "brew bottle" do
end
after do
FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json"
FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json"
end
@ -90,14 +102,16 @@ describe "brew bottle" do
brew "bottle",
"--merge",
"--write",
"#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
}.to output(<<~EOS).to_stdout
==> testball
bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
end
EOS
@ -110,8 +124,9 @@ describe "brew bottle" do
bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
end
option "with-foo", "Build with foo"
@ -141,8 +156,9 @@ describe "brew bottle" do
bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
cellar :any_skip_relocation
sha256 big_sur: "6b276491297d4052538bd2fd22d5129389f27d90a98f831987236a5b90511b98"
sha256 catalina: "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72"
sha256 "6b276491297d4052538bd2fd22d5129389f27d90a98f831987236a5b90511b98" => :big_sur
sha256 "c3c650d75f5188f5d6edd351dd3215e141b73b8ec1cf9144f30e39cbc45de72e" => :arm64_big_sur
sha256 "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72" => :catalina
end
EOS
system "git", "add", "--all"
@ -153,14 +169,16 @@ describe "brew bottle" do
brew "bottle",
"--merge",
"--write",
"#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
}.to output(<<~EOS).to_stdout
==> testball
bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
end
EOS
@ -175,8 +193,9 @@ describe "brew bottle" do
bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
end
def install
@ -203,8 +222,9 @@ describe "brew bottle" do
bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, big_sur: "6b276491297d4052538bd2fd22d5129389f27d90a98f831987236a5b90511b98"
sha256 cellar: :any_skip_relocation, catalina: "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "c3c650d75f5188f5d6edd351dd3215e141b73b8ec1cf9144f30e39cbc45de72e"
sha256 cellar: :any_skip_relocation, big_sur: "6b276491297d4052538bd2fd22d5129389f27d90a98f831987236a5b90511b98"
sha256 cellar: :any_skip_relocation, catalina: "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72"
end
EOS
system "git", "add", "--all"
@ -215,14 +235,16 @@ describe "brew bottle" do
brew "bottle",
"--merge",
"--write",
"#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
}.to output(<<~EOS).to_stdout
==> testball
bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
end
EOS
@ -237,8 +259,9 @@ describe "brew bottle" do
bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
end
def install
@ -271,6 +294,7 @@ describe "brew bottle" do
"--merge",
"--write",
"--keep-old",
"#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
}.to output("Error: `--keep-old` was passed but there was no existing bottle block!\n").to_stderr
@ -296,15 +320,17 @@ describe "brew bottle" do
"--merge",
"--write",
"--keep-old",
"#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
}.to output(<<~EOS).to_stdout
==> testball
bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059"
end
EOS
@ -319,9 +345,10 @@ describe "brew bottle" do
bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059"
end
def install
@ -360,15 +387,17 @@ describe "brew bottle" do
"--merge",
"--write",
"--keep-old",
"#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
}.to output(<<~EOS).to_stdout
==> testball
bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059"
end
EOS
@ -383,9 +412,10 @@ describe "brew bottle" do
bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059"
end
def install

View File

@ -0,0 +1,8 @@
# typed: false
# frozen_string_literal: true
require "cmd/shared_examples/args_parse"
describe "brew update-maintainers" do
it_behaves_like "parseable arguments"
end

View File

@ -24,6 +24,7 @@ describe FormulaInstaller do
stub_formula_loader formula
stub_formula_loader formula("gcc") { url "gcc-1.0" }
stub_formula_loader formula("gcc@5") { url "gcc-5.0" }
stub_formula_loader formula("patchelf") { url "patchelf-1.0" }
allow(Formula["patchelf"]).to receive(:latest_version_installed?).and_return(true)

View File

@ -838,6 +838,7 @@ describe Formula do
expect(h).to be_a(Hash)
expect(h["name"]).to eq("foo")
expect(h["full_name"]).to eq("foo")
expect(h["tap"]).to eq("homebrew/core")
expect(h["versions"]["stable"]).to eq("1.0")
expect(h["versions"]["bottle"]).to be_truthy
end

View File

@ -142,6 +142,7 @@ describe Formulary do
before do
allow(described_class).to receive(:loader_for).and_call_original
stub_formula_loader formula("gcc") { url "gcc-1.0" }
stub_formula_loader formula("gcc@5") { url "gcc-5.0" }
stub_formula_loader formula("patchelf") { url "patchelf-1.0" }
allow(Formula["patchelf"]).to receive(:latest_version_installed?).and_return(true)
end

View File

@ -133,7 +133,7 @@ describe Homebrew::Livecheck do
describe "::checkable_urls" do
it "returns the list of URLs to check" do
expect(livecheck.checkable_urls(f)).to eq([head_url, stable_url, homepage_url])
expect(livecheck.checkable_urls(f)).to eq([stable_url, head_url, homepage_url])
expect(livecheck.checkable_urls(c)).to eq([cask_url, homepage_url])
end
end

View File

@ -50,6 +50,13 @@ describe GitHub do
end
end
describe "::public_member_usernames", :needs_network do
it "gets the usernames of all publicly visible members of the organisation" do
response = described_class.public_member_usernames("Homebrew")
expect(response).to be_a(Array)
end
end
describe "::sponsors_by_tier", :needs_network do
it "errors on an unauthenticated token" do
expect {

View File

@ -111,6 +111,23 @@ module Kernel
puts sput
end
def ohai_stdout_or_stderr(message, *sput)
if $stdout.tty?
ohai(message, *sput)
else
$stderr.puts(ohai_title(message))
$stderr.puts(sput)
end
end
def puts_stdout_or_stderr(*message)
if $stdout.tty?
puts(message)
else
$stderr.puts(message)
end
end
def odebug(title, *sput, always_display: false)
debug = if respond_to?(:debug)
debug?

View File

@ -20,10 +20,16 @@ module GitHub
CREATE_GIST_SCOPES = ["gist"].freeze
CREATE_ISSUE_FORK_OR_PR_SCOPES = ["public_repo"].freeze
ALL_SCOPES = (CREATE_GIST_SCOPES + CREATE_ISSUE_FORK_OR_PR_SCOPES).freeze
CREATE_WORKFLOW_SCOPES = ["workflow"].freeze
ALL_SCOPES = (CREATE_GIST_SCOPES + CREATE_ISSUE_FORK_OR_PR_SCOPES + CREATE_WORKFLOW_SCOPES).freeze
ALL_SCOPES_URL = Formatter.url(
"https://github.com/settings/tokens/new?scopes=#{ALL_SCOPES.join(",")}&description=Homebrew",
).freeze
CREATE_GITHUB_PAT_MESSAGE = <<~EOS
Create a GitHub personal access token:
#{ALL_SCOPES_URL}
#{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")}
EOS
# Generic API error.
class Error < RuntimeError
@ -44,9 +50,8 @@ module GitHub
@github_message = github_message
super <<~EOS
GitHub API Error: #{github_message}
Try again in #{pretty_ratelimit_reset(reset)}, or create a personal access token:
#{ALL_SCOPES_URL}
#{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")}
Try again in #{pretty_ratelimit_reset(reset)}, or:
#{CREATE_GITHUB_PAT_MESSAGE}
EOS
end
@ -70,15 +75,22 @@ module GitHub
The GitHub credentials in the macOS keychain may be invalid.
Clear them with:
printf "protocol=https\\nhost=github.com\\n" | git credential-osxkeychain erase
Or create a personal access token:
#{ALL_SCOPES_URL}
#{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")}
#{CREATE_GITHUB_PAT_MESSAGE}
EOS
end
super message.freeze
end
end
# Error when the user has no GitHub API credentials set at all (macOS keychain or envvar).
class MissingAuthenticationError < Error
def initialize
message = +"No GitHub credentials found in macOS Keychain or environment.\n"
message << CREATE_GITHUB_PAT_MESSAGE
super message
end
end
# Error when the API returns a validation error.
class ValidationFailedError < Error
def initialize(github_message, errors)
@ -168,9 +180,7 @@ module GitHub
Your #{what} credentials do not have sufficient scope!
Scopes required: #{needed_scopes}
Scopes present: #{credentials_scopes}
Create a personal access token:
#{ALL_SCOPES_URL}
#{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")}
#{CREATE_GITHUB_PAT_MESSAGE}
EOS
end
@ -277,6 +287,8 @@ module GitHub
when "401", "403"
raise AuthenticationFailedError, message
when "404"
raise MissingAuthenticationError if api_credentials_type == :none && scopes.present?
raise HTTPNotFoundError, message
when "422"
errors = json&.[]("errors") || []
@ -560,6 +572,47 @@ module GitHub
artifact.first["archive_download_url"]
end
def public_member_usernames(org, per_page: 100)
url = "#{API_URL}/orgs/#{org}/public_members?per_page=#{per_page}"
members = []
(1..API_MAX_PAGES).each do |page|
result = open_api("#{url}&page=#{page}").map { |member| member["login"] }
members.concat(result)
return members if result.length < per_page
end
end
def members_by_team(org, team)
query = <<~EOS
{ organization(login: "#{org}") {
teams(first: 100) {
nodes {
... on Team { name }
}
}
team(slug: "#{team}") {
members(first: 100) {
nodes {
... on User { login name }
}
}
}
}
}
EOS
result = open_graphql(query, scopes: ["read:org", "user"])
if result["organization"]["teams"]["nodes"].blank?
raise Error,
"Your token needs the 'read:org' scope to access this API"
end
raise Error, "The team #{org}/#{team} does not exist" if result["organization"]["team"].blank?
result["organization"]["team"]["members"]["nodes"].map { |member| [member["login"], member["name"]] }.to_h
end
def sponsors_by_tier(user)
query = <<~EOS
{ organization(login: "#{user}") {

View File

@ -4,17 +4,17 @@ ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
ruby_version = RbConfig::CONFIG["ruby_version"]
path = File.expand_path('..', __FILE__)
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.7/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.8/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.14.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-2.0.4/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.4.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.1.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.1.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/bindata-2.4.8/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-14/2.6.0-static/msgpack-1.4.2"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/msgpack-1.4.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-14/2.6.0-static/bootsnap-1.7.0"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/bootsnap-1.7.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-14/2.6.0-static/bootsnap-1.7.2"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/bootsnap-1.7.2/lib"
$:.unshift "#{path}/"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-14/2.6.0-static/byebug-11.1.3"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/byebug-11.1.3/lib"
@ -54,7 +54,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.20.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-3.4.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-3.0.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-runtime-0.5.6262/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-runtime-0.5.6267/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parlour-5.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/patchelf-1.3.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.6.0/lib"
@ -73,8 +73,8 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-3.10.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-github-2.3.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-its-1.3.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-retry-0.6.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-static-0.5.6262-universal-darwin-14/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-0.5.6262/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-static-0.5.6274-universal-darwin-14/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-0.5.6274/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-sorbet-1.8.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.4.1/lib"

Some files were not shown because too many files have changed in this diff Show More