Merge branch 'Homebrew:master' into mohammad

This commit is contained in:
Mohammad Zain Abbas 2022-08-11 22:07:30 +02:00 committed by GitHub
commit a2979b2b10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 37 additions and 28 deletions

View File

@ -124,14 +124,14 @@ GEM
rspec (>= 3, < 4)
rspec_junit_formatter (0.5.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.33.0)
rubocop (1.34.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.19.1, < 2.0)
rubocop-ast (>= 1.20.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.21.0)

View File

@ -156,11 +156,11 @@ module Homebrew
end
if new_hash.present? && cask.language.blank? # avoid repeated replacement for multilanguage cask
hash_regex = old_hash == :no_check ? ":no_check" : "[\"']#{Regexp.escape(old_hash.to_s)}[\"']"
hash_regex = (old_hash == :no_check) ? ":no_check" : "[\"']#{Regexp.escape(old_hash.to_s)}[\"']"
replacement_pairs << [
/sha256\s+#{hash_regex}/m,
"sha256 #{new_hash == :no_check ? ":no_check" : "\"#{new_hash}\""}",
"sha256 #{(new_hash == :no_check) ? ":no_check" : "\"#{new_hash}\""}",
]
end

View File

@ -13,13 +13,16 @@ homebrew-rubocop() {
GEM_VERSION="$("${HOMEBREW_RUBY_PATH}" "${RUBY_DISABLE_OPTIONS}" -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]')"
GEM_HOME="${HOMEBREW_LIBRARY}/Homebrew/vendor/bundle/ruby/${GEM_VERSION}"
BUNDLE_GEMFILE="${HOMEBREW_LIBRARY}/Homebrew/Gemfile"
if ! [[ -f "${GEM_HOME}/bin/rubocop" ]]
export GEM_HOME
export BUNDLE_GEMFILE
if ! bundle check &>/dev/null
then
"${HOMEBREW_BREW_FILE}" install-bundler-gems
fi
export GEM_HOME
export PATH="${GEM_HOME}/bin:${PATH}"
RUBOCOP="${HOMEBREW_LIBRARY}/Homebrew/utils/rubocop.rb"

View File

@ -66,7 +66,7 @@ module OnSystem
end
end
base.define_method(:on_arch_conditional) do |arm:, intel:|
base.define_method(:on_arch_conditional) do |arm: nil, intel: nil|
@on_system_blocks_exist = true
return arm if OnSystem.arch_condition_met? :arm

View File

@ -51,6 +51,7 @@ module Superenv
def determine_rpath_paths(formula)
PATH.new(
*formula&.lib,
"#{HOMEBREW_PREFIX}/opt/gcc/lib/gcc/current",
PATH.new(run_time_deps.map { |dep| dep.opt_lib.to_s }).existing,
"#{HOMEBREW_PREFIX}/lib",
)

View File

@ -72,6 +72,9 @@ class LinkageChecker
@unwanted_system_dylibs = @system_dylibs.reject do |s|
SYSTEM_LIBRARY_ALLOWLIST.include? File.basename(s)
end
@undeclared_deps -= [CompilerSelector.preferred_gcc, "glibc"]
# FIXME: Remove this when these dependencies are injected correctly (e.g. through `DependencyCollector`)
# See discussion at
# https://github.com/Homebrew/brew/pull/13577
@undeclared_deps -= [CompilerSelector.preferred_gcc, "glibc", "gcc"]
end
end

View File

@ -6,7 +6,7 @@ module RuboCop
# Constants available globally for use in all cask cops.
module Constants
STANZA_GROUPS = [
[:version, :sha256, :arch],
[:version, :sha256],
[:language],
[:url, :appcast, :name, :desc, :homepage],
[:livecheck],

View File

@ -401,7 +401,7 @@ module RuboCop
info[:if_module], info[:if_method] = if ON_ARCH_OPTIONS.include?(on_system_option)
["Hardware::CPU", :"#{on_system_option}?"]
elsif ON_BASE_OS_OPTIONS.include?(on_system_option)
["OS", on_system_option == :macos ? :mac? : :linux?]
["OS", (on_system_option == :macos) ? :mac? : :linux?]
else
["MacOS", :version]
end
@ -493,7 +493,7 @@ module RuboCop
else_info = if else_node.present?
{
can_autocorrect: true,
on_system_method: on_system_option == :intel ? "on_arm" : "on_intel",
on_system_method: (on_system_option == :intel) ? "on_arm" : "on_intel",
node: else_node,
}
end
@ -505,7 +505,7 @@ module RuboCop
else_info = if else_node.present?
{
can_autocorrect: true,
on_system_method: on_system_option == :macos ? "on_linux" : "on_macos",
on_system_method: (on_system_option == :macos) ? "on_linux" : "on_macos",
node: else_node,
}
end

View File

@ -405,7 +405,7 @@ module Homebrew
cmd = command.join(" ")
options = []
options << "Type=#{@launch_only_once == true ? "oneshot" : "simple"}"
options << "Type=#{(@launch_only_once == true) ? "oneshot" : "simple"}"
options << "ExecStart=#{cmd}"
options << "Restart=always" if @keep_alive.present? && @keep_alive[:always].present?
@ -441,8 +441,8 @@ module Homebrew
options << "OnUnitActiveSec=#{@interval}" if @run_type == RUN_TYPE_INTERVAL
if @run_type == RUN_TYPE_CRON
minutes = @cron[:Minute] == "*" ? "*" : format("%02d", @cron[:Minute])
hours = @cron[:Hour] == "*" ? "*" : format("%02d", @cron[:Hour])
minutes = (@cron[:Minute] == "*") ? "*" : format("%02d", @cron[:Minute])
hours = (@cron[:Hour] == "*") ? "*" : format("%02d", @cron[:Hour])
options << "OnCalendar=#{@cron[:Weekday]}-*-#{@cron[:Month]}-#{@cron[:Day]} #{hours}:#{minutes}:00"
end

View File

@ -582,7 +582,7 @@ class BottleSpecification
tags = collector.tags.sort_by do |tag|
version = tag.to_macos_version
# Give arm64 bottles a higher priority so they are first
priority = tag.arch == :arm64 ? "2" : "1"
priority = (tag.arch == :arm64) ? "2" : "1"
"#{priority}.#{version}_#{tag}"
rescue MacOSVersionError
# Sort non-MacOS tags below MacOS tags.

View File

@ -49,7 +49,7 @@ module Homebrew
.partition { |f| f.realpath == HOMEBREW_BREW_FILE.realpath || f.extname == ".sh" }
rubocop_result = if shell_files.any? && ruby_files.none?
output_type == :json ? [] : true
(output_type == :json) ? [] : true
else
run_rubocop(ruby_files, output_type,
fix: fix,
@ -60,7 +60,7 @@ module Homebrew
end
shellcheck_result = if ruby_files.any? && shell_files.none?
output_type == :json ? [] : true
(output_type == :json) ? [] : true
else
run_shellcheck(shell_files, output_type, fix: fix)
end

View File

@ -252,7 +252,7 @@ class Tap
if official? && DEPRECATED_OFFICIAL_TAPS.include?(repo)
odie "#{name} was deprecated. This tap is now empty and all its contents were either deleted or migrated."
elsif user == "caskroom" || name == "phinze/cask"
new_repo = repo == "cask" ? "cask" : "cask-#{repo}"
new_repo = (repo == "cask") ? "cask" : "cask-#{repo}"
odie "#{name} was moved. Tap homebrew/#{new_repo} instead."
end

View File

@ -1,7 +1,8 @@
cask "arch-arm-only" do
arch arm: "-arm"
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
arch arm: "-arm"
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine#{arch}.zip"
homepage "https://brew.sh/"

View File

@ -1,9 +1,10 @@
cask "invalid-two-arch" do
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
arch arm: "arm", intel: "intel"
arch arm: "amd64", intel: "x86_64"
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
homepage "https://brew.sh/"

View File

@ -1,9 +1,9 @@
cask "multiple-versions" do
arch arm: "arm", intel: "intel"
platform = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
arch arm: "arm", intel: "intel"
platform = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
on_big_sur do
version "1.2.0"

View File

@ -6,7 +6,7 @@ cask "with-depends-on-macos-failure" do
homepage "https://brew.sh/with-depends-on-macos-failure"
# guarantee a mismatched release
depends_on macos: MacOS.version == :catalina ? :mojave : :catalina
depends_on macos: (MacOS.version == :catalina) ? :mojave : :catalina
app "Caffeine.app"
end

View File

@ -86,7 +86,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec_junit_formatter
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.21.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.11.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-2.2.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.33.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.34.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.14.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.15.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.12.1/lib"