Merge branch 'Homebrew:master' into mohammad

This commit is contained in:
Mohammad Zain Abbas 2022-09-25 03:09:36 +02:00 committed by GitHub
commit 42d8c852ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
164 changed files with 262 additions and 69 deletions

View File

@ -269,7 +269,7 @@ jobs:
env: env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
with: with:
files: Library/Homebrew/test/coverage/coverage.xml files: Library/Homebrew/test/coverage/coverage.xml
@ -370,6 +370,6 @@ jobs:
- run: brew test-bot --only-formulae --test-default-formula - run: brew test-bot --only-formulae --test-default-formula
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
with: with:
files: Library/Homebrew/test/coverage/coverage.xml files: Library/Homebrew/test/coverage/coverage.xml

View File

@ -29,15 +29,14 @@ jobs:
contains(github.event.pull_request.labels.*.name, 'stale') contains(github.event.pull_request.labels.*.name, 'stale')
) )
) )
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- name: Mark/Close Stale Issues and Pull Requests - name: Mark/Close Stale Issues and Pull Requests
uses: actions/stale@v5 uses: actions/stale@v6
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 21 days-before-stale: 21
days-before-close: 7 days-before-close: 7
close-issue-reason: "not_planned"
stale-issue-message: > stale-issue-message: >
This issue has been automatically marked as stale because it has not had This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. recent activity. It will be closed if no further activity occurs.
@ -55,10 +54,10 @@ jobs:
contains(github.event.pull_request.labels.*.name, 'stale') contains(github.event.pull_request.labels.*.name, 'stale')
) )
) )
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- name: Mark/Close Stale `bump-formula-pr` and `bump-cask-pr` Pull Requests - name: Mark/Close Stale `bump-formula-pr` and `bump-cask-pr` Pull Requests
uses: actions/stale@v5 uses: actions/stale@v6
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 2 days-before-stale: 2
@ -72,7 +71,7 @@ jobs:
lock-threads: lock-threads:
if: startsWith(github.repository, 'Homebrew/') && github.event_name != 'issue_comment' if: startsWith(github.repository, 'Homebrew/') && github.event_name != 'issue_comment'
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- name: Lock Outdated Threads - name: Lock Outdated Threads
uses: dessant/lock-threads@e460dfeb36e731f3aeb214be6b0c9a9d9a67eda6 uses: dessant/lock-threads@e460dfeb36e731f3aeb214be6b0c9a9d9a67eda6

View File

@ -18,7 +18,7 @@ GEM
commander (4.6.0) commander (4.6.0)
highline (~> 2.0.0) highline (~> 2.0.0)
concurrent-ruby (1.1.10) concurrent-ruby (1.1.10)
connection_pool (2.2.5) connection_pool (2.3.0)
did_you_mean (1.6.1) did_you_mean (1.6.1)
diff-lcs (1.5.0) diff-lcs (1.5.0)
docile (1.4.0) docile (1.4.0)
@ -139,7 +139,7 @@ GEM
rubocop-performance (1.15.0) rubocop-performance (1.15.0)
rubocop (>= 1.7.0, < 2.0) rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0) rubocop-ast (>= 0.4.0)
rubocop-rails (2.16.0) rubocop-rails (2.16.1)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0) rubocop (>= 1.33.0, < 2.0)

View File

@ -716,7 +716,7 @@ module Cask
return unless cask.homepage return unless cask.homepage
validate_url_for_https_availability(cask.homepage, "homepage URL", cask.token, cask.tap, validate_url_for_https_availability(cask.homepage, SharedAudits::URL_TYPE_HOMEPAGE, cask.token, cask.tap,
user_agents: [:browser, :default], user_agents: [:browser, :default],
check_content: true, check_content: true,
strict: strict?) strict: strict?)
@ -793,6 +793,9 @@ module Cask
else else
host_uri.host host_uri.host
end end
return false if homepage.blank?
home = homepage.downcase home = homepage.downcase
if (split_host = host.split(".")).length >= 3 if (split_host = host.split(".")).length >= 3
host = split_host[-2..].join(".") host = split_host[-2..].join(".")

