Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump rubocop from 1.2.0 to 1.3.0 in /Library/Homebrew #9124

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions Library/.rubocop.yml
Expand Up @@ -197,6 +197,10 @@ Layout/RescueEnsureAlignment:
Lint/AmbiguousBlockAssociation:
Enabled: false

Lint/DuplicateBranch:
Exclude:
- 'Taps/*/*/{Formula,Casks,}/*.rb'

# needed for lazy_object magic
Naming/MemoizedInstanceVariableName:
Exclude:
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/Gemfile.lock
Expand Up @@ -98,13 +98,13 @@ GEM
rspec-support (3.10.0)
rspec-wait (0.0.9)
rspec (>= 3, < 4)
rubocop (1.2.0)
rubocop (1.3.0)
parallel (~> 1.10)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8)
rexml
rubocop-ast (>= 1.0.1)
rubocop-ast (>= 1.1.1)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.1.1)
Expand Down
8 changes: 2 additions & 6 deletions Library/Homebrew/PATH.rb
Expand Up @@ -67,13 +67,9 @@ def to_str

sig { params(other: T.untyped).returns(T::Boolean) }
def ==(other)
if other.respond_to?(:to_ary) && to_ary == other.to_ary
true
elsif other.respond_to?(:to_str) && to_str == other.to_str
true
else
(other.respond_to?(:to_ary) && to_ary == other.to_ary) ||
(other.respond_to?(:to_str) && to_str == other.to_str) ||
false
end
end

sig { returns(T::Boolean) }
Expand Down
14 changes: 4 additions & 10 deletions Library/Homebrew/build.rb
Expand Up @@ -53,11 +53,7 @@ def effective_build_options_for(dependent)
def expand_reqs
formula.recursive_requirements do |dependent, req|
build = effective_build_options_for(dependent)
if req.prune_from_option?(build)
Requirement.prune
elsif req.prune_if_build_and_not_dependent?(dependent, formula)
Requirement.prune
elsif req.test?
if req.prune_from_option?(build) || req.prune_if_build_and_not_dependent?(dependent, formula) || req.test?
Requirement.prune
end
end
Expand All @@ -66,14 +62,12 @@ def expand_reqs
def expand_deps
formula.recursive_dependencies do |dependent, dep|
build = effective_build_options_for(dependent)
if dep.prune_from_option?(build)
Dependency.prune
elsif dep.prune_if_build_and_not_dependent?(dependent, formula)
if dep.prune_from_option?(build) ||
dep.prune_if_build_and_not_dependent?(dependent, formula) ||
(dep.test? && !dep.build?)
Dependency.prune
elsif dep.build?
Dependency.keep_but_prune_recursive_deps
elsif dep.test?
Dependency.prune
reitermarkus marked this conversation as resolved.
Show resolved Hide resolved
end
end
end
Expand Down
11 changes: 4 additions & 7 deletions Library/Homebrew/cask/cmd/audit.rb
Expand Up @@ -60,13 +60,10 @@ def run
options[:quarantine] = true if options[:quarantine].nil?

casks = args.named.flat_map do |name|
if File.exist?(name)
name
elsif name.count("/") == 1
Tap.fetch(name).cask_files
else
name
end
next name if File.exist?(name)
next Tap.fetch(name).cask_files if name.count("/") == 1

name
end
casks = casks.map { |c| CaskLoader.load(c, config: Config.from_args(args)) }
casks = Cask.to_a if casks.empty?
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/dsl/depends_on.rb
Expand Up @@ -64,7 +64,7 @@ def macos=(*args)
MacOSRequirement.new([version.to_sym], comparator: comparator)
elsif /^\s*(?<comparator><|>|[=<>]=)\s*(?<version>\S+)\s*$/ =~ args.first
MacOSRequirement.new([version], comparator: comparator)
else
else # rubocop:disable Lint/DuplicateBranch
MacOSRequirement.new([args.first], comparator: "==")
end
rescue MacOSVersionError => e
Expand Down
16 changes: 7 additions & 9 deletions Library/Homebrew/cleaner.rb
Expand Up @@ -76,6 +76,12 @@ def executable_path?(path)
path.text_executable? || path.executable?
end

# Both these files are completely unnecessary to package and cause
# pointless conflicts with other formulae. They are removed by Debian,
# Arch & MacPorts amongst other packagers as well. The files are
# created as part of installing any Perl module.
PERL_BASENAMES = Set.new(%w[perllocal.pod .packlist]).freeze
Rylan12 marked this conversation as resolved.
Show resolved Hide resolved

# Clean a top-level (bin, sbin, lib) directory, recursively, by fixing file
# permissions and removing .la files, unless the files (or parent
# directories) are protected by skip_clean.
Expand All @@ -93,18 +99,10 @@ def clean_dir(d)

next if path.directory?

