Merge branch 'master' into license

This commit is contained in:
Lionell 2020-06-25 13:42:27 +08:00
commit 57fd1fdc7e
294 changed files with 1213 additions and 14671 deletions

12
.gitignore vendored
View File

@ -19,6 +19,7 @@
/Library/Taps
/Library/PinnedTaps
/Library/Homebrew/.byebug_history
/Library/Homebrew/sorbet/rbi/hidden-definitions/errors.txt
# Ignore Bundler files
**/.bundle/bin
@ -128,9 +129,6 @@
**/vendor/bundle/ruby/*/gems/simplecov-*/
**/vendor/bundle/ruby/*/gems/simplecov-cobertura-*/
**/vendor/bundle/ruby/*/gems/simplecov-html-*/
**/vendor/bundle/ruby/*/gems/sorbet-*/
**/vendor/bundle/ruby/*/gems/sorbet-runtime-*/
**/vendor/bundle/ruby/*/gems/tapioca-*/
**/vendor/bundle/ruby/*/gems/term-ansicolor-*/
**/vendor/bundle/ruby/*/gems/thor-*/
**/vendor/bundle/ruby/*/gems/tins-*/
@ -139,6 +137,14 @@
**/vendor/bundle/ruby/*/gems/unicode-display_width-*/
**/vendor/bundle/ruby/*/gems/webrobots-*/
# Ignore conditional dependencies we don't wish to vendor
**/vendor/bundle/ruby/*/gems/bindata-*/
**/vendor/bundle/ruby/*/gems/elftools-*/
**/vendor/bundle/ruby/*/gems/patchelf-*/
**/vendor/bundle/ruby/*/gems/sorbet-*/
**/vendor/bundle/ruby/*/gems/sorbet-runtime-*/
**/vendor/bundle/ruby/*/gems/tapioca-*/
# Ignore `bin` contents (again).
/bin

View File

@ -56,7 +56,7 @@ Metrics/ClassLength:
Max: 1400
Metrics/CyclomaticComplexity:
Enabled: true
Max: 75
Max: 85
Metrics/MethodLength:
Enabled: true
Max: 300

View File

@ -23,6 +23,7 @@ end
gem "activesupport"
gem "concurrent-ruby"
gem "mechanize"
gem "patchelf" if ENV["HOMEBREW_PATCHELF_RB"]
gem "plist"
gem "rubocop-performance"
gem "rubocop-rspec"

View File

@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.0.3.1)
activesupport (6.0.3.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
@ -17,7 +17,7 @@ GEM
term-ansicolor (~> 1.3)
thor (>= 0.19.4, < 2.0)
tins (~> 1.6)
diff-lcs (1.3)
diff-lcs (1.4.2)
docile (1.3.2)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
@ -51,8 +51,8 @@ GEM
parallel (1.19.2)
parallel_tests (3.0.0)
parallel
parser (2.7.1.3)
ast (~> 2.4.0)
parser (2.7.1.4)
ast (~> 2.4.1)
plist (3.5.0)
rainbow (3.0.0)
rdiscount (2.2.0.1)
@ -82,13 +82,13 @@ GEM
rspec-support (3.9.3)
rspec-wait (0.0.9)
rspec (>= 3, < 4)
rubocop (0.85.1)
rubocop (0.86.0)
parallel (~> 1.10)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.0.3)
rubocop-ast (>= 0.0.3, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.0.3)

View File

@ -66,6 +66,41 @@ class Bintray
%w[homebrew linuxbrew].include? org
end
def stable_mirrored?(url)
headers, = curl_output("--connect-timeout", "15", "--location", "--head", url)
status_code = headers.scan(%r{^HTTP/.* (\d+)}).last.first
status_code.start_with?("2")
end
def mirror_formula(formula, repo: "mirror", publish_package: false)
package = Utils::Bottles::Bintray.package formula.name
create_package(repo: repo, package: package) unless package_exists?(repo: repo, package: package)
formula.downloader.fetch
version = ERB::Util.url_encode(formula.pkg_version)
filename = ERB::Util.url_encode(formula.downloader.basename)
destination_url = "https://dl.bintray.com/#{@bintray_org}/#{repo}/#{filename}"
odebug "Uploading to #{destination_url}"
upload(
formula.downloader.cached_location,
repo: repo,
package: package,
version: version,
sha256: formula.stable.checksum,
remote_file: filename,
)
return destination_url unless publish_package
odebug "Publishing #{@bintray_org}/#{repo}/#{package}/#{version}"
publish(repo: repo, package: package, version: version, file_count: 1)
destination_url
end
def create_package(repo:, package:, **extra_data_args)
url = "#{API_URL}/packages/#{@bintray_org}/#{repo}"
data = { name: package, public_download_numbers: true }

View File

@ -58,6 +58,7 @@ begin
help_flag = true
elsif !cmd && !help_flag_list.include?(arg)
cmd = ARGV.delete_at(i)
cmd = Commands::HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd)
end
end

View File

@ -233,6 +233,10 @@ HOMEBREW_CACHE="${HOMEBREW_CACHE:-${HOMEBREW_DEFAULT_CACHE}}"
HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOMEBREW_DEFAULT_LOGS}}"
HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}"
case "$*" in
--cache) echo "$HOMEBREW_CACHE"; exit 0 ;;
esac
HOMEBREW_USER_AGENT="$HOMEBREW_PRODUCT/$HOMEBREW_USER_AGENT_VERSION ($HOMEBREW_SYSTEM; $HOMEBREW_PROCESSOR $HOMEBREW_OS_USER_AGENT_VERSION)"
curl_version_output="$("$HOMEBREW_CURL" --version 2>/dev/null)"
curl_name_and_version="${curl_version_output%% (*}"

View File

@ -16,10 +16,14 @@ module Cask
def run
casks.each do |cask|
puts Download.new(cask).downloader.cached_location
puts self.class.cached_location(cask)
end
end
def self.cached_location(cask)
Download.new(cask).downloader.cached_location
end
def self.help
"display the file used to cache the Cask"
end

View File

@ -2,6 +2,8 @@
require "fetch"
require "cli/parser"
require "cask/cmd"
require "cask/cask_loader"
module Homebrew
module_function
@ -19,7 +21,12 @@ module Homebrew
description: "Show the cache file used when building from source."
switch "--force-bottle",
description: "Show the cache file used when pouring a bottle."
switch "--formula",
description: "Show cache files for only formulae"
switch "--cask",
description: "Show cache files for only casks"
conflicts "--build-from-source", "--force-bottle"
conflicts "--formula", "--cask"
end
end
@ -28,14 +35,38 @@ module Homebrew
if args.no_named?
puts HOMEBREW_CACHE
elsif args.formula?
args.named.each do |name|
print_formula_cache name
end
elsif args.cask?
args.named.each do |name|
print_cask_cache name
end
else
args.formulae.each do |f|
if Fetch.fetch_bottle?(f)
puts f.bottle.cached_download
else
puts f.cached_download
args.named.each do |name|
print_formula_cache name
rescue FormulaUnavailableError
begin
print_cask_cache name
rescue Cask::CaskUnavailableError
odie "No available formula or cask with the name \"#{name}\""
end
end
end
end
def print_formula_cache(name)
formula = Formulary.factory name
if Fetch.fetch_bottle?(formula)
puts formula.bottle.cached_download
else
puts formula.cached_download
end
end
def print_cask_cache(name)
cask = Cask::CaskLoader.load name
puts Cask::Cmd::Cache.cached_location(cask)
end
end

View File

@ -1,6 +1,8 @@
# frozen_string_literal: true
require "cli/parser"
require "cask/cask_loader"
require "cask/exceptions"
module Homebrew
module_function
@ -23,7 +25,20 @@ module Homebrew
if args.no_named?
exec_browser HOMEBREW_WWW
else
exec_browser(*args.formulae.map(&:homepage))
homepages = args.named.map do |name|
f = Formulary.factory(name)
puts "Opening homepage for formula #{name}"
f.homepage
rescue FormulaUnavailableError
begin
c = Cask::CaskLoader.load(name)
puts "Opening homepage for cask #{name}"
c.homepage
rescue Cask::CaskUnavailableError
odie "No available formula or cask with the name \"#{name}\""
end
end
exec_browser(*homepages)
end
end
end

View File

@ -29,11 +29,11 @@ module Homebrew
description: "List global Homebrew analytics data or, if specified, installation and "\
"build error data for <formula> (provided neither `HOMEBREW_NO_ANALYTICS` "\
"nor `HOMEBREW_NO_GITHUB_API` are set)."
flag "--days",
flag "--days=",
depends_on: "--analytics",
description: "How many days of analytics data to retrieve. "\
"The value for <days> must be `30`, `90` or `365`. The default is `30`."
flag "--category",
flag "--category=",
depends_on: "--analytics",
description: "Which type of analytics data to retrieve. "\
"The value for <category> must be `install`, `install-on-request` or `build-error`; "\

View File

@ -129,6 +129,7 @@ module Homebrew
puts if args.preinstall?
end
Commands.rebuild_commands_completion_list
link_completions_manpages_and_docs
Tap.each(&:link_completions_and_manpages)
end

View File

