aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorGautham Goli2017-10-12 00:29:19 +0530
committerGautham Goli2017-10-13 19:50:46 +0530
commit7fa51f71f1a8a21b905bafc1fb4106f0222d654f (patch)
tree098d2477a8262a5770310fed4693da31c4392e1c /Library/Homebrew/extend
parentafdd0e2437426ec85ff86e5b7562d3a6a69ba3e5 (diff)
parent56458f03fcc68ef6d8ee3ee4a7c1d16021aa5800 (diff)
downloadbrew-7fa51f71f1a8a21b905bafc1fb4106f0222d654f.tar.bz2
Merge branch 'master' into audit_line_rubocop_part_4_rebase_attempt_1
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/ARGV.rb6
-rw-r--r--Library/Homebrew/extend/ENV.rb2
-rw-r--r--Library/Homebrew/extend/ENV/shared.rb4
-rw-r--r--Library/Homebrew/extend/ENV/std.rb4
-rw-r--r--Library/Homebrew/extend/ENV/super.rb10
-rw-r--r--Library/Homebrew/extend/cachable.rb9
-rw-r--r--Library/Homebrew/extend/fileutils.rb2
-rw-r--r--Library/Homebrew/extend/os/mac/development_tools.rb17
-rw-r--r--Library/Homebrew/extend/os/mac/diagnostic.rb5
-rw-r--r--Library/Homebrew/extend/os/mac/extend/ENV/super.rb12
-rw-r--r--Library/Homebrew/extend/os/mac/formula_cellar_checks.rb16
-rw-r--r--Library/Homebrew/extend/os/mac/hardware/cpu.rb2
-rw-r--r--Library/Homebrew/extend/pathname.rb4
-rw-r--r--Library/Homebrew/extend/string.rb2
14 files changed, 58 insertions, 37 deletions
diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb
index c6cb54f5d..63a0f3e40 100644
--- a/Library/Homebrew/extend/ARGV.rb
+++ b/Library/Homebrew/extend/ARGV.rb
@@ -144,10 +144,10 @@ module HomebrewArgvExtension
def value(name)
arg_prefix = "--#{name}="
flag_with_value = find { |arg| arg.start_with?(arg_prefix) }
- flag_with_value.strip_prefix(arg_prefix) if flag_with_value
+ flag_with_value&.strip_prefix(arg_prefix)
end
- # Returns an array of values that were given as a comma-seperated list.
+ # Returns an array of values that were given as a comma-separated list.
# @see value
def values(name)
return unless val = value(name)
@@ -236,7 +236,7 @@ module HomebrewArgvExtension
def bottle_arch
arch = value "bottle-arch"
- arch.to_sym if arch
+ arch&.to_sym
end
def build_from_source?
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 283e90b69..ea1b99501 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -28,7 +28,7 @@ module EnvActivation
end
def clear_sensitive_environment!
- ENV.keys.each do |key|
+ ENV.each_key do |key|
next unless /(cookie|key|token)/i =~ key
ENV.delete key
end
diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb
index b51ade48b..15488ee19 100644
--- a/Library/Homebrew/extend/ENV/shared.rb
+++ b/Library/Homebrew/extend/ENV/shared.rb
@@ -260,10 +260,6 @@ module SharedEnvExtension
set_cpu_flags(flags)
end
- def java_cache
- append "_JAVA_OPTIONS", "-Duser.home=#{HOMEBREW_CACHE}/java_cache"
- end
-
# ld64 is a newer linker provided for Xcode 2.5
# @private
def ld64
diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb
index a2e800803..4e5d0683a 100644
--- a/Library/Homebrew/extend/ENV/std.rb
+++ b/Library/Homebrew/extend/ENV/std.rb
@@ -233,8 +233,8 @@ module Stdenv
def make_jobs
# '-j' requires a positive integral argument
- if self["HOMEBREW_MAKE_JOBS"].to_i > 0
- self["HOMEBREW_MAKE_JOBS"].to_i
+ if (jobs = self["HOMEBREW_MAKE_JOBS"].to_i).positive?
+ jobs
else
Hardware::CPU.cores
end
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index 692fd3623..b4f0dfcac 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -24,8 +24,7 @@ module Superenv
end
# @private
- def self.bin
- end
+ def self.bin; end
def reset
super
@@ -138,7 +137,6 @@ module Superenv
def determine_pkg_config_libdir
PATH.new(
- "/usr/lib/pkgconfig",
homebrew_extra_pkg_config_paths,
).existing
end
@@ -325,11 +323,9 @@ module Superenv
end
end
- def set_x11_env_if_installed
- end
+ def set_x11_env_if_installed; end
- def set_cpu_flags(*)
- end
+ def set_cpu_flags(_, _ = "", _ = {}); end
end
require "extend/os/extend/ENV/super"
diff --git a/Library/Homebrew/extend/cachable.rb b/Library/Homebrew/extend/cachable.rb
new file mode 100644
index 000000000..69d86ccb7
--- /dev/null
+++ b/Library/Homebrew/extend/cachable.rb
@@ -0,0 +1,9 @@
+module Cachable
+ def cache
+ @cache ||= {}
+ end
+
+ def clear_cache
+ cache.clear
+ end
+end
diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb
index 52d4cbf51..ed5bfe6c3 100644
--- a/Library/Homebrew/extend/fileutils.rb
+++ b/Library/Homebrew/extend/fileutils.rb
@@ -3,7 +3,7 @@ require "tmpdir"
require "etc"
# Homebrew extends Ruby's `FileUtils` to make our code more readable.
-# @see http://ruby-doc.org/stdlib-2.0.0/libdoc/fileutils/rdoc/FileUtils.html Ruby's FileUtils API
+# @see https://ruby-doc.org/stdlib-2.0.0/libdoc/fileutils/rdoc/FileUtils.html Ruby's FileUtils API
module FileUtils
# Create a temporary directory then yield. When the block returns,
# recursively delete the temporary directory. Passing opts[:retain]
diff --git a/Library/Homebrew/extend/os/mac/development_tools.rb b/Library/Homebrew/extend/os/mac/development_tools.rb
index caa85ffca..1931b398d 100644
--- a/Library/Homebrew/extend/os/mac/development_tools.rb
+++ b/Library/Homebrew/extend/os/mac/development_tools.rb
@@ -9,7 +9,7 @@ class DevelopmentTools
@locate[key] = if (located_tool = original_locate(tool))
located_tool
elsif MacOS.version > :tiger
- path = Utils.popen_read("/usr/bin/xcrun", "-no-cache", "-find", tool).chomp
+ path = Utils.popen_read("/usr/bin/xcrun", "-no-cache", "-find", tool, err: :close).chomp
Pathname.new(path) if File.executable?(path)
end
end
@@ -43,11 +43,16 @@ class DevelopmentTools
end
def custom_installation_instructions
- if MacOS.version > :tiger
+ if MacOS.version > :leopard
<<-EOS.undent
Install GNU's GCC
brew install gcc
EOS
+ elsif MacOS.version > :tiger
+ <<-EOS.undent
+ Install GNU's GCC
+ brew install gcc@4.6
+ EOS
else
# Tiger doesn't ship with apple-gcc42, and this is required to build
# some software that doesn't build properly with FSF GCC.
@@ -55,7 +60,7 @@ class DevelopmentTools
Install Apple's GCC
brew install apple-gcc42
or GNU's GCC
- brew install gcc
+ brew install gcc@4.6
EOS
end
end
@@ -77,10 +82,10 @@ class DevelopmentTools
end
end
- def curl_handles_most_https_homepages?
- # The system Curl is too old for some modern HTTPS homepages on
+ def curl_handles_most_https_certificates?
+ # The system Curl is too old for some modern HTTPS certificates on
# older macOS versions.
- MacOS.version >= :el_capitan
+ ENV["HOMEBREW_SYSTEM_CURL_TOO_OLD"].nil?
end
def subversion_handles_most_https_certificates?
diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb
index 0cdd7b115..9f7b18b49 100644
--- a/Library/Homebrew/extend/os/mac/diagnostic.rb
+++ b/Library/Homebrew/extend/os/mac/diagnostic.rb
@@ -195,8 +195,9 @@ module Homebrew
end
def check_ruby_version
- ruby_version = "2.0"
- return if RUBY_VERSION[/\d\.\d/] == ruby_version
+ ruby_version = "2.3.3"
+ return if RUBY_VERSION == ruby_version
+ return if ARGV.homebrew_developer? && OS::Mac.prerelease?
<<-EOS.undent
Ruby version #{RUBY_VERSION} is unsupported on #{MacOS.version}. Homebrew
diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb
index f97a2dbbb..5872c2264 100644
--- a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb
@@ -28,7 +28,7 @@ module Superenv
# @private
def homebrew_extra_pkg_config_paths
paths = \
- ["#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"]
+ ["/usr/lib/pkgconfig", "#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"]
paths << "#{MacOS::X11.lib}/pkgconfig" << "#{MacOS::X11.share}/pkgconfig" if x11?
paths
end
@@ -96,9 +96,13 @@ module Superenv
self["SDKROOT"] = MacOS.sdk_path
end
- # Filter out symbols known not to be defined on 10.11 since GNU Autotools
- # can't reliably figure this out with Xcode 8 on its own yet.
- if MacOS.version == "10.11" && MacOS::Xcode.installed? && MacOS::Xcode.version >= "8.0"
+ # Filter out symbols known not to be defined since GNU Autotools can't
+ # reliably figure this out with Xcode 8 and above.
+ if MacOS.version == "10.12" && MacOS::Xcode.installed? && MacOS::Xcode.version >= "9.0"
+ %w[fmemopen futimens open_memstream utimensat].each do |s|
+ ENV["ac_cv_func_#{s}"] = "no"
+ end
+ elsif MacOS.version == "10.11" && MacOS::Xcode.installed? && MacOS::Xcode.version >= "8.0"
%w[basename_r clock_getres clock_gettime clock_settime dirname_r
getentropy mkostemp mkostemps timingsafe_bcmp].each do |s|
ENV["ac_cv_func_#{s}"] = "no"
diff --git a/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb b/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb
index 66e038774..32e5774f6 100644
--- a/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb
+++ b/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb
@@ -67,11 +67,19 @@ module FormulaCellarChecks
checker = LinkageChecker.new(keg, formula)
return unless checker.broken_dylibs?
- problem_if_output <<-EOS.undent
- The installation was broken.
- Broken dylib links found:
- #{checker.broken_dylibs.to_a * "\n "}
+ output = <<-EOS.undent
+ #{formula} has broken dynamic library links:
+ #{checker.broken_dylibs.to_a * "\n "}
EOS
+ tab = Tab.for_keg(keg)
+ if tab.poured_from_bottle
+ output += <<-EOS.undent
+ Rebuild this from source with:
+ brew reinstall --build-from-source #{formula}
+ If that's successful, file an issue#{formula.tap ? " here:\n #{formula.tap.issues_url}" : "."}
+ EOS
+ end
+ problem_if_output output
end
def audit_installed
diff --git a/Library/Homebrew/extend/os/mac/hardware/cpu.rb b/Library/Homebrew/extend/os/mac/hardware/cpu.rb
index 22d118e1a..b97c280cd 100644
--- a/Library/Homebrew/extend/os/mac/hardware/cpu.rb
+++ b/Library/Homebrew/extend/os/mac/hardware/cpu.rb
@@ -50,6 +50,8 @@ module Hardware
:broadwell
when 0x37fc219f # Skylake
:skylake
+ when 0x0f817246 # Kaby Lake
+ :kabylake
else
:dunno
end
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index 767d83ff9..e3d6880ba 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -59,7 +59,7 @@ module DiskUsageExtension
end
# Homebrew extends Ruby's `Pathname` to make our code more readable.
-# @see http://ruby-doc.org/stdlib-1.8.7/libdoc/pathname/rdoc/Pathname.html Ruby's Pathname API
+# @see https://ruby-doc.org/stdlib-1.8.7/libdoc/pathname/rdoc/Pathname.html Ruby's Pathname API
class Pathname
include DiskUsageExtension
@@ -186,7 +186,7 @@ class Pathname
begin
tf.chown(uid, gid)
tf.chmod(old_stat.mode)
- rescue Errno::EPERM
+ rescue Errno::EPERM # rubocop:disable Lint/HandleExceptions
end
File.rename(tf.path, self)
diff --git a/Library/Homebrew/extend/string.rb b/Library/Homebrew/extend/string.rb
index ae7a209db..b96f12994 100644
--- a/Library/Homebrew/extend/string.rb
+++ b/Library/Homebrew/extend/string.rb
@@ -60,7 +60,7 @@ module StringInreplaceExtension
result
end
- # Looks for Makefile style variable defintions and replaces the
+ # Looks for Makefile style variable definitions and replaces the
# value with "new_value", or removes the definition entirely.
def change_make_var!(flag, new_value)
return if gsub!(/^#{Regexp.escape(flag)}[ \t]*=[ \t]*(.*)$/, "#{flag}=#{new_value}", false)