if path.extname == ".la"
if path.extname == ".la" || PERL_BASENAMES.include?(path.basename.to_s)
path.unlink
elsif path.symlink?
# Skip it.
elsif path.basename.to_s == "perllocal.pod"
# Both this file & the .packlist one below are completely unnecessary
# to package & causes pointless conflict with other formulae. They are
# removed by Debian, Arch & MacPorts amongst other packagers as well.
# The files are created as part of installing any Perl module.
path.unlink
elsif path.basename.to_s == ".packlist" # Hidden file, not file extension!
path.unlink
else
# Set permissions for executables and non-executables
perms = if executable_path?(path)
Expand Down
2 changes: 0 additions & 2 deletions Library/Homebrew/dependency_collector.rb
Expand Up @@ -115,8 +115,6 @@ def parse_spec(spec, tags)
def parse_string_spec(spec, tags)
if spec.match?(HOMEBREW_TAP_FORMULA_REGEX)
TapDependency.new(spec, tags)
elsif tags.empty?
Dependency.new(spec, tags)
else
Dependency.new(spec, tags)
end
Expand Down
22 changes: 7 additions & 15 deletions Library/Homebrew/dev-cmd/bottle.rb
Expand Up @@ -440,22 +440,14 @@ def merge(args:)
if key == "cellar"
# Prioritize HOMEBREW_CELLAR over :any over :any_skip_relocation
cellars = [first, second]
if cellars.include?(HOMEBREW_CELLAR)
HOMEBREW_CELLAR
elsif first.start_with?("/")
first
elsif second.start_with?("/")
second
elsif cellars.include?("any")
"any"
elsif cellars.include?("any_skip_relocation")
"any_skip_relocation"
else
second
end
else
second
next HOMEBREW_CELLAR if cellars.include?(HOMEBREW_CELLAR)
next first if first.start_with?("/")
next second if second.start_with?("/")
next "any" if cellars.include?("any")
next "any_skip_relocation" if cellars.include?("any_skip_relocation")
end

second
end
end