@ -38,10 +38,13 @@ homebrew-update-reset() {
cd "$DIR" || continue
ohai "Fetching $DIR..."
git fetch --force --tags origin
git remote set-head origin --auto >/dev/null
echo
ohai "Resetting $DIR..."
git checkout --force -B master origin/master
head="$(git symbolic-ref refs/remotes/origin/HEAD)"
head="${head#refs/remotes/origin/}"
git checkout --force -B "$head" origin/HEAD
echo
done
}

View File

@ -38,6 +38,7 @@ git_init_if_necessary() {
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
latest_tag="$(git ls-remote --tags --refs -q origin | tail -n1 | cut -f2)"
git fetch --force origin --shallow-since="$latest_tag"
git remote set-head origin --auto >/dev/null
git reset --hard origin/master
SKIP_FETCH_BREW_REPOSITORY=1
set +e
@ -59,6 +60,7 @@ git_init_if_necessary() {
git config remote.origin.url "$HOMEBREW_CORE_GIT_REMOTE"
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch --force --depth=1 origin refs/heads/master:refs/remotes/origin/master
git remote set-head origin --auto >/dev/null
git reset --hard origin/master
SKIP_FETCH_CORE_REPOSITORY=1
set +e
@ -84,6 +86,11 @@ upstream_branch() {
local upstream_branch
upstream_branch="$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null)"
if [[ -z "$upstream_branch" ]]
then
git remote set-head origin --auto >/dev/null
upstream_branch="$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null)"
fi
upstream_branch="${upstream_branch#refs/remotes/origin/}"
[[ -z "$upstream_branch" ]] && upstream_branch="master"
echo "$upstream_branch"
@ -597,6 +604,7 @@ EOS
-n "$HOMEBREW_UPDATE_FAILED" ||
-n "$HOMEBREW_UPDATE_FORCE" ||
-d "$HOMEBREW_LIBRARY/LinkedKegs" ||
! -f "$HOMEBREW_CACHE/all_commands_list.txt" ||
(-n "$HOMEBREW_DEVELOPER" && -z "$HOMEBREW_UPDATE_PREINSTALL") ]]
then
brew update-report "$@"

View File

@ -143,4 +143,21 @@ module Commands
.select(&:file?)
.sort
end
def rebuild_internal_commands_completion_list
cmds = internal_commands + internal_developer_commands + internal_commands_aliases
file = HOMEBREW_REPOSITORY/"completions/internal_commands_list.txt"
file.delete if file.exist?
file.write(cmds.sort.join("\n") + "\n")
end
def rebuild_commands_completion_list
# Ensure that the cache exists so we can build the commands list
HOMEBREW_CACHE.mkpath
file = HOMEBREW_CACHE/"all_commands_list.txt"
file.delete if file.exist?
file.write(commands(aliases: true).sort.join("\n") + "\n")
end
end

View File

@ -155,7 +155,7 @@ module Homebrew
if version_segments && Gem::Version.correct?(test_formula.version)
test_formula_version_segments = Gem::Version.new(test_formula.version).segments
if version_segments.length < test_formula_version_segments.length
odebug "Apply semantic versioning with #{test_formual_version_segments}"
odebug "Apply semantic versioning with #{test_formula_version_segments}"
break if version_segments == test_formula_version_segments.first(version_segments.length)
end
end

View File

@ -35,10 +35,11 @@ module Homebrew
odie "`brew man --link` is now done automatically by `brew update`." if args.link?
Commands.rebuild_internal_commands_completion_list
regenerate_man_pages
if system "git", "-C", HOMEBREW_REPOSITORY, "diff", "--quiet", "docs/Manpage.md", "manpages"
puts "No changes to manpage output detected."
if system "git", "-C", HOMEBREW_REPOSITORY, "diff", "--quiet", "docs/Manpage.md", "manpages", "completions"
puts "No changes to manpage or completions output detected."
elsif args.fail_if_changed?
Homebrew.failed = true
end

View File

@ -15,6 +15,10 @@ module Homebrew
EOS
flag "--bintray-org=",
description: "Upload to the specified Bintray organisation (default: homebrew)."
flag "--bintray-repo=",
description: "Upload to the specified Bintray repository (default: mirror)."
switch "--no-publish",
description: "Upload to Bintray, but don't publish."
switch :verbose
switch :debug
hide_from_man_page!
@ -26,37 +30,13 @@ module Homebrew
mirror_args.parse
bintray_org = args.bintray_org || "homebrew"
bintray_repo = "mirror"
bintray_repo = args.bintray_repo || "mirror"
bintray = Bintray.new(org: bintray_org)
args.formulae.each do |f|
bintray_package = Utils::Bottles::Bintray.package f.name
unless bintray.package_exists?(repo: bintray_repo, package: bintray_package)
bintray.create_package repo: bintray_repo, package: bintray_package
end
downloader = f.downloader
downloader.fetch
filename = ERB::Util.url_encode(downloader.basename)
destination_url = "https://dl.bintray.com/#{bintray_org}/#{bintray_repo}/#{filename}"
ohai "Uploading to #{destination_url}"
version = ERB::Util.url_encode(f.pkg_version)
bintray.upload(
downloader.cached_location,
repo: bintray_repo,
package: bintray_package,
version: version,
sha256: f.stable.checksum,
remote_file: filename,
)
bintray.publish(repo: bintray_repo, package: bintray_package, version: version)
ohai "Mirrored #{filename}!"
args.formulae.each do |formula|
mirror_url = bintray.mirror_formula(formula, repo: bintray_repo, publish_package: !args.no_publish?)
ohai "Mirrored #{formula.full_name} to #{mirror_url}!"
end
end
end

View File

@ -41,6 +41,11 @@ module Homebrew
description: "Upload to the specified Bintray organisation (default: homebrew)."
flag "--tap=",
description: "Target tap repository (default: homebrew/core)."
flag "--root-url=",
description: "Use the specified <URL> as the root of the bottle's URL instead of Homebrew's default."
flag "--bintray-mirror=",
description: "Use the specified Bintray repository to automatically mirror stable URLs "\
"defined in the formulae (default: mirror)"
switch :verbose
switch :debug
min_named 1
@ -128,6 +133,32 @@ module Homebrew
def formulae_need_bottles?(tap, original_commit)
return if Homebrew.args.dry_run?
changed_formulae(tap, original_commit).any? do |f|
!f.bottle_unneeded? && !f.bottle_disabled?
end
end
def mirror_formulae(tap, original_commit, publish: true, org:, repo:)
changed_formulae(tap, original_commit).select do |f|
stable_urls = [f.stable.url] + f.stable.mirrors
stable_urls.grep(%r{^https://dl.bintray.com/#{org}/#{repo}/}) do |mirror_url|
if Homebrew.args.dry_run?
puts "brew mirror #{f.full_name}"
else
odebug "Mirroring #{mirror_url}"
mirror_args = ["mirror", f.full_name]
mirror_args << "--debug" if Homebrew.args.debug?
mirror_args << "--verbose" if Homebrew.args.verbose?
mirror_args << "--bintray-org=#{org}" if org
mirror_args << "--bintray-repo=#{repo}" if repo
mirror_args << "--no-publish" unless publish
system HOMEBREW_BREW_FILE, *mirror_args
end
end
end
end
def changed_formulae(tap, original_commit)
if Homebrew::EnvConfig.disable_load_formula?
opoo "Can't check if updated bottles are necessary as formula loading is disabled!"
return
@ -136,19 +167,17 @@ module Homebrew
Utils.popen_read("git", "-C", tap.path, "diff-tree",
"-r", "--name-only", "--diff-filter=AM",
original_commit, "HEAD", "--", tap.formula_dir)
.lines.each do |line|
.lines.map do |line|
next unless line.end_with? ".rb\n"
name = "#{tap.name}/#{File.basename(line.chomp, ".rb")}"
begin
f = Formula[name]
Formula[name]
rescue Exception # rubocop:disable Lint/RescueException
# Make sure we catch syntax errors.
next
end
return true if !f.bottle_unneeded? && !f.bottle_disabled?
end
nil
end.compact
end
def download_artifact(url, dir, pr)
@ -181,12 +210,11 @@ module Homebrew
if bintray_user.blank? || bintray_key.blank?
odie "Missing HOMEBREW_BINTRAY_USER or HOMEBREW_BINTRAY_KEY variables!" if !args.dry_run? && !args.no_upload?
else
bintray = Bintray.new(user: bintray_user, key: bintray_key, org: bintray_org)
end
workflow = args.workflow || "tests.yml"
artifact = args.artifact || "bottles"
mirror_repo = args.bintray_mirror || "mirror"
tap = Tap.fetch(args.tap || CoreTap.instance.name)
setup_git_environment!
@ -206,6 +234,10 @@ module Homebrew
cherry_pick_pr! pr, path: tap.path
signoff! pr, path: tap.path unless args.clean?
unless args.no_upload?
mirror_formulae(tap, original_commit, org: bintray_org, repo: mirror_repo, publish: !args.no_publish?)
end
unless formulae_need_bottles? tap, original_commit
ohai "Skipping artifacts for ##{pr} as the formulae don't need bottles"
next
@ -214,19 +246,16 @@ module Homebrew
url = GitHub.get_artifact_url(user, repo, pr, workflow_id: workflow, artifact_name: artifact)
download_artifact(url, dir, pr)
if Homebrew.args.dry_run?
puts "brew bottle --merge --write #{Dir["*.json"].join " "}"
else
quiet_system "#{HOMEBREW_PREFIX}/bin/brew", "bottle", "--merge", "--write", *Dir["*.json"]
end
next if args.no_upload?
if Homebrew.args.dry_run?
puts "Upload bottles described by these JSON files to Bintray:\n #{Dir["*.json"].join("\n ")}"
else
bintray.upload_bottle_json Dir["*.json"], publish_package: !args.no_publish?
end
upload_args = ["pr-upload"]
upload_args << "--debug" if Homebrew.args.debug?
upload_args << "--verbose" if Homebrew.args.verbose?
upload_args << "--no-publish" if args.no_publish?
upload_args << "--dry-run" if args.dry_run?
upload_args << "--root_url=#{args.root_url}" if args.root_url
upload_args << "--bintray-org=#{bintray_org}"
system HOMEBREW_BREW_FILE, *upload_args
end
end
end

View File

@ -21,6 +21,8 @@ module Homebrew
description: "Upload to the specified Bintray organisation (default: homebrew)."
flag "--root-url=",
description: "Use the specified <URL> as the root of the bottle's URL instead of Homebrew's default."
switch :verbose
switch :debug
end
end
@ -31,6 +33,8 @@ module Homebrew
bintray = Bintray.new(org: bintray_org)
bottle_args = ["bottle", "--merge", "--write"]
bottle_args << "--verbose" if args.verbose?
bottle_args << "--debug" if args.debug?
bottle_args << "--root-url=#{args.root_url}" if args.root_url
odie "No JSON files found in the current working directory" if Dir["*.json"].empty?
bottle_args += Dir["*.json"]

View File

@ -614,7 +614,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
super
@ref_type ||= :branch
@ref ||= "master"
@shallow = meta.fetch(:shallow) { true }
@shallow = meta.fetch(:shallow, true)
end
def source_modified_time

View File

@ -1,6 +1,12 @@
# frozen_string_literal: true
class Formula
undef shared_library
def shared_library(name, version = nil)
"#{name}.so#{"." unless version.nil?}#{version}"
end
class << self
undef on_linux

View File

@ -16,7 +16,8 @@ module Homebrew
].freeze
def check_cpu
return if (Hardware::CPU.intel? && Hardware::CPU.is_64_bit?) || Hardware::CPU.arm?
return if Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
return if Hardware::CPU.arm?
message = "Sorry, Homebrew does not support your computer's CPU architecture!"
if Hardware::CPU.ppc64le?

View File

@ -52,7 +52,7 @@ module Stdenv
def remove_macosxsdk(version = nil)
# Clear all lib and include dirs from CFLAGS, CPPFLAGS, LDFLAGS that were
# previously added by macosxsdk
remove_from_cflags(/ ?-mmacosx-version-min=10\.\d+/)
remove_from_cflags(/ ?-mmacosx-version-min=\d+\.\d+/)
delete("CPATH")
remove "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
require "macho"
module Hardware
class CPU
class << self
@ -9,14 +11,18 @@ module Hardware
# Look in <mach/machine.h> for decoding info.
def type
case sysctl_int("hw.cputype")
when 7
when MachO::Headers::CPU_TYPE_I386
:intel
when MachO::Headers::CPU_TYPE_ARM64
:arm
else
:dunno
end
end
def family
return :dunno if arm?
case sysctl_int("hw.cpufamily")
when 0x73d67300 # Yonah: Core Solo/Duo
:core

View File

@ -6,7 +6,9 @@ module Utils
undef tag
def tag
MacOS.version.to_sym
tag = MacOS.version.to_sym
tag = "#{tag}_arm".to_sym if Hardware::CPU.arm?
tag
end
end

View File

@ -346,13 +346,17 @@ class Pathname
end
# Writes an exec script that sets environment variables
def write_env_script(target, env)
def write_env_script(target, args, env = nil)
unless env
env = args
args = nil
end
env_export = +""
env.each { |key, value| env_export << "#{key}=\"#{value}\" " }
dirname.mkpath
write <<~SH
#!/bin/bash
#{env_export}exec "#{target}" "$@"
#{env_export}exec "#{target}" #{args} "$@"
SH
end
@ -370,7 +374,7 @@ class Pathname
# Writes an exec script that invokes a Java jar
def write_jar_script(target_jar, script_name, java_opts = "", java_version: nil)
(self/script_name).write_env_script "java #{java_opts} -jar #{target_jar}",
(self/script_name).write_env_script "java", "#{java_opts} -jar \"#{target_jar}\"",
Language::Java.overridable_java_home_env(java_version)
end

View File

@ -1357,6 +1357,11 @@ class Formula
"#<Formula #{name} (#{active_spec_sym}) #{path}>"
end
# Standard parameters for cargo builds.
def std_cargo_args
["--locked", "--root", prefix, "--path", "."]
end
# Standard parameters for CMake builds.
# Setting `CMAKE_FIND_FRAMEWORK` to "LAST" tells CMake to search for our
# libraries before trying to utilize Frameworks, many of which will be from
@ -1405,6 +1410,10 @@ class Formula
["--prefix=#{prefix}", "--libdir=#{lib}"]
end
def shared_library(name, version = nil)
"#{name}.#{version}#{"." unless version.nil?}dylib"
end
# an array of all core {Formula} names
# @private
def self.core_names
@ -1934,6 +1943,8 @@ class Formula
case cmd
when "./configure"
pretty_args -= %w[--disable-dependency-tracking --disable-debug --disable-silent-rules]
when "cargo"
pretty_args -= std_cargo_args
when "cmake"
pretty_args -= std_cmake_args
when "go"
@ -2146,6 +2157,7 @@ class Formula
stage_env[:_JAVA_OPTIONS] =
"#{ENV["_JAVA_OPTIONS"]&.+(" ")}-Duser.home=#{HOMEBREW_CACHE}/java_cache"
stage_env[:GOCACHE] = "#{HOMEBREW_CACHE}/go_cache"
stage_env[:GOPATH] = "#{HOMEBREW_CACHE}/go_mod_cache"
stage_env[:CARGO_HOME] = "#{HOMEBREW_CACHE}/cargo_cache"
stage_env[:CURL_HOME] = ENV["CURL_HOME"] || ENV["HOME"]
end

View File

@ -176,7 +176,7 @@ module Homebrew
bin.install libexec/"bin/\#{name}"
bin.env_script_all_files(libexec/"bin", :GEM_HOME => ENV["GEM_HOME"])
<% elsif mode == :rust %>
system "cargo", "install", "--locked", "--root", prefix, "--path", "."
system "cargo", "install", *std_cargo_args
<% else %>
# Remove unrecognized options if warned by configure
system "./configure", "--disable-debug",

View File

@ -13,7 +13,10 @@ module Homebrew
return if Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
message = "Sorry, Homebrew does not support your computer's CPU architecture!"
if Hardware::CPU.ppc?
if Hardware::CPU.arm?
opoo message
return
elsif Hardware::CPU.ppc?
message += <<~EOS
For PowerPC Mac (PPC32/PPC64BE) support, see:
#{Formatter.url("https://github.com/mistydemeo/tigerbrew")}

View File

@ -3,6 +3,7 @@
require "keg"
require "formula"
require "linkage_cache_store"
require "fiddle"
class LinkageChecker
attr_reader :undeclared_deps
@ -125,6 +126,11 @@ class LinkageChecker
if (dep = dylib_to_dep(dylib))
@broken_deps[dep] |= [dylib]
elsif MacOS.version >= :big_sur && dylib_found_via_dlopen(dylib)
# If we cannot associate the dylib with a dependency, then it may be a system library.
# In macOS Big Sur and later, system libraries do not exist on-disk and instead exist in a cache.
# If dlopen finds the dylib, then the linkage is not broken.
@system_dylibs << dylib
else
@broken_dylibs << dylib
end
@ -151,6 +157,13 @@ class LinkageChecker
end
alias generic_check_dylibs check_dylibs
def dylib_found_via_dlopen(dylib)
Fiddle.dlopen(dylib).close
true
rescue Fiddle::DLError
false
end
def check_formula_deps
filter_out = proc do |dep|
next true if dep.build?

View File

@ -27,7 +27,7 @@ module OS
# rubocop:disable Naming/ConstantName
# rubocop:disable Style/MutableConstant
::MacOS = self
::MacOS = OS::Mac
# rubocop:enable Naming/ConstantName
# rubocop:enable Style/MutableConstant

View File

@ -74,7 +74,14 @@ module ELFShim
@with_interpreter = if binary_executable?
true
elsif dylib?
if which "readelf"
if HOMEBREW_PATCHELF_RB
begin
patchelf_patcher.interpreter.present?
rescue PatchELF::PatchError => e
opoo e unless e.to_s.start_with? "No interpreter found"
false
end
elsif which "readelf"
Utils.popen_read("readelf", "-l", to_path).include?(" INTERP ")
elsif which "file"
Utils.popen_read("file", "-L", "-b", to_path).include?(" interpreter ")
@ -89,7 +96,9 @@ module ELFShim
def dynamic_elf?
return @dynamic_elf if defined? @dynamic_elf
@dynamic_elf = if which "readelf"
@dynamic_elf = if HOMEBREW_PATCHELF_RB
patchelf_patcher.instance_variable_get(:@elf).segment_by_type(:DYNAMIC).present?
elsif which "readelf"
Utils.popen_read("readelf", "-l", to_path).include?(" DYNAMIC ")
elsif which "file"
!Utils.popen_read("file", "-L", "-b", to_path)[/dynamic|shared/].nil?
@ -127,7 +136,9 @@ module ELFShim
private
def needed_libraries(path)
if DevelopmentTools.locate "readelf"
if HOMEBREW_PATCHELF_RB
needed_libraries_using_patchelf_rb path
elsif DevelopmentTools.locate "readelf"
needed_libraries_using_readelf path
elsif DevelopmentTools.locate "patchelf"
needed_libraries_using_patchelf path
@ -138,6 +149,25 @@ module ELFShim
end
end
def needed_libraries_using_patchelf_rb(path)
patcher = path.patchelf_patcher
return [nil, []] unless patcher
soname = begin
patcher.soname
rescue PatchELF::PatchError => e
opoo e unless e.to_s.start_with? "Entry DT_SONAME not found, not a shared library?"
nil
end
needed = begin
patcher.needed
rescue PatchELF::PatchError => e
opoo e
[]
end
[soname, needed]
end
def needed_libraries_using_patchelf(path)
return [nil, []] unless path.dynamic_elf?
@ -172,6 +202,16 @@ module ELFShim
end
end
def patchelf_patcher
return unless HOMEBREW_PATCHELF_RB
@patchelf_patcher ||= begin
Homebrew.install_bundler_gems!
require "patchelf"
PatchELF::Patcher.new to_s, logging: false
end
end
def metadata
@metadata ||= Metadata.new(self)
end

View File

@ -1,5 +1,8 @@
# frozen_string_literal: true
# enables experimental readelf.rb, patchelf support.
HOMEBREW_PATCHELF_RB = ENV["HOMEBREW_PATCHELF_RB"].present?.freeze
module Homebrew
DEFAULT_PREFIX ||= if Homebrew::EnvConfig.force_homebrew_on_linux?
HOMEBREW_DEFAULT_PREFIX

View File

@ -12,7 +12,7 @@ module OS
# rubocop:disable Naming/ConstantName
# rubocop:disable Style/MutableConstant
::MacOS = self
::MacOS = OS::Mac
# rubocop:enable Naming/ConstantName
# rubocop:enable Style/MutableConstant
@ -21,7 +21,7 @@ module OS
# This can be compared to numerics, strings, or symbols
# using the standard Ruby Comparable methods.
def version
@version ||= Version.new(full_version.to_s[/10\.\d+/])
@version ||= Version.new(full_version.to_s[/^\d+\.\d+/])
end
# This can be compared to numerics, strings, or symbols

View File

@ -5,7 +5,7 @@ libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: expat
Version: 2.2.6
Version: 2.2.8
Description: expat XML parser
URL: http://www.libexpat.org
Libs: -L${libdir} -lexpat

View File

@ -0,0 +1,12 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: expat
Version: 2.2.8
Description: expat XML parser
URL: http://www.libexpat.org
Libs: -L${libdir} -lexpat
Cflags:

View File

@ -0,0 +1,40 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2001 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
###########################################################################
# This should most probably benefit from getting a "Requires:" field added
# dynamically by configure.
#
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
supported_protocols="DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP"
supported_features="AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO MultiSSL NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy"
Name: libcurl
URL: https://curl.haxx.se/
Description: Library to transfer files with ftp, http, etc.
Version: 7.64.1
Libs: -L${libdir} -lcurl
Libs.private: -lldap -lz
Cflags:

View File

@ -0,0 +1,12 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libedit
Description: command line editor library provides generic line editing, history, and tokenization functions.
Version: 3.0
Requires:
Libs: -L${libdir} -ledit
Cflags: -I${includedir}/editline

View File

@ -0,0 +1,13 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libexslt
Version: 0.8.17
Description: EXSLT Extension library
Requires: libxml-2.0
Libs: -L${libdir} -lexslt -lxslt -lxml2 -lz -lpthread -licucore -lm
Cflags:

View File

@ -0,0 +1,12 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
toolexeclibdir=${libdir}
includedir=${prefix}/include/ffi
Name: libffi
Description: Library supporting Foreign Function Interfaces
Version: 3.3-rc0
Libs: -L${toolexeclibdir} -lffi
Cflags: -I${includedir}

View File

@ -0,0 +1,14 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
modules=1
Name: libXML
Version: 2.9.4
Description: libXML library version2.
Requires:
Libs: -L${libdir} -lxml2
Libs.private: -lz -lpthread -licucore -lm
Cflags:

View File

@ -0,0 +1,13 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libxslt
Version: 1.1.29
Description: XSLT library version 2.
Requires: libxml-2.0
Libs: -L${libdir} -lxslt -lxml2 -lz -lpthread -licucore -lm
Cflags:

View File

@ -0,0 +1,14 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
major_version=5
version=5.7.20081102
Name: ncurses
Description: ncurses 5.7 library
Version: ${version}
Requires:
Libs: -L${libdir} -lncurses
Cflags:

View File

@ -0,0 +1,14 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
major_version=5
version=5.7.20081102
Name: ncursesw
Description: ncurses 5.7 library
Version: ${version}
Requires:
Libs: -L${libdir} -lncurses
Cflags:

View File

@ -0,0 +1,12 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: SQLite
Description: SQL database engine
Version: 3.31.1
Libs: -L${libdir} -lsqlite3
Libs.private:
Cflags:

View File

@ -0,0 +1,14 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
includedir=${prefix}/include/uuid
Name: uuid
Description: Universally unique id library
Version: 1.0
Requires:
Libs:
Cflags: -I${includedir}

View File

@ -0,0 +1,14 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
includedir=${prefix}/include
Name: zlib
Description: zlib compression library
Version: 1.2.11
Requires:
Libs: -L${libdir} -L${sharedlibdir} -lz
Cflags:

View File

@ -0,0 +1,12 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: expat
Version: 2.2.8
Description: expat XML parser
URL: http://www.libexpat.org
Libs: -L${libdir} -lexpat
Cflags:

View File

@ -0,0 +1,40 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2001 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
###########################################################################
# This should most probably benefit from getting a "Requires:" field added
# dynamically by configure.
#
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
supported_protocols="DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP"
supported_features="AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO MultiSSL NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy"
Name: libcurl
URL: https://curl.haxx.se/
Description: Library to transfer files with ftp, http, etc.
Version: 7.64.1
Libs: -L${libdir} -lcurl
Libs.private: -lldap -lz
Cflags:

View File

@ -0,0 +1,12 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libedit
Description: command line editor library provides generic line editing, history, and tokenization functions.
Version: 3.0
Requires:
Libs: -L${libdir} -ledit
Cflags: -I${includedir}/editline

View File

@ -0,0 +1,13 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libexslt
Version: 0.8.17
Description: EXSLT Extension library
Requires: libxml-2.0
Libs: -L${libdir} -lexslt -lxslt -lxml2 -lz -lpthread -licucore -lm
Cflags:

View File

@ -0,0 +1,12 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
toolexeclibdir=${libdir}
includedir=${prefix}/include/ffi
Name: libffi
Description: Library supporting Foreign Function Interfaces
Version: 3.3-rc0
Libs: -L${toolexeclibdir} -lffi
Cflags: -I${includedir}

View File

@ -0,0 +1,14 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
modules=1
Name: libXML
Version: 2.9.4
Description: libXML library version2.
Requires:
Libs: -L${libdir} -lxml2
Libs.private: -lz -lpthread -licucore -lm
Cflags:

View File

@ -0,0 +1,13 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libxslt
Version: 1.1.29
Description: XSLT library version 2.
Requires: libxml-2.0
Libs: -L${libdir} -lxslt -lxml2 -lz -lpthread -licucore -lm
Cflags:

View File

@ -0,0 +1,14 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
major_version=5
version=5.7.20081102
Name: ncurses
Description: ncurses 5.7 library
Version: ${version}
Requires:
Libs: -L${libdir} -lncurses
Cflags:

View File

@ -0,0 +1,14 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
major_version=5
version=5.7.20081102
Name: ncursesw
Description: ncurses 5.7 library
Version: ${version}
Requires:
Libs: -L${libdir} -lncurses
Cflags:

View File

@ -0,0 +1,12 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: SQLite
Description: SQL database engine
Version: 3.31.1
Libs: -L${libdir} -lsqlite3
Libs.private:
Cflags:

View File

@ -0,0 +1,14 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
includedir=${prefix}/include/uuid
Name: uuid
Description: Universally unique id library
Version: 1.0
Requires:
Libs:
Cflags: -I${includedir}

View File

@ -0,0 +1,14 @@
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
includedir=${prefix}/include
Name: zlib
Description: zlib compression library
Version: 1.2.11
Requires:
Libs: -L${libdir} -L${sharedlibdir} -lz
Cflags:

View File

@ -1,11 +1,13 @@
# frozen_string_literal: true
require "hardware"
require "version"
module OS
module Mac
class Version < ::Version
SYMBOLS = {
big_sur: Hardware::CPU.arm? ? "11.0" : "10.16",
catalina: "10.15",
mojave: "10.14",
high_sierra: "10.13",
@ -32,7 +34,7 @@ module OS
end
def to_sym
SYMBOLS.invert.fetch(@version) { :dunno }
SYMBOLS.invert.fetch(@version, :dunno)
end
def pretty_name

View File

@ -13,9 +13,10 @@ module OS
# CI systems have been updated.
# This may be a beta version for a beta macOS.
def latest_version
latest = "11.4.1"
latest_stable = "11.5"
case MacOS.version
when "10.15" then "11.4.1"
when "11.0", "10.16" then "12.0"
when "10.15" then latest_stable
when "10.14" then "11.3.1"
when "10.13" then "10.1"
when "10.12" then "9.2"
@ -26,7 +27,7 @@ module OS
raise "macOS '#{MacOS.version}' is invalid" unless OS::Mac.prerelease?
# Default to newest known version of Xcode for unreleased macOS versions.
latest
latest_stable
end
end
@ -36,6 +37,7 @@ module OS
# also in beta).
def minimum_version
case MacOS.version
when "11.0", "10.16" then "12.0"
when "10.15" then "11.0"
when "10.14" then "10.2"
when "10.13" then "9.0"
@ -173,9 +175,10 @@ module OS
# installed CLT version. This is useful as they are packaged
# simultaneously so workarounds need to apply to both based on their
# comparable version.
latest = "11.4.1"
latest_stable = "11.5"
case (DevelopmentTools.clang_version.to_f * 10).to_i
when 110 then latest
when 120 then "12.0"
when 110 then latest_stable
when 100 then "10.3"
when 91 then "9.4"
when 90 then "9.2"
@ -186,7 +189,7 @@ module OS
when 61 then "6.1"
when 60 then "6.0"
when 0 then "dunno"
else latest
else latest_stable
end
end
@ -250,6 +253,7 @@ module OS
# and our CI systems have been updated.
def latest_clang_version
case MacOS.version
when "11.0", "10.16" then "1200.0.22.7"
when "10.15" then "1103.0.32.59"
when "10.14" then "1001.0.46.4"
when "10.13" then "1000.10.44.2"
@ -265,6 +269,7 @@ module OS
# that macOS version.
def minimum_version
case MacOS.version
when "11.0", "10.16" then "12.0.0"
when "10.15" then "11.0.0"
when "10.14" then "10.0.0"
when "10.13" then "9.0.0"

View File

@ -2,9 +2,7 @@
module OS
module Mac
X11 = XQuartz = Module.new # rubocop:disable Style/MutableConstant
module XQuartz
X11 = XQuartz = Module.new do # rubocop:disable Style/MutableConstant
module_function
DEFAULT_BUNDLE_PATH = Pathname.new("Applications/Utilities/XQuartz.app").freeze

View File

@ -195,6 +195,34 @@ module RuboCop
end
end
class ShellCmd < FormulaCop
def audit_formula(_node, _class_node, _parent_class_node, body_node)
test = find_block(body_node, :test)
[:popen_read, :popen_write].each do |unsafe_command|
test_methods = []
unless test.nil?
find_instance_method_call(test, "Utils", unsafe_command) do |method|
test_methods << method.source_range
end
end
find_instance_method_call(body_node, "Utils", unsafe_command) do |method|
unless test_methods.include?(method.source_range)
problem "Use `Utils.safe_#{unsafe_command}` instead of `Utils.#{unsafe_command}`"
end
end
end
end
def autocorrect(node)
lambda do |corrector|
corrector.replace(node.loc.selector, "safe_#{node.method_name}")
end
end
end
class Miscellaneous < FormulaCop
def audit_formula(_node, _class_node, _parent_class_node, body_node)
# FileUtils is included in Formula

View File

@ -60,7 +60,7 @@ module RuboCop
end
find_method_with_args(body_node, :system, "cargo", "build") do
problem "use \"cargo\", \"install\", \"--root\", prefix, \"--path\", \".\""
problem "use \"cargo\", \"install\", *std_cargo_args"
end
end
end

View File

@ -137,8 +137,11 @@ fi
path="/Applications/Xcode.app/Contents/Developer/usr/bin/$SCM_FILE"
safe_exec "$path" "$@"
path="/usr/bin/$SCM_FILE"
[[ -z "$popup_stub" ]] && safe_exec "$path" "$@"
if [[ -z "$popup_stub" && "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101500" ]]
then
path="/usr/bin/$SCM_FILE"
safe_exec "$path" "$@"
fi
echo "You must: brew install $SCM_FILE" >&2
exit 1

View File

@ -188,8 +188,8 @@ class Cmd
when "-Xpreprocessor", "-Xclang"
# used for -Xpreprocessor -fopenmp
args << arg << enum.next
when /-mmacosx-version-min=10\.(\d+)/
arg = "-mmacosx-version-min=10.9" if high_sierra_or_later? && $1.to_i < 9
when /-mmacosx-version-min=(\d+)\.(\d+)/
arg = "-mmacosx-version-min=10.9" if high_sierra_or_later? && $1 == "10" && $2.to_i < 9
args << arg
when "--fast-math"
arg = "-ffast-math" if tool =~ /^clang/

View File

@ -1,5 +1,5 @@
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
# tapioca sync
# tapioca sync --exclude json
# typed: false

View File

@ -1,5 +1,5 @@
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
# tapioca sync
# tapioca sync --exclude json
# typed: true

View File

@ -1,87 +0,0 @@
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
# tapioca sync
# typed: true
class Class < ::Module
def json_creatable?; end
end
module JSON
private
def dump(obj, anIO = _, limit = _); end
def fast_generate(obj, opts = _); end
def fast_unparse(obj, opts = _); end
def generate(obj, opts = _); end
def load(source, proc = _, options = _); end
def parse(source, opts = _); end
def parse!(source, opts = _); end
def pretty_generate(obj, opts = _); end
def pretty_unparse(obj, opts = _); end
def recurse_proc(result, &proc); end
def restore(source, proc = _, options = _); end
def unparse(obj, opts = _); end
def self.[](object, opts = _); end
def self.create_id; end
def self.create_id=(_); end
def self.deep_const_get(path); end
def self.dump(obj, anIO = _, limit = _); end
def self.dump_default_options; end
def self.dump_default_options=(_); end
def self.fast_generate(obj, opts = _); end
def self.fast_unparse(obj, opts = _); end
def self.generate(obj, opts = _); end
def self.generator; end
def self.generator=(generator); end
def self.iconv(to, from, string); end
def self.load(source, proc = _, options = _); end
def self.load_default_options; end
def self.load_default_options=(_); end
def self.parse(source, opts = _); end
def self.parse!(source, opts = _); end
def self.parser; end
def self.parser=(parser); end
def self.pretty_generate(obj, opts = _); end
def self.pretty_unparse(obj, opts = _); end
def self.recurse_proc(result, &proc); end
def self.restore(source, proc = _, options = _); end
def self.state; end
def self.state=(_); end
def self.unparse(obj, opts = _); end
end
class JSON::GenericObject < ::OpenStruct
def as_json(*_); end
def to_hash; end
def to_json(*a); end
def |(other); end
def self.dump(obj, *args); end
def self.from_hash(object); end
def self.json_creatable=(_); end
def self.json_creatable?; end
def self.json_create(data); end
def self.load(source, proc = _, opts = _); end
end
class JSON::JSONError < ::StandardError
def self.wrap(exception); end
end
JSON::Parser = JSON::Ext::Parser
JSON::State = JSON::Ext::Generator::State
JSON::UnparserError = JSON::GeneratorError
module Kernel
private
def JSON(object, *args); end
def j(*objs); end
def jj(*objs); end
end

View File

@ -1,5 +1,5 @@
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
# tapioca sync
# tapioca sync --exclude json
# typed: true

View File

@ -1,5 +1,5 @@
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
# tapioca sync
# tapioca sync --exclude json
# typed: true
@ -53,7 +53,9 @@ class Parser::AST::Processor < ::AST::Processor
def on_empty_else(node); end
def on_ensure(node); end
def on_erange(node); end
def on_find_pattern(node); end
def on_for(node); end
def on_forward_arg(node); end
def on_gvar(node); end
def on_gvasgn(node); end
def on_hash(node); end
@ -217,9 +219,11 @@ class Parser::Builders::Default
def emit_file_line_as_literals; end
def emit_file_line_as_literals=(_); end
def false(false_t); end
def find_pattern(lbrack_t, elements, rbrack_t); end
def float(float_t); end
def for(for_t, iterator, in_t, iteratee, do_t, body, end_t); end
def forward_args(begin_t, dots_t, end_t); end
def forward_arg(dots_t); end
def forward_only_args(begin_t, dots_t, end_t); end
def forwarded_args(dots_t); end
def gvar(token); end
def hash_pattern(lbrace_t, kwargs, rbrace_t); end
@ -366,6 +370,8 @@ class Parser::Builders::Default
def self.emit_arg_inside_procarg0=(_); end
def self.emit_encoding; end
def self.emit_encoding=(_); end
def self.emit_forward_arg; end
def self.emit_forward_arg=(_); end
def self.emit_index; end
def self.emit_index=(_); end
def self.emit_lambda; end
@ -1024,8 +1030,11 @@ class Parser::Source::TreeRewriter
def initialize(source_buffer, crossing_deletions: _, different_replacements: _, swallowed_insertions: _); end
def as_nested_actions; end
def as_replacements; end
def diagnostics; end
def empty?; end
def import!(foreign_rewriter, offset: _); end
def in_transaction?; end
def insert_after(range, content); end
def insert_after_multi(range, text); end
@ -1059,10 +1068,13 @@ class Parser::Source::TreeRewriter::Action
def initialize(range, enforcer, insert_before: _, replacement: _, insert_after: _, children: _); end
def combine(action); end
def contract; end
def empty?; end
def insert_after; end
def insert_before; end
def insertion?; end
def moved(source_buffer, offset); end
def nested_actions; end
def ordered_replacements; end
def range; end
def replacement; end

View File

@ -1,5 +1,5 @@
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
# tapioca sync
# tapioca sync --exclude json
# typed: true
@ -3415,6 +3415,19 @@ end
RuboCop::Cop::Lint::CircularArgumentReference::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Lint::ConstantResolution < ::RuboCop::Cop::Cop
def on_const(node); end
def unqualified_const?(node = _); end
private
def allowed_names; end
def const_name?(name); end
def ignored_names; end
end
RuboCop::Cop::Lint::ConstantResolution::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Lint::Debugger < ::RuboCop::Cop::Cop
def binding_irb_call?(node = _); end
def debugger_call?(node = _); end
@ -4004,6 +4017,7 @@ end
RuboCop::Cop::Lint::PercentSymbolArray::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Lint::RaiseException < ::RuboCop::Cop::Cop
def autocorrect(node); end
def exception?(node = _); end
def exception_new_with_message?(node = _); end
def on_send(node); end
@ -4170,6 +4184,7 @@ RuboCop::Cop::Lint::RedundantWithObject::MSG_EACH_WITH_OBJECT = T.let(T.unsafe(n
RuboCop::Cop::Lint::RedundantWithObject::MSG_WITH_OBJECT = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Lint::RegexpAsCondition < ::RuboCop::Cop::Cop
def autocorrect(node); end
def on_match_current_line(node); end
end
@ -4762,11 +4777,14 @@ class RuboCop::Cop::Metrics::CyclomaticComplexity < ::RuboCop::Cop::Cop
include(::RuboCop::Cop::ConfigurableMax)
include(::RuboCop::Cop::IgnoredMethods)
include(::RuboCop::Cop::MethodComplexity)
include(::RuboCop::Cop::Metrics::Utils::IteratingBlock)
private
def complexity_score_for(_node); end
def block_method(node); end
def complexity_score_for(node); end
def count_block?(block); end
end
RuboCop::Cop::Metrics::CyclomaticComplexity::COUNTED_NODES = T.let(T.unsafe(nil), Array)
@ -4857,6 +4875,14 @@ RuboCop::Cop::Metrics::Utils::AbcSizeCalculator::BRANCH_NODES = T.let(T.unsafe(n
RuboCop::Cop::Metrics::Utils::AbcSizeCalculator::CONDITION_NODES = T.let(T.unsafe(nil), Array)
module RuboCop::Cop::Metrics::Utils::IteratingBlock
def block_method_name(node); end
def iterating_block?(node); end
def iterating_method?(name); end
end
RuboCop::Cop::Metrics::Utils::IteratingBlock::KNOWN_ITERATING_METHODS = T.let(T.unsafe(nil), Set)
module RuboCop::Cop::Migration
end
@ -5478,6 +5504,9 @@ module RuboCop::Cop::RegexpLiteralHelp
private
def freespace_mode_regexp?(node); end
def pattern_source(node); end
def replace_match_with_spaces(source, pattern); end
def source_with_comments_and_interpolations_blanked(child, freespace_mode); end
end
class RuboCop::Cop::Registry
@ -7376,6 +7405,7 @@ end
RuboCop::Cop::Style::MultilineMethodSignature::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Style::MultilineTernaryOperator < ::RuboCop::Cop::Cop
def autocorrect(node); end
def on_if(node); end
end
@ -7509,7 +7539,13 @@ end
RuboCop::Cop::Style::NestedParenthesizedCalls::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Style::NestedTernaryOperator < ::RuboCop::Cop::Cop
def autocorrect(node); end
def on_if(node); end
private
def if_node(node); end
def remove_parentheses(source); end
end
RuboCop::Cop::Style::NestedTernaryOperator::MSG = T.let(T.unsafe(nil), String)
@ -8056,6 +8092,26 @@ RuboCop::Cop::Style::RedundantException::MSG_1 = T.let(T.unsafe(nil), String)
RuboCop::Cop::Style::RedundantException::MSG_2 = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Style::RedundantFetchBlock < ::RuboCop::Cop::Cop
include(::RuboCop::Cop::FrozenStringLiteral)
include(::RuboCop::Cop::RangeHelp)
def autocorrect(node); end
def on_block(node); end
def redundant_fetch_block_candidate?(node = _); end
private
def basic_literal?(node); end
def build_bad_method(send, body); end
def build_good_method(send, body); end
def check_for_constant?; end
def check_for_string?; end
def fetch_range(send, node); end
end
RuboCop::Cop::Style::RedundantFetchBlock::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Style::RedundantFreeze < ::RuboCop::Cop::Cop
include(::RuboCop::Cop::FrozenStringLiteral)
@ -8201,10 +8257,9 @@ class RuboCop::Cop::Style::RedundantRegexpEscape < ::RuboCop::Cop::Cop
private
def allowed_escape?(node, char, within_character_class); end
def delimiter?(node, char); end
def each_escape(node); end
def escape_range_at_index(node, index); end
def pattern_source(node); end
def slash_literal?(node); end
end
RuboCop::Cop::Style::RedundantRegexpEscape::ALLOWED_ALWAYS_ESCAPES = T.let(T.unsafe(nil), Array)
@ -8266,7 +8321,6 @@ class RuboCop::Cop::Style::RedundantSelf < ::RuboCop::Cop::Cop
def add_scope(node, local_variables = _); end
def allow_self(node); end
def allowed_send_node?(node); end
def keyword?(method_name); end
def on_argument(node); end
def regular_method_call?(node); end
@ -8275,6 +8329,8 @@ end
RuboCop::Cop::Style::RedundantSelf::KERNEL_METHODS = T.let(T.unsafe(nil), Array)
RuboCop::Cop::Style::RedundantSelf::KEYWORDS = T.let(T.unsafe(nil), Array)
RuboCop::Cop::Style::RedundantSelf::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Style::RedundantSort < ::RuboCop::Cop::Cop
@ -8699,8 +8755,15 @@ end
RuboCop::Cop::Style::Strip::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Style::StructInheritance < ::RuboCop::Cop::Cop
include(::RuboCop::Cop::RangeHelp)
def autocorrect(node); end
def on_class(node); end
def struct_constructor?(node = _); end
private
def correct_parent(parent, corrector); end
end
RuboCop::Cop::Style::StructInheritance::MSG = T.let(T.unsafe(nil), String)
@ -9066,6 +9129,7 @@ class RuboCop::Cop::Style::YodaCondition < ::RuboCop::Cop::Cop
def corrected_code(node); end
def enforce_yoda?; end
def equality_only?; end
def interpolation?(node); end
def message(node); end
def non_equality_operator?(node); end
def noncommutative_operator?(node); end

File diff suppressed because it is too large Load Diff

View File

@ -5854,6 +5854,8 @@ class Class
def any_instance(); end
def class_attribute(*attrs, instance_accessor: T.unsafe(nil), instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_predicate: T.unsafe(nil), default: T.unsafe(nil)); end
def json_creatable?(); end
end
module CodeRay
@ -10311,6 +10313,12 @@ class JSON::Ext::Parser
def initialize(*_); end
end
JSON::Parser = JSON::Ext::Parser
JSON::State = JSON::Ext::Generator::State
JSON::UnparserError = JSON::GeneratorError
class JavaRequirement::CaskSuggestion
def self.[](*_); end
@ -13380,6 +13388,7 @@ class Object
HOMEBREW_DEFAULT_TEMP = ::T.let(nil, ::T.untyped)
HOMEBREW_HELP = ::T.let(nil, ::T.untyped)
HOMEBREW_LIBRARY_PATH = ::T.let(nil, ::T.untyped)
HOMEBREW_PATCHELF_RB = ::T.let(nil, ::T.untyped)
HOMEBREW_TAP_CASK_REGEX = ::T.let(nil, ::T.untyped)
HOMEBREW_TAP_FORMULA_REGEX = ::T.let(nil, ::T.untyped)
OFFICIAL_CASK_TAPS = ::T.let(nil, ::T.untyped)
@ -13864,15 +13873,15 @@ class Parser::Ruby24
def _reduce_332(val, _values, result); end
def _reduce_336(val, _values, result); end
def _reduce_333(val, _values, result); end
def _reduce_337(val, _values, result); end
def _reduce_34(val, _values, result); end
def _reduce_340(val, _values, result); end
def _reduce_341(val, _values, result); end
def _reduce_342(val, _values, result); end
def _reduce_345(val, _values, result); end
def _reduce_343(val, _values, result); end
def _reduce_346(val, _values, result); end
@ -13880,9 +13889,9 @@ class Parser::Ruby24
def _reduce_348(val, _values, result); end
def _reduce_35(val, _values, result); end
def _reduce_349(val, _values, result); end
def _reduce_350(val, _values, result); end
def _reduce_35(val, _values, result); end
def _reduce_351(val, _values, result); end
@ -13922,9 +13931,9 @@ class Parser::Ruby24
def _reduce_368(val, _values, result); end
def _reduce_37(val, _values, result); end
def _reduce_369(val, _values, result); end
def _reduce_370(val, _values, result); end
def _reduce_37(val, _values, result); end
def _reduce_371(val, _values, result); end
@ -13940,7 +13949,7 @@ class Parser::Ruby24
def _reduce_377(val, _values, result); end
def _reduce_379(val, _values, result); end
def _reduce_378(val, _values, result); end
def _reduce_38(val, _values, result); end
@ -13962,9 +13971,9 @@ class Parser::Ruby24
def _reduce_388(val, _values, result); end
def _reduce_39(val, _values, result); end
def _reduce_389(val, _values, result); end
def _reduce_390(val, _values, result); end
def _reduce_39(val, _values, result); end
def _reduce_391(val, _values, result); end
@ -14040,19 +14049,19 @@ class Parser::Ruby24
def _reduce_424(val, _values, result); end
def _reduce_426(val, _values, result); end
def _reduce_425(val, _values, result); end
def _reduce_427(val, _values, result); end
def _reduce_428(val, _values, result); end
def _reduce_429(val, _values, result); end
def _reduce_43(val, _values, result); end
def _reduce_431(val, _values, result); end
def _reduce_432(val, _values, result); end
def _reduce_433(val, _values, result); end
def _reduce_438(val, _values, result); end
def _reduce_434(val, _values, result); end
def _reduce_439(val, _values, result); end
@ -14126,7 +14135,7 @@ class Parser::Ruby24
def _reduce_472(val, _values, result); end
def _reduce_474(val, _values, result); end
def _reduce_473(val, _values, result); end
def _reduce_475(val, _values, result); end
@ -14246,7 +14255,7 @@ class Parser::Ruby24
def _reduce_530(val, _values, result); end
def _reduce_532(val, _values, result); end
def _reduce_531(val, _values, result); end
def _reduce_533(val, _values, result); end
@ -14276,7 +14285,7 @@ class Parser::Ruby24
def _reduce_546(val, _values, result); end
def _reduce_549(val, _values, result); end
def _reduce_547(val, _values, result); end
def _reduce_55(val, _values, result); end
@ -14294,25 +14303,25 @@ class Parser::Ruby24
def _reduce_556(val, _values, result); end
def _reduce_559(val, _values, result); end
def _reduce_557(val, _values, result); end
def _reduce_56(val, _values, result); end
def _reduce_560(val, _values, result); end
def _reduce_563(val, _values, result); end
def _reduce_561(val, _values, result); end
def _reduce_564(val, _values, result); end
def _reduce_565(val, _values, result); end
def _reduce_567(val, _values, result); end
def _reduce_566(val, _values, result); end
def _reduce_568(val, _values, result); end
def _reduce_57(val, _values, result); end
def _reduce_569(val, _values, result); end
def _reduce_570(val, _values, result); end
def _reduce_57(val, _values, result); end
def _reduce_571(val, _values, result); end
@ -14324,23 +14333,25 @@ class Parser::Ruby24
def _reduce_575(val, _values, result); end
def _reduce_588(val, _values, result); end
def _reduce_576(val, _values, result); end
def _reduce_589(val, _values, result); end
def _reduce_59(val, _values, result); end
def _reduce_594(val, _values, result); end
def _reduce_590(val, _values, result); end
def _reduce_595(val, _values, result); end
def _reduce_599(val, _values, result); end
def _reduce_596(val, _values, result); end
def _reduce_6(val, _values, result); end
def _reduce_60(val, _values, result); end
def _reduce_603(val, _values, result); end
def _reduce_600(val, _values, result); end
def _reduce_604(val, _values, result); end
def _reduce_61(val, _values, result); end
@ -14742,15 +14753,15 @@ class Parser::Ruby26
def _reduce_334(val, _values, result); end
def _reduce_336(val, _values, result); end
def _reduce_335(val, _values, result); end
def _reduce_339(val, _values, result); end
def _reduce_337(val, _values, result); end
def _reduce_343(val, _values, result); end
def _reduce_340(val, _values, result); end
def _reduce_345(val, _values, result); end
def _reduce_344(val, _values, result); end
def _reduce_348(val, _values, result); end
def _reduce_346(val, _values, result); end
def _reduce_349(val, _values, result); end
@ -14760,7 +14771,7 @@ class Parser::Ruby26
def _reduce_351(val, _values, result); end
def _reduce_353(val, _values, result); end
def _reduce_352(val, _values, result); end
def _reduce_354(val, _values, result); end
@ -14802,7 +14813,7 @@ class Parser::Ruby26
def _reduce_371(val, _values, result); end
def _reduce_373(val, _values, result); end
def _reduce_372(val, _values, result); end
def _reduce_374(val, _values, result); end
@ -14820,7 +14831,7 @@ class Parser::Ruby26
def _reduce_380(val, _values, result); end
def _reduce_382(val, _values, result); end
def _reduce_381(val, _values, result); end
def _reduce_383(val, _values, result); end
@ -14842,7 +14853,7 @@ class Parser::Ruby26
def _reduce_391(val, _values, result); end
def _reduce_393(val, _values, result); end
def _reduce_392(val, _values, result); end
def _reduce_394(val, _values, result); end
@ -14920,20 +14931,20 @@ class Parser::Ruby26
def _reduce_427(val, _values, result); end
def _reduce_429(val, _values, result); end
def _reduce_428(val, _values, result); end
def _reduce_430(val, _values, result); end
def _reduce_431(val, _values, result); end
def _reduce_434(val, _values, result); end
def _reduce_432(val, _values, result); end
def _reduce_436(val, _values, result); end
def _reduce_435(val, _values, result); end
def _reduce_437(val, _values, result); end
def _reduce_44(val, _values, result); end
def _reduce_441(val, _values, result); end
def _reduce_442(val, _values, result); end
def _reduce_443(val, _values, result); end
@ -15004,7 +15015,7 @@ class Parser::Ruby26
def _reduce_475(val, _values, result); end
def _reduce_477(val, _values, result); end
def _reduce_476(val, _values, result); end
def _reduce_478(val, _values, result); end
@ -15128,7 +15139,7 @@ class Parser::Ruby26
def _reduce_533(val, _values, result); end
def _reduce_535(val, _values, result); end
def _reduce_534(val, _values, result); end
def _reduce_536(val, _values, result); end
@ -15160,7 +15171,7 @@ class Parser::Ruby26
def _reduce_549(val, _values, result); end
def _reduce_552(val, _values, result); end
def _reduce_550(val, _values, result); end
def _reduce_553(val, _values, result); end
@ -15176,21 +15187,21 @@ class Parser::Ruby26
def _reduce_559(val, _values, result); end
def _reduce_562(val, _values, result); end
def _reduce_560(val, _values, result); end
def _reduce_563(val, _values, result); end
def _reduce_566(val, _values, result); end
def _reduce_564(val, _values, result); end
def _reduce_567(val, _values, result); end
def _reduce_568(val, _values, result); end
def _reduce_570(val, _values, result); end
def _reduce_569(val, _values, result); end
def _reduce_571(val, _values, result); end
def _reduce_573(val, _values, result); end
def _reduce_572(val, _values, result); end
def _reduce_574(val, _values, result); end
@ -15202,25 +15213,27 @@ class Parser::Ruby26
def _reduce_578(val, _values, result); end
def _reduce_579(val, _values, result); end
def _reduce_58(val, _values, result); end
def _reduce_59(val, _values, result); end
def _reduce_591(val, _values, result); end
def _reduce_592(val, _values, result); end
def _reduce_597(val, _values, result); end
def _reduce_593(val, _values, result); end
def _reduce_598(val, _values, result); end
def _reduce_599(val, _values, result); end
def _reduce_6(val, _values, result); end
def _reduce_60(val, _values, result); end
def _reduce_602(val, _values, result); end
def _reduce_603(val, _values, result); end
def _reduce_606(val, _values, result); end
def _reduce_607(val, _values, result); end
def _reduce_62(val, _values, result); end
@ -19416,6 +19429,10 @@ class RuboCop::AST::Node
def cask_block?(node=T.unsafe(nil)); end
def find_pattern_type?(); end
def forward_arg_type?(); end
def key_node(node=T.unsafe(nil)); end
def method_node(node=T.unsafe(nil)); end
@ -24431,8 +24448,6 @@ module Tins::SexySingleton
def dup(); end
end
Tins::SexySingleton::SingletonClassMethods = Singleton::SingletonClassMethods
module Tins::SexySingleton
def self.__init__(klass); end

View File

@ -3,14 +3,10 @@
# typed: strong
module DependencyCollector::Compat; end
module ELFShim::Metadata::PatchELF::PatchError; end
module ELFShim::PatchELF::PatchError; end
module ELFShim::PatchELF::Patcher; end
module Homebrew::Error; end
module MacOS::CLT; end
module MacOS::CLT::PKG_PATH; end
module MacOS::Version; end
module MacOS::Version::SYMBOLS; end
module MacOS::X11; end
module MacOS::XQuartz; end
module MacOS::Xcode; end
module OS::Mac::Version::NULL; end
module T::CompatibilityPatches::RSpecCompatibility::MethodDoubleExtensions; end
module T::CompatibilityPatches::RSpecCompatibility::RecorderExtensions; end

View File

@ -286,6 +286,7 @@ class Tap
config["forceautoupdate"] = force_auto_update unless force_auto_update.nil?
Commands.rebuild_commands_completion_list
link_completions_and_manpages
formatted_contents = contents.presence&.to_sentence&.dup&.prepend(" ")
@ -334,6 +335,8 @@ class Tap
path.rmtree
path.parent.rmdir_if_possible
puts "Untapped#{formatted_contents} (#{abv})."
Commands.rebuild_commands_completion_list
clear_cache
end

View File

@ -13,4 +13,23 @@ describe "brew --cache", :integration_test do
.and not_to_output.to_stderr
.and be_a_success
end
it "prints the cache files for a given Cask" do
expect { brew "--cache", cask_path("local-caffeine") }
.to output(%r{#{HOMEBREW_CACHE}/downloads/[\da-f]{64}--caffeine\.zip}).to_stdout
.and not_to_output.to_stderr
.and be_a_success
end
it "prints the cache files for a given Formula and Cask" do
expect { brew "--cache", testball, cask_path("local-caffeine") }
.to output(
%r{
#{HOMEBREW_CACHE}/downloads/[\da-f]{64}--testball-.*\n
#{HOMEBREW_CACHE}/downloads/[\da-f]{64}--caffeine\.zip
}x,
).to_stdout
.and not_to_output.to_stderr
.and be_a_success
end
end

View File

@ -1,17 +1,46 @@
# frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "support/lib/config"
describe "Homebrew.home_args" do
it_behaves_like "parseable arguments"
end
describe "brew home", :integration_test do
let(:testballhome_homepage) {
Formula["testballhome"].homepage
}
let(:local_caffeine_path) {
cask_path("local-caffeine")
}
let(:local_caffeine_homepage) {
Cask::CaskLoader.load(local_caffeine_path).homepage
}
it "opens the homepage for a given Formula" do
setup_test_formula "testballhome"
expect { brew "home", "testballhome", "HOMEBREW_BROWSER" => "echo" }
.to output("#{Formula["testballhome"].homepage}\n").to_stdout
.to output(/#{testballhome_homepage}/).to_stdout
.and not_to_output.to_stderr
.and be_a_success
end
it "opens the homepage for a given Cask" do
expect { brew "home", cask_path("local-caffeine"), "HOMEBREW_BROWSER" => "echo" }
.to output(/#{local_caffeine_homepage}/).to_stdout
.and not_to_output.to_stderr
.and be_a_success
end
it "opens the homepages for a given formula and Cask" do
setup_test_formula "testballhome"
expect { brew "home", "testballhome", cask_path("local-caffeine"), "HOMEBREW_BROWSER" => "echo" }
.to output(/#{testballhome_homepage} #{local_caffeine_homepage}/).to_stdout
.and not_to_output.to_stderr
.and be_a_success
end

View File

@ -29,6 +29,7 @@ describe Hardware::CPU do
:core2,
:dothan,
:haswell,
:icelake,
:ivybridge,
:kabylake,
:merom,

View File

@ -1,5 +1,6 @@
# frozen_string_literal: true
require "test/support/fixtures/testball"
require "formula"
describe Formula do
@ -101,4 +102,12 @@ describe Formula do
expect(f.resources.first.url).to eq("on_linux")
end
end
describe "#shared_library" do
it "generates a shared library string" do
f = Testball.new
expect(f.shared_library("foobar")).to eq("foobar.so")
expect(f.shared_library("foobar", 2)).to eq("foobar.so.2")
end
end
end

View File

@ -1,5 +1,6 @@
# frozen_string_literal: true
require "test/support/fixtures/testball"
require "formula"
describe Formula do
@ -108,4 +109,12 @@ describe Formula do
expect(f.resources.first.url).to eq("resource_macos")
end
end
describe "#shared_library" do
it "generates a shared library string" do
f = Testball.new
expect(f.shared_library("foobar")).to eq("foobar.dylib")
expect(f.shared_library("foobar", 2)).to eq("foobar.2.dylib")
end
end
end

View File

@ -345,6 +345,101 @@ describe RuboCop::Cop::FormulaAudit::MpiCheck do
end
end
describe RuboCop::Cop::FormulaAudit::ShellCmd do
subject(:cop) { described_class.new }
context "When auditing shell commands" do
it "Utils.popen_read should become Utils.safe_popen_read" do
expect_offense(<<~RUBY)
class Foo < Formula
def install
Utils.popen_read "foo"
^^^^^^^^^^^^^^^^^^^^^^ Use `Utils.safe_popen_read` instead of `Utils.popen_read`
end
end
RUBY
end
it "Utils.safe_popen_write should become Utils.popen_write" do
expect_offense(<<~RUBY)
class Foo < Formula
def install
Utils.popen_write "foo"
^^^^^^^^^^^^^^^^^^^^^^^ Use `Utils.safe_popen_write` instead of `Utils.popen_write`
end
end
RUBY
end
it "does not correct Utils.popen_read in test block" do
expect_no_offenses(<<~RUBY)
class Foo < Formula
def install; end
test do
Utils.popen_read "foo"
end
end
RUBY
end
it "corrects Utils.popen_read to Utils.safe_popen_read" do
source = <<~RUBY
class Foo < Formula
def install
Utils.popen_read "foo"
end
end
RUBY
corrected_source = <<~RUBY
class Foo < Formula
def install
Utils.safe_popen_read "foo"
end
end
RUBY
new_source = autocorrect_source(source)
expect(new_source).to eq(corrected_source)
end
it "corrects Utils.popen_write to Utils.safe_popen_write" do
source = <<~RUBY
class Foo < Formula
def install
Utils.popen_write "foo"
end
end
RUBY
corrected_source = <<~RUBY
class Foo < Formula
def install
Utils.safe_popen_write "foo"
end
end
RUBY
new_source = autocorrect_source(source)
expect(new_source).to eq(corrected_source)
end
it "does not correct to Utils.safe_popen_read in test block" do
source = <<~RUBY
class Foo < Formula
def install; end
test do
Utils.popen_write "foo"
end
end
RUBY
new_source = autocorrect_source(source)
expect(new_source).to eq(source)
end
end
end
describe RuboCop::Cop::FormulaAudit::Miscellaneous do
subject(:cop) { described_class.new }

View File

@ -210,7 +210,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install
system "cargo", "build"
^^^^^^^^^^^^^^^^^^^^^^^ use \"cargo\", \"install\", \"--root\", prefix, \"--path\", \".\"
^^^^^^^^^^^^^^^^^^^^^^^ use \"cargo\", \"install\", *std_cargo_args
end
end
RUBY

View File

@ -129,6 +129,8 @@ RSpec.configure do |config|
end
config.before(:each, :needs_svn) do
skip "subversion not installed." unless quiet_system "#{HOMEBREW_SHIMS_PATH}/scm/svn", "--version"
svn_paths = PATH.new(ENV["PATH"])
if OS.mac?
xcrun_svn = Utils.popen_read("xcrun", "-f", "svn")

View File

@ -0,0 +1 @@
testball_bottle-0.1.yosemite.bottle.tar.gz

View File

@ -0,0 +1 @@
testball_bottle-0.1.yosemite.bottle.tar.gz

View File

@ -7,7 +7,7 @@ cask "with-depends-on-macos-comparison" do
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
homepage "https://brew.sh/with-depends-on-macos-comparison"
depends_on macos: ">= :catalina"
depends_on macos: ">= :yosemite"
app "Caffeine.app"
end

View File

@ -9,7 +9,7 @@ describe Utils do
end
it "returns svn version if svn available" do
if File.executable? "/usr/bin/svn"
if quiet_system "#{HOMEBREW_SHIMS_PATH}/scm/svn", "--version"
expect(described_class).to be_svn_available
else
expect(described_class).not_to be_svn_available

View File

@ -70,7 +70,6 @@ If there's no Homebrew Portable Ruby available for your processor:
fi
done
IFS=$' \t\n' # Restore IFS to its default value
[[ -z $HOMEBREW_RUBY_PATH ]] && onoe "Failed to find usable Ruby $required_ruby_version!"
fi
if [[ -n "$HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH" ]]

View File

@ -9,7 +9,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.14.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.7/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.3.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.0.3.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.0.3.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.1/lib"
$:.unshift "#{path}/"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/byebug-11.1.3"
@ -44,9 +44,9 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ntlm-http-0.1.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/webrobots-0.1.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mechanize-2.7.6/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mustache-1.1.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.19.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.19.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-3.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.7.1.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.7.1.4/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/rdiscount-2.2.0.1"
@ -65,7 +65,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-0.0.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.7.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.85.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.86.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.6.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.40.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib"

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