View File

@ -318,6 +318,10 @@ module Homebrew
"outdated.", "outdated.",
boolean: true, boolean: true,
}, },
HOMEBREW_PIP_INDEX_URL: {
description: "If set, `brew install <formula>` will use this URL to download PyPI package resources.",
default_text: "`https://pypi.org/simple`.",
},
HOMEBREW_PRY: { HOMEBREW_PRY: {
description: "If set, use Pry for the `brew irb` command.", description: "If set, use Pry for the `brew irb` command.",
boolean: true, boolean: true,

View File

@ -57,7 +57,14 @@ module Stdenv
# Os is the default Apple uses for all its stuff so let's trust them # Os is the default Apple uses for all its stuff so let's trust them
define_cflags "-Os #{SAFE_CFLAGS_FLAGS}" define_cflags "-Os #{SAFE_CFLAGS_FLAGS}"
send(compiler) begin
send(compiler)
rescue CompilerSelectionError
# We don't care if our compiler fails to build the formula during `brew test`.
raise unless testing_formula
send(DevelopmentTools.default_compiler)
end
return unless cc&.match?(GNU_GCC_REGEXP) return unless cc&.match?(GNU_GCC_REGEXP)

View File

@ -4,6 +4,6 @@
class CompilerSelector class CompilerSelector
sig { returns(String) } sig { returns(String) }
def self.preferred_gcc def self.preferred_gcc
OS::LINUX_PREFERRED_GCC_FORMULA OS::LINUX_PREFERRED_GCC_COMPILER_FORMULA
end end
end end

View File

@ -34,7 +34,7 @@ class DependencyCollector
private private
GLIBC = "glibc" GLIBC = "glibc"
GCC = CompilerSelector.preferred_gcc.freeze GCC = OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA
sig { void } sig { void }
def init_global_dep_tree_if_needed! def init_global_dep_tree_if_needed!

View File

@ -8,10 +8,15 @@ class DevelopmentTools
sig { params(tool: String).returns(T.nilable(Pathname)) } sig { params(tool: String).returns(T.nilable(Pathname)) }
def locate(tool) def locate(tool)
(@locate ||= {}).fetch(tool) do |key| (@locate ||= {}).fetch(tool) do |key|
@locate[key] = if (path = HOMEBREW_PREFIX/"bin/#{tool}").executable? @locate[key] = if build_system_too_old? &&
path (binutils_path = HOMEBREW_PREFIX/"opt/binutils/bin/#{tool}").executable?
elsif File.executable?(path = "/usr/bin/#{tool}") binutils_path
Pathname.new path elsif build_system_too_old? && (glibc_path = HOMEBREW_PREFIX/"opt/glibc/bin/#{tool}").executable?
glibc_path
elsif (homebrew_path = HOMEBREW_PREFIX/"bin/#{tool}").executable?
homebrew_path
elsif File.executable?(system_path = "/usr/bin/#{tool}")
Pathname.new system_path
end end
end end
end end
@ -30,7 +35,10 @@ class DevelopmentTools
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def system_gcc_too_old? def system_gcc_too_old?
gcc_version("gcc") < OS::LINUX_GCC_CI_VERSION gcc = "/usr/bin/gcc"
return true unless File.exist?(gcc)
gcc_version(gcc) < OS::LINUX_GCC_CI_VERSION
end end
sig { returns(T::Hash[String, T.nilable(String)]) } sig { returns(T::Hash[String, T.nilable(String)]) }

View File

@ -33,6 +33,7 @@ class Formula
dependency_collector = spec.dependency_collector dependency_collector = spec.dependency_collector
related_formula_names = Set.new([ related_formula_names = Set.new([
name, name,
*aliases,
*versioned_formulae_names, *versioned_formulae_names,
]) ])
[ [

View File

@ -20,7 +20,8 @@ module Homebrew
].freeze ].freeze
private_constant :DYNAMIC_LINKERS private_constant :DYNAMIC_LINKERS
GCC_VERSION_SUFFIX = OS::LINUX_GCC_CI_VERSION.delete_suffix(".0").freeze PREFERRED_GCC_RUNTIME_VERSION = OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA.split("@").last.freeze
private_constant :PREFERRED_GCC_RUNTIME_VERSION
# We link GCC runtime libraries that are not specificaly used for Fortran, # We link GCC runtime libraries that are not specificaly used for Fortran,
# which are linked by the GCC formula. We only use the versioned shared libraries # which are linked by the GCC formula. We only use the versioned shared libraries
@ -37,13 +38,13 @@ module Homebrew
def perform_preinstall_checks(all_fatal: false, cc: nil) def perform_preinstall_checks(all_fatal: false, cc: nil)
generic_perform_preinstall_checks(all_fatal: all_fatal, cc: cc) generic_perform_preinstall_checks(all_fatal: all_fatal, cc: cc)
symlink_ld_so symlink_ld_so
symlink_gcc_libs setup_preferred_gcc_libs
end end
def global_post_install def global_post_install
generic_global_post_install generic_global_post_install
symlink_ld_so symlink_ld_so
symlink_gcc_libs setup_preferred_gcc_libs
end end
def check_cpu def check_cpu
@ -63,36 +64,71 @@ module Homebrew
def symlink_ld_so def symlink_ld_so
brew_ld_so = HOMEBREW_PREFIX/"lib/ld.so" brew_ld_so = HOMEBREW_PREFIX/"lib/ld.so"
return if brew_ld_so.readable?
ld_so = HOMEBREW_PREFIX/"opt/glibc/lib/ld-linux-x86-64.so.2" ld_so = HOMEBREW_PREFIX/"opt/glibc/bin/ld.so"
unless ld_so.readable? unless ld_so.readable?
ld_so = DYNAMIC_LINKERS.find { |s| File.executable? s } ld_so = DYNAMIC_LINKERS.find { |s| File.executable? s }
raise "Unable to locate the system's dynamic linker" unless ld_so if ld_so.blank?
raise "Unable to locate the system's dynamic linker" unless brew_ld_so.readable?
return
end
end end
return if brew_ld_so.readable? && (brew_ld_so.readlink == ld_so)
FileUtils.mkdir_p HOMEBREW_PREFIX/"lib" FileUtils.mkdir_p HOMEBREW_PREFIX/"lib"
FileUtils.ln_sf ld_so, brew_ld_so FileUtils.ln_sf ld_so, brew_ld_so
end end
private_class_method :symlink_ld_so private_class_method :symlink_ld_so
def symlink_gcc_libs def setup_preferred_gcc_libs
gcc_opt_prefix = HOMEBREW_PREFIX/"opt/#{OS::LINUX_PREFERRED_GCC_FORMULA}" gcc_opt_prefix = HOMEBREW_PREFIX/"opt/#{OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA}"
glibc_installed = (HOMEBREW_PREFIX/"opt/glibc/bin/ld.so").readable?
return unless gcc_opt_prefix.readable?
if glibc_installed
ld_so_conf_d = HOMEBREW_PREFIX/"etc/ld.so.conf.d"
unless ld_so_conf_d.exist?
ld_so_conf_d.mkpath
FileUtils.chmod "go-w", ld_so_conf_d
end
# Add gcc to ld search paths
ld_gcc_conf = ld_so_conf_d/"50-homebrew-preferred-gcc.conf"
unless ld_gcc_conf.exist?
ld_gcc_conf.atomic_write <<~EOS
# This file is generated by Homebrew. Do not modify.
#{gcc_opt_prefix}/lib/gcc/#{PREFERRED_GCC_RUNTIME_VERSION}
EOS
FileUtils.chmod "u=rw,go-wx", ld_gcc_conf
FileUtils.rm_f HOMEBREW_PREFIX/"etc/ld.so.cache"
system HOMEBREW_PREFIX/"opt/glibc/sbin/ldconfig"
end
else
odie "#{HOMEBREW_PREFIX}/lib does not exist!" unless (HOMEBREW_PREFIX/"lib").readable?
end
GCC_RUNTIME_LIBS.each do |library| GCC_RUNTIME_LIBS.each do |library|
gcc_library = gcc_opt_prefix/"lib/gcc/#{GCC_VERSION_SUFFIX}/#{library}"
gcc_library_symlink = HOMEBREW_PREFIX/"lib/#{library}" gcc_library_symlink = HOMEBREW_PREFIX/"lib/#{library}"
# Skip if the link target doesn't exist.
next unless gcc_library.readable?
# Also skip if the symlink already exists. if glibc_installed
next if gcc_library_symlink.readable? && (gcc_library_symlink.readlink == gcc_library) # Remove legacy symlinks
FileUtils.rm gcc_library_symlink if gcc_library_symlink.symlink?
else
gcc_library = gcc_opt_prefix/"lib/gcc/#{PREFERRED_GCC_RUNTIME_VERSION}/#{library}"
# Skip if the link target doesn't exist.
next unless gcc_library.readable?
odie "#{HOMEBREW_PREFIX}/lib does not exist!" unless (HOMEBREW_PREFIX/"lib").readable? # Also skip if the symlink already exists.
next if gcc_library_symlink.readable? && (gcc_library_symlink.readlink == gcc_library)
FileUtils.ln_sf gcc_library, gcc_library_symlink FileUtils.ln_sf gcc_library, gcc_library_symlink
end
end end
end end
private_class_method :symlink_gcc_libs private_class_method :setup_preferred_gcc_libs
end end
end end

View File

@ -30,16 +30,10 @@ class Keg
lib_path = "#{new_prefix}/lib" lib_path = "#{new_prefix}/lib"
rpath << lib_path unless rpath.include? lib_path rpath << lib_path unless rpath.include? lib_path
# Add GCC's lib directory (as of GCC 12+) to RPATH when there is existing linkage. # Add GCC's lib directory (as of GCC 12+) to RPATH when there is existing versioned linkage.
# This fixes linkage for newly-poured bottles. # This prevents broken linkage when pouring bottles built with an old GCC formula.
if !name.match?(Version.formula_optionally_versioned_regex(:gcc)) && unless name.match?(Version.formula_optionally_versioned_regex(:gcc))
rpath.any? { |rp| rp.match?(%r{lib/gcc/\d+$}) } rpath.map! { |rp| rp.sub(%r{lib/gcc/\d+$}, "lib/gcc/current") }
# TODO: Replace with
# rpath.map! { |path| path = path.sub(%r{lib/gcc/\d+$}, "lib/gcc/current") }
# when
# 1. Homebrew/homebrew-core#106755 is merged
# 2. No formula has a runtime dependency on a versioned GCC (see `envoy.rb`)
rpath.prepend HOMEBREW_PREFIX/"opt/gcc/lib/gcc/current"
end end
rpath.join(":") rpath.join(":")

View File

@ -28,7 +28,7 @@ module SystemConfig
def formula_linked_version(formula) def formula_linked_version(formula)
return "N/A" unless CoreTap.instance.installed? return "N/A" unless CoreTap.instance.installed?
Formulary.factory(formula).linked_version || "N/A" Formulary.factory(formula).any_installed_version || "N/A"
rescue FormulaUnavailableError rescue FormulaUnavailableError
"N/A" "N/A"
end end
@ -47,7 +47,7 @@ module SystemConfig
out.puts "Host glibc: #{host_glibc_version}" out.puts "Host glibc: #{host_glibc_version}"
out.puts "/usr/bin/gcc: #{host_gcc_version}" out.puts "/usr/bin/gcc: #{host_gcc_version}"
out.puts "/usr/bin/ruby: #{host_ruby_version}" if RUBY_PATH != HOST_RUBY_PATH out.puts "/usr/bin/ruby: #{host_ruby_version}" if RUBY_PATH != HOST_RUBY_PATH
["glibc", CompilerSelector.preferred_gcc, "xorg"].each do |f| ["glibc", CompilerSelector.preferred_gcc, OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA, "xorg"].each do |f|
out.puts "#{f}: #{formula_linked_version(f)}" out.puts "#{f}: #{formula_linked_version(f)}"
end end
end end

View File

@ -2070,6 +2070,10 @@ class Formula
"dependencies" => dependencies.reject(&:optional?) "dependencies" => dependencies.reject(&:optional?)
.reject(&:recommended?) .reject(&:recommended?)
.reject(&:build?) .reject(&:build?)
.reject(&:test?)
.map(&:name)
.uniq,
"test_dependencies" => dependencies.select(&:test?)
.map(&:name) .map(&:name)
.uniq, .uniq,
"recommended_dependencies" => dependencies.select(&:recommended?) "recommended_dependencies" => dependencies.select(&:recommended?)

View File

@ -498,7 +498,7 @@ module Homebrew
end end
if (http_content_problem = curl_check_http_content(homepage, if (http_content_problem = curl_check_http_content(homepage,
"homepage URL", SharedAudits::URL_TYPE_HOMEPAGE,
user_agents: [:browser, :default], user_agents: [:browser, :default],
check_content: true, check_content: true,
strict: @strict, strict: @strict,
@ -892,8 +892,9 @@ module Homebrew
# This variation either: # This variation either:
# 1. does not exist # 1. does not exist
# 2. has no variation-specific dependencies # 2. has no variation-specific dependencies
# In either case, it matches Linux. # In either case, it matches Linux. We must check for `nil` because an empty
return false if variation_dependencies.blank? # array indicates that this variation does not depend on GCC.
return false if variation_dependencies.nil?
# We found a non-Linux variation that depends on GCC. # We found a non-Linux variation that depends on GCC.
return false if variation_dependencies.include?("gcc") return false if variation_dependencies.include?("gcc")
end end

View File

@ -194,7 +194,7 @@ module Formulary
depends_on dep depends_on dep
end end
[:build, :recommended, :optional].each do |type| [:build, :test, :recommended, :optional].each do |type|
json_formula["#{type}_dependencies"].each do |dep| json_formula["#{type}_dependencies"].each do |dep|
next if uses_from_macos_names.include? dep next if uses_from_macos_names.include? dep
@ -670,7 +670,8 @@ module Formulary
return TapLoader.new(ref, from: from) return TapLoader.new(ref, from: from)
end end
return FromPathLoader.new(ref) if File.extname(ref) == ".rb" && Pathname.new(ref).expand_path.exist? pathname_ref = Pathname.new(ref)
return FromPathLoader.new(ref) if File.extname(ref) == ".rb" && pathname_ref.expand_path.exist?
if Homebrew::EnvConfig.install_from_api? if Homebrew::EnvConfig.install_from_api?
return FormulaAPILoader.new(ref) if Homebrew::API::Formula.all_formulae.key?(ref) return FormulaAPILoader.new(ref) if Homebrew::API::Formula.all_formulae.key?(ref)
@ -680,8 +681,12 @@ module Formulary
formula_with_that_name = core_path(ref) formula_with_that_name = core_path(ref)
return FormulaLoader.new(ref, formula_with_that_name) if formula_with_that_name.file? return FormulaLoader.new(ref, formula_with_that_name) if formula_with_that_name.file?
possible_alias = core_alias_path(ref) possible_alias = if pathname_ref.absolute?
return AliasLoader.new(possible_alias) if possible_alias.file? pathname_ref
else
core_alias_path(ref)
end
return AliasLoader.new(possible_alias) if possible_alias.symlink?
possible_tap_formulae = tap_paths(ref) possible_tap_formulae = tap_paths(ref)
raise TapFormulaAmbiguityError.new(ref, possible_tap_formulae) if possible_tap_formulae.size > 1 raise TapFormulaAmbiguityError.new(ref, possible_tap_formulae) if possible_tap_formulae.size > 1

View File

@ -311,9 +311,12 @@ class LinkageChecker
def harmless_broken_link?(dylib) def harmless_broken_link?(dylib)
# libgcc_s_* is referenced by programs that use the Java Service Wrapper, # libgcc_s_* is referenced by programs that use the Java Service Wrapper,
# and is harmless on x86(_64) machines # and is harmless on x86(_64) machines
# dyld will fall back to Apple libc++ if LLVM's is not available.
[ [
"/usr/lib/libgcc_s_ppc64.1.dylib", "/usr/lib/libgcc_s_ppc64.1.dylib",
"/opt/local/lib/libgcc/libgcc_s.1.dylib", "/opt/local/lib/libgcc/libgcc_s.1.dylib",
# TODO: Report linkage with `/usr/lib/libc++.1.dylib` when this link is broken.
"#{HOMEBREW_PREFIX}/opt/llvm/lib/libc++.1.dylib",
].include?(dylib) ].include?(dylib)
end end

View File

@ -50,7 +50,8 @@ module OS
LINUX_GLIBC_CI_VERSION = "2.35" LINUX_GLIBC_CI_VERSION = "2.35"
LINUX_GLIBC_NEXT_CI_VERSION = "2.35" LINUX_GLIBC_NEXT_CI_VERSION = "2.35"
LINUX_GCC_CI_VERSION = "11.0" LINUX_GCC_CI_VERSION = "11.0"
LINUX_PREFERRED_GCC_FORMULA = "gcc@11" LINUX_PREFERRED_GCC_COMPILER_FORMULA = "gcc@11" # https://packages.ubuntu.com/jammy/gcc
LINUX_PREFERRED_GCC_RUNTIME_FORMULA = "gcc@12" # https://packages.ubuntu.com/jammy/libstdc++6
if OS.mac? if OS.mac?
require "os/mac" require "os/mac"

View File

@ -78,8 +78,11 @@ class Resource
end end
def downloader def downloader
@downloader ||= download_strategy.new(url, download_name, version, return @downloader if @downloader.present?
mirrors: mirrors.dup, **specs)
url, *mirrors = determine_url_mirrors
@downloader = download_strategy.new(url, download_name, version,
mirrors: mirrors, **specs)
end end
# Removes /s from resource names; this allows Go package names # Removes /s from resource names; this allows Go package names
@ -277,6 +280,31 @@ class Resource
version unless version.null? version unless version.null?
end end
def determine_url_mirrors
extra_urls = []
# glibc-bootstrap
if url.start_with?("https://github.com/Homebrew/glibc-bootstrap/releases/download")
if Homebrew::EnvConfig.artifact_domain.present?
extra_urls << url.sub("https://github.com", Homebrew::EnvConfig.artifact_domain)
end
if Homebrew::EnvConfig.bottle_domain != HOMEBREW_BOTTLE_DEFAULT_DOMAIN
tag, filename = url.split("/").last(2)
extra_urls << "#{Homebrew::EnvConfig.bottle_domain}/glibc-bootstrap/#{tag}/#{filename}"
end
end
# PyPI packages: PEP 503 Simple Repository API <https://peps.python.org/pep-0503>
if Homebrew::EnvConfig.pip_index_url.present?
pip_index_base_url = Homebrew::EnvConfig.pip_index_url.chomp("/").chomp("/simple")
%w[https://files.pythonhosted.org https://pypi.org].each do |base_url|
extra_urls << url.sub(base_url, pip_index_base_url) if url.start_with?("#{base_url}/packages")
end
end
[*extra_urls, url, *mirrors].uniq
end
# A resource containing a Go package. # A resource containing a Go package.
class Go < Resource class Go < Resource
def stage(target, &block) def stage(target, &block)

View File

@ -1728,8 +1728,10 @@ RuboCop::Cop::Rails::RootJoinChain::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::Rails::RootJoinChain::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set) RuboCop::Cop::Rails::RootJoinChain::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
class RuboCop::Cop::Rails::RootPathnameMethods < ::RuboCop::Cop::Base class RuboCop::Cop::Rails::RootPathnameMethods < ::RuboCop::Cop::Base
include ::RuboCop::Cop::RangeHelp
extend ::RuboCop::Cop::AutoCorrector extend ::RuboCop::Cop::AutoCorrector
def dir_glob?(param0 = T.unsafe(nil)); end
def on_send(node); end def on_send(node); end
def pathname_method(param0 = T.unsafe(nil)); end def pathname_method(param0 = T.unsafe(nil)); end
def rails_root?(param0 = T.unsafe(nil)); end def rails_root?(param0 = T.unsafe(nil)); end
@ -1737,7 +1739,10 @@ class RuboCop::Cop::Rails::RootPathnameMethods < ::RuboCop::Cop::Base
private private
def build_path_glob(path, method); end
def evidence(node); end def evidence(node); end
def include_interpolation?(arguments); end
def join_arguments(arguments); end
end end
RuboCop::Cop::Rails::RootPathnameMethods::DIR_METHODS = T.let(T.unsafe(nil), Set) RuboCop::Cop::Rails::RootPathnameMethods::DIR_METHODS = T.let(T.unsafe(nil), Set)

View File

@ -2655,6 +2655,8 @@ module Homebrew::EnvConfig
def self.no_proxy(); end def self.no_proxy(); end
def self.pip_index_url(); end
def self.pry?(); end def self.pry?(); end
def self.simulate_macos_on_linux?(); end def self.simulate_macos_on_linux?(); end

View File

@ -238,6 +238,7 @@ describe Formulary do
}, },
"build_dependencies" => ["build_dep"], "build_dependencies" => ["build_dep"],
"dependencies" => ["dep"], "dependencies" => ["dep"],
"test_dependencies" => ["test_dep"],
"recommended_dependencies" => ["recommended_dep"], "recommended_dependencies" => ["recommended_dep"],
"optional_dependencies" => ["optional_dep"], "optional_dependencies" => ["optional_dep"],
"uses_from_macos" => ["uses_from_macos_dep"], "uses_from_macos" => ["uses_from_macos_dep"],
@ -291,9 +292,9 @@ describe Formulary do
expect(formula).to be_a(Formula) expect(formula).to be_a(Formula)
expect(formula.keg_only_reason.reason).to eq :provided_by_macos expect(formula.keg_only_reason.reason).to eq :provided_by_macos
if OS.mac? if OS.mac?
expect(formula.deps.count).to eq 4
elsif OS.linux?
expect(formula.deps.count).to eq 5 expect(formula.deps.count).to eq 5
elsif OS.linux?
expect(formula.deps.count).to eq 6
end end
expect(formula.uses_from_macos_elements).to eq ["uses_from_macos_dep"] expect(formula.uses_from_macos_elements).to eq ["uses_from_macos_dep"]
expect(formula.caveats).to eq "example caveat string" expect(formula.caveats).to eq "example caveat string"
@ -329,7 +330,7 @@ describe Formulary do
formula = described_class.factory(formula_name) formula = described_class.factory(formula_name)
expect(formula).to be_a(Formula) expect(formula).to be_a(Formula)
expect(formula.deps.count).to eq 5 expect(formula.deps.count).to eq 6
expect(formula.deps.map(&:name).include?("variations_dep")).to be true expect(formula.deps.map(&:name).include?("variations_dep")).to be true
end end
@ -339,7 +340,7 @@ describe Formulary do
formula = described_class.factory(formula_name) formula = described_class.factory(formula_name)
expect(formula).to be_a(Formula) expect(formula).to be_a(Formula)
expect(formula.deps.count).to eq 5 expect(formula.deps.count).to eq 6
expect(formula.deps.map(&:name).include?("uses_from_macos_dep")).to be true expect(formula.deps.map(&:name).include?("uses_from_macos_dep")).to be true
end end
end end

View File

@ -290,7 +290,25 @@ module Utils
url_protected_by_cloudflare?(response) || url_protected_by_incapsula?(response) url_protected_by_cloudflare?(response) || url_protected_by_incapsula?(response)
end end
return "The #{url_type} #{url} is not reachable (HTTP status code #{details[:status_code]})" # https://github.com/Homebrew/brew/issues/13789
# If the `:homepage` of a formula is private, it will fail an `audit`
# since there's no way to specify a `strategy` with `using:` and
# GitHub does not authorize access to the web UI using token
#
# Strategy:
# If the `:homepage` 404s, it's a GitHub link, and we have a token then
# check the API (which does use tokens) for the repository
repo_details = url.match(%r{https?://github\.com/(?<user>[^/]+)/(?<repo>[^/]+)/?.*})
check_github_api = url_type == SharedAudits::URL_TYPE_HOMEPAGE &&
details[:status_code] == "404" &&
repo_details &&
Homebrew::EnvConfig.github_api_token
unless check_github_api
return "The #{url_type} #{url} is not reachable (HTTP status code #{details[:status_code]})"
end
"Unable to find homepage" if SharedAudits.github_repo_data(repo_details[:user], repo_details[:repo]).nil?
end end
if url.start_with?("https://") && Homebrew::EnvConfig.no_insecure_redirect? && if url.start_with?("https://") && Homebrew::EnvConfig.no_insecure_redirect? &&

View File

@ -10,6 +10,8 @@ module SharedAudits
include Utils::Curl include Utils::Curl
extend Utils::Curl extend Utils::Curl
URL_TYPE_HOMEPAGE = "homepage URL"
module_function module_function
def github_repo_data(user, repo) def github_repo_data(user, repo)

View File

@ -23,7 +23,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/byebug-11.1.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/coderay-1.1.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/coderay-1.1.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/highline-2.0.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/highline-2.0.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/commander-4.6.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/commander-4.6.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/connection_pool-2.2.5/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/connection_pool-2.3.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/did_you_mean-1.6.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/did_you_mean-1.6.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/diff-lcs-1.5.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/diff-lcs-1.5.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/docile-1.4.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/docile-1.4.0/lib"
@ -88,7 +88,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.11
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-2.3.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-2.3.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.35.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.35.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.15.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.15.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.16.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.16.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.13.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.13.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.11/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.11/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-3.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-3.0.0/lib"

View File

@ -845,6 +845,7 @@ Rails/RootJoinChain:
Rails/RootPathnameMethods: Rails/RootPathnameMethods:
Description: 'Use `Rails.root` IO methods instead of passing it to `File`.' Description: 'Use `Rails.root` IO methods instead of passing it to `File`.'
Enabled: pending Enabled: pending
SafeAutocorrect: false
VersionAdded: '2.16' VersionAdded: '2.16'
Rails/RootPublicPath: Rails/RootPublicPath:

View File

@ -43,10 +43,15 @@ module RuboCop
PATTERN PATTERN
def on_send(node) def on_send(node)
child_node, method_name = *node.first_argument.children child_node, method_name, time_argument = *node.first_argument.children
return if time_argument || !child_node
return unless current_time?(child_node, method_name) || current_time_with_convert?(child_node, method_name) return unless current_time?(child_node, method_name) || current_time_with_convert?(child_node, method_name)
add_offense(node) { |corrector| corrector.replace(node, 'freeze_time') } add_offense(node) do |corrector|
last_argument = node.last_argument
freeze_time_method = last_argument.block_pass_type? ? "freeze_time(#{last_argument.source})" : 'freeze_time'
corrector.replace(node, freeze_time_method)
end
end end
private private

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