Expand Down
10 changes: 4 additions & 6 deletions Library/Homebrew/download_strategy.rb
Expand Up @@ -1233,22 +1233,20 @@ def self.detect_from_url(url)
when %r{^https?://(.+?\.)?googlecode\.com/svn},
%r{^https?://svn\.},
%r{^svn://},
%r{^svn\+http://},
%r{^http://svn\.apache\.org/repos/},
%r{^https?://(.+?\.)?sourceforge\.net/svnroot/}
SubversionDownloadStrategy
when %r{^cvs://}
CVSDownloadStrategy
when %r{^hg://},
%r{^https?://(.+?\.)?googlecode\.com/hg}
%r{^https?://(.+?\.)?googlecode\.com/hg},
%r{^https?://(.+?\.)?sourceforge\.net/hgweb/}
MercurialDownloadStrategy
when %r{^bzr://}
BazaarDownloadStrategy
when %r{^fossil://}
FossilDownloadStrategy
when %r{^svn\+http://},
%r{^http://svn\.apache\.org/repos/}
SubversionDownloadStrategy
when %r{^https?://(.+?\.)?sourceforge\.net/hgweb/}
MercurialDownloadStrategy
else
CurlDownloadStrategy
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/mac/hardware/cpu.rb
Expand Up @@ -116,7 +116,7 @@ def sse4_2?
sysctl_bool("hw.optional.sse4_2")
end

# Note: this is more reliable than checking uname.
# NOTE: this is more reliable than checking uname.
# `sysctl` returns the right answer even when running in Rosetta 2.
def physical_cpu_arm64?
sysctl_bool("hw.optional.arm64")
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/mac/keg_relocate.rb
Expand Up @@ -77,7 +77,7 @@ def fix_dynamic_linkage
# remove all RPATHs from the file.
if ENV["HOMEBREW_RELOCATE_METAVARS"] &&
file.dynamically_linked_libraries.none? { |lib| lib.start_with?("@rpath") }
# Note: This could probably be made more efficient by reverse-sorting
# NOTE: This could probably be made more efficient by reverse-sorting
# the RPATHs by offset and calling MachOFile#delete_command
# with repopulate: false.
file.rpaths.each { |r| file.delete_rpath(r) }
Expand Down
6 changes: 2 additions & 4 deletions Library/Homebrew/formula.rb
Expand Up @@ -1270,10 +1270,8 @@ def outdated_kegs(fetch_head: false)
break
end

if current_version
[]
elsif (head_version = latest_head_version) &&
!head_version_outdated?(head_version, fetch_head: fetch_head)
if current_version ||
((head_version = latest_head_version) && !head_version_outdated?(head_version, fetch_head: fetch_head))
[]
else
all_kegs += old_installed_formulae.flat_map(&:installed_kegs)
Expand Down
15 changes: 5 additions & 10 deletions Library/Homebrew/formula_installer.rb
Expand Up @@ -534,13 +534,10 @@ def expand_requirements
keep_build_test ||= req.test? && include_test? && dependent == f
keep_build_test ||= req.build? && !install_bottle_for_dependent && !dependent.latest_version_installed?

if req.prune_from_option?(build)
Requirement.prune
elsif req.satisfied?(env: env, cc: cc, build_bottle: @build_bottle, bottle_arch: bottle_arch)
Requirement.prune
elsif (req.build? || req.test?) && !keep_build_test
Requirement.prune
elsif (dep = formula_deps_map[dependent.name]) && dep.build?
if req.prune_from_option?(build) ||
req.satisfied?(env: env, cc: cc, build_bottle: @build_bottle, bottle_arch: bottle_arch) ||
((req.build? || req.test?) && !keep_build_test) ||
formula_deps_map[dependent.name]&.build?
Requirement.prune
else
unsatisfied_reqs[dependent] << req
Expand Down Expand Up @@ -569,9 +566,7 @@ def expand_dependencies(deps)
keep_build_test ||= dep.test? && include_test? && include_test_formulae.include?(dependent.full_name)
keep_build_test ||= dep.build? && !install_bottle_for?(dependent, build) && !dependent.latest_version_installed?

if dep.prune_from_option?(build)
Dependency.prune
elsif (dep.build? || dep.test?) && !keep_build_test
if dep.prune_from_option?(build) || ((dep.build? || dep.test?) && !keep_build_test)
Dependency.prune
elsif dep.satisfied?(inherited_options[dep.name])
Dependency.skip
Expand Down
67 changes: 34 additions & 33 deletions Library/Homebrew/keg.rb
Expand Up @@ -482,45 +482,46 @@ def link(**options)

link_dir("share", **options) do |relative_path|
case relative_path.to_s
when "locale/locale.alias" then :skip_file
when INFOFILE_RX then :info
when LOCALEDIR_RX then :mkpath
when %r{^icons/.*/icon-theme\.cache$} then :skip_file
# all icons subfolders should also mkpath
when %r{^icons/} then :mkpath
when /^zsh/ then :mkpath
when /^fish/ then :mkpath
# Lua, Lua51, Lua53 all need the same handling.
when %r{^lua/} then :mkpath
when %r{^guile/} then :mkpath
when *SHARE_PATHS then :mkpath
else :link
when "locale/locale.alias",
%r{^icons/.*/icon-theme\.cache$}
:skip_file
when LOCALEDIR_RX,
%r{^icons/}, # all icons subfolders should also mkpath
/^zsh/,
/^fish/,
%r{^lua/}, # Lua, Lua51, Lua53 all need the same handling.
%r{^guile/},
*SHARE_PATHS
:mkpath
else
:link
end
end

link_dir("lib", **options) do |relative_path|
case relative_path.to_s
when "charset.alias" then :skip_file
# pkg-config database gets explicitly created
when "pkgconfig" then :mkpath
# cmake database gets explicitly created
when "cmake" then :mkpath
# lib/language folders also get explicitly created
when "dtrace" then :mkpath
when /^gdk-pixbuf/ then :mkpath
when "ghc" then :mkpath
when /^gio/ then :mkpath
when "lua" then :mkpath
when /^mecab/ then :mkpath
when /^node/ then :mkpath
when /^ocaml/ then :mkpath
when /^perl5/ then :mkpath
when "php" then :mkpath
when /^python[23]\.\d/ then :mkpath
when /^R/ then :mkpath
when /^ruby/ then :mkpath
# Everything else is symlinked to the cellar
else :link
when "charset.alias"
:skip_file
when "pkgconfig", # pkg-config database gets explicitly created
"cmake", # cmake database gets explicitly created
"dtrace", # lib/language folders also get explicitly created
/^gdk-pixbuf/,
"ghc",
/^gio/,
"lua",
/^mecab/,
/^node/,
/^ocaml/,
/^perl5/,
"php",
/^python[23]\.\d/,
/^R/,
/^ruby/
:mkpath
else
# Everything else is symlinked to the cellar
:link
end
end

Expand Down
27 changes: 12 additions & 15 deletions Library/Homebrew/os/mac/xcode.rb
Expand Up @@ -189,21 +189,19 @@ def detect_version_from_clang_version
# installed CLT version. This is useful as they are packaged
# simultaneously so workarounds need to apply to both based on their
# comparable version.
latest_stable = "12.0"
case (DevelopmentTools.clang_version.to_f * 10).to_i
when 120 then latest_stable
when 110 then "11.5"
when 100 then "10.3"
when 91 then "9.4"
when 90 then "9.2"
when 81 then "8.3"
when 80 then "8.0"
when 73 then "7.3"
when 70 then "7.0"
when 61 then "6.1"
when 60 then "6.0"
when 0 then "dunno"
else latest_stable
when 60 then "6.0"
when 61 then "6.1"
when 70 then "7.0"
when 73 then "7.3"
when 80 then "8.0"
when 81 then "8.3"
when 90 then "9.2"
when 91 then "9.4"
when 100 then "10.3"
when 110 then "11.5"
else "12.0"
end
end

Expand Down Expand Up @@ -277,8 +275,7 @@ def update_instructions
sig { returns(String) }
def latest_clang_version
case MacOS.version
when "11.0" then "1200.0.32.27"
when "10.15" then "1200.0.32.27"
when "11.0", "10.15" then "1200.0.32.27"
when "10.14" then "1100.0.33.17"
when "10.13" then "1000.10.44.2"
when "10.12" then "900.0.39.2"
Expand Down