aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/moved.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/doctor.rb10
-rw-r--r--Library/Homebrew/cmd/reinstall.rb2
-rw-r--r--Library/Homebrew/cmd/upgrade.rb2
-rw-r--r--Library/Homebrew/cmd/vendor-install.sh31
-rw-r--r--Library/Homebrew/compat/requirements.rb12
-rw-r--r--Library/Homebrew/dependency_collector.rb14
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb10
-rw-r--r--Library/Homebrew/extend/os/mac/dependency_collector.rb7
-rw-r--r--Library/Homebrew/formula.rb22
-rw-r--r--Library/Homebrew/formula_installer.rb28
-rw-r--r--Library/Homebrew/requirements.rb12
-rw-r--r--Library/Homebrew/rubocops/extend/formula_cop.rb2
-rw-r--r--Library/Homebrew/test/dependency_collector_spec.rb12
-rw-r--r--Library/Homebrew/test/os/mac/dependency_collector_spec.rb12
-rw-r--r--Library/Homebrew/utils.rb3
-rw-r--r--Library/Homebrew/utils/curl.rb11
17 files changed, 118 insertions, 74 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb
index f5ef790eb..856ab2766 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb
@@ -65,7 +65,7 @@ module Hbc
ohai "Moving #{self.class.english_name} '#{target.basename}' back to '#{source}'."
source.dirname.mkpath
- if source.parent.writable?
+ if target.parent.writable?
FileUtils.move(target, source)
else
command.run("/bin/mv", args: [target, source], sudo: true)
diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
index d7bcf1537..5aef2c420 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
@@ -12,6 +12,7 @@ module Hbc
def run
ohai "Homebrew-Cask Version", Hbc.full_version
ohai "macOS", MacOS.full_version
+ ohai "SIP", self.class.check_sip
ohai "Java", SystemConfig.describe_java
ohai "Homebrew-Cask Install Location", self.class.render_install_location
ohai "Homebrew-Cask Staging Location", self.class.render_staging_location(Hbc.caskroom)
@@ -37,6 +38,15 @@ module Hbc
(self.class.locale_variables + environment_variables).sort.each(&self.class.method(:render_env_var))
end
+ def self.check_sip
+ csrutil = "/usr/bin/csrutil"
+ return "N/A" unless File.executable?(csrutil)
+ Open3.capture2(csrutil, "status")[0]
+ .gsub("This is an unsupported configuration, likely to break in the future and leave your machine in an unknown state.", "")
+ .gsub("System Integrity Protection status: ", "")
+ .delete("\t\.").capitalize.strip
+ end
+
def self.locale_variables
ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).sort
end
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb
index a4629025a..53c923d91 100644
--- a/Library/Homebrew/cmd/reinstall.rb
+++ b/Library/Homebrew/cmd/reinstall.rb
@@ -39,7 +39,7 @@ module Homebrew
fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.bottle?)
fi.interactive = ARGV.interactive?
fi.git = ARGV.git?
- fi.link_keg = keg_was_linked if keg_had_linked_opt
+ fi.link_keg ||= keg_was_linked if keg_had_linked_opt
fi.prelude
oh1 "Reinstalling #{f.full_name} #{options.to_a.join " "}"
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index 1c9c89d76..4b03e8080 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -133,7 +133,7 @@ module Homebrew
fi.options = options
fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
fi.installed_on_request = !ARGV.named.empty?
- fi.link_keg = keg_was_linked if keg_had_linked_opt
+ fi.link_keg ||= keg_was_linked if keg_had_linked_opt
if tab
fi.installed_as_dependency = tab.installed_as_dependency
fi.installed_on_request ||= tab.installed_on_request
diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh
index bf6fe0c59..3b91dae5c 100644
--- a/Library/Homebrew/cmd/vendor-install.sh
+++ b/Library/Homebrew/cmd/vendor-install.sh
@@ -8,26 +8,26 @@ source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh"
VENDOR_DIR="$HOMEBREW_LIBRARY/Homebrew/vendor"
-# Built from https://github.com/Homebrew/homebrew-portable.
+# Built from https://github.com/Homebrew/homebrew-portable-ruby.
if [[ -n "$HOMEBREW_MACOS" ]]
then
if [[ "$HOMEBREW_PROCESSOR" = "Intel" ]]
then
- ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz"
+ ruby_URL="https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz"
+ ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz"
ruby_SHA="34ce9e4c9c1be28db564d744165aa29291426f8a3d2ef806ba4f0b9175aedb2b"
- else
- ruby_URL=""
- ruby_SHA=""
fi
elif [[ -n "$HOMEBREW_LINUX" ]]
then
case "$HOMEBREW_PROCESSOR" in
armv7l)
- ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.armv7l_linux.bottle.1.tar.gz"
+ ruby_URL="https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3.armv7l_linux.bottle.1.tar.gz"
+ ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3/portable-ruby-2.3.3.armv7l_linux.bottle.1.tar.gz"
ruby_SHA="d26affe6f6ac299557a9044b311b4066b554874fc828ebc323d2705d3f4a8249"
;;
x86_64)
- ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.x86_64_linux.bottle.1.tar.gz"
+ ruby_URL="https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3.x86_64_linux.bottle.1.tar.gz"
+ ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3/portable-ruby-2.3.3.x86_64_linux.bottle.1.tar.gz"
ruby_SHA="33643b1ca6f860d6df01686636326785763e5e81cf0cef37d8a7ab96a6ca1fa1"
;;
esac
@@ -90,7 +90,20 @@ fetch() {
if [[ ! -f "$temporary_path" ]]
then
- odie "Download failed: $VENDOR_URL"
+ [[ -n "$HOMEBREW_QUIET" ]] || echo "==> Downloading $VENDOR_URL2" >&2
+ "$HOMEBREW_CURL" "${curl_args[@]}" "$VENDOR_URL2" -o "$temporary_path"
+ fi
+
+ if [[ ! -f "$temporary_path" ]]
+ then
+ odie <<EOS
+Failed to download $VENDOR_URL and $VENDOR_URL2!
+
+Do not file an issue on GitHub about this: you will need to figure out for
+yourself what issue with your internet connection restricts your access to
+both Bintray (used for Homebrew bottles/binary packages) and GitHub
+(used for Homebrew updates).
+EOS
fi
trap '' SIGINT
@@ -211,8 +224,10 @@ homebrew-vendor-install() {
[[ -n "$HOMEBREW_DEBUG" ]] && set -x
url_var="${VENDOR_NAME}_URL"
+ url2_var="${VENDOR_NAME}_URL2"
sha_var="${VENDOR_NAME}_SHA"
VENDOR_URL="${!url_var}"
+ VENDOR_URL2="${!url2_var}"
VENDOR_SHA="${!sha_var}"
if [[ -z "$VENDOR_URL" || -z "$VENDOR_SHA" ]]
diff --git a/Library/Homebrew/compat/requirements.rb b/Library/Homebrew/compat/requirements.rb
index 48911b52b..304dd2504 100644
--- a/Library/Homebrew/compat/requirements.rb
+++ b/Library/Homebrew/compat/requirements.rb
@@ -44,6 +44,18 @@ class GPG2Requirement < Requirement
satisfy { which "gpg" }
end
+class GitRequirement < Requirement
+ fatal true
+ default_formula "git"
+ satisfy { Utils.git_available? }
+end
+
+class SubversionRequirement < Requirement
+ fatal true
+ default_formula "subversion"
+ satisfy { Utils.svn_available? }
+end
+
XcodeDependency = XcodeRequirement
MysqlDependency = MysqlRequirement
PostgresqlDependency = PostgresqlRequirement
diff --git a/Library/Homebrew/dependency_collector.rb b/Library/Homebrew/dependency_collector.rb
index 9ad93c268..03a86d661 100644
--- a/Library/Homebrew/dependency_collector.rb
+++ b/Library/Homebrew/dependency_collector.rb
@@ -52,6 +52,16 @@ class DependencyCollector
parse_spec(spec, Array(tags))
end
+ def git_dep_if_needed(tags)
+ return if Utils.git_available?
+ Dependency.new("git", tags)
+ end
+
+ def subversion_dep_if_needed(tags)
+ return if Utils.svn_available?
+ Dependency.new("subversion", tags)
+ end
+
def cvs_dep_if_needed(tags)
Dependency.new("cvs", tags)
end
@@ -126,9 +136,9 @@ class DependencyCollector
if strategy <= CurlDownloadStrategy
parse_url_spec(spec.url, tags)
elsif strategy <= GitDownloadStrategy
- GitRequirement.new(tags)
+ git_dep_if_needed(tags)
elsif strategy <= SubversionDownloadStrategy
- SubversionRequirement.new(tags)
+ subversion_dep_if_needed(tags)
elsif strategy <= MercurialDownloadStrategy
Dependency.new("mercurial", tags)
elsif strategy <= FossilDownloadStrategy
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index 16eb03dbc..9d0ed3c59 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -304,7 +304,7 @@ class FormulaAuditor
def audit_formula_name
return unless @strict
# skip for non-official taps
- return if formula.tap.nil? || !formula.tap.official?
+ return unless formula.tap&.official?
name = formula.name
@@ -718,7 +718,13 @@ class FormulaAuditor
return unless @strict
- problem "`#{Regexp.last_match(1)}` in formulae is deprecated" if line =~ /(env :(std|userpaths))/
+ if formula.tap&.official? && line.include?("env :std")
+ problem "`env :std` in official tap formulae is deprecated"
+ end
+
+ if line.include?("env :userpaths")
+ problem "`env :userpaths` in formulae is deprecated"
+ end
if line =~ /system ((["'])[^"' ]*(?:\s[^"' ]*)+\2)/
bad_system = Regexp.last_match(1)
diff --git a/Library/Homebrew/extend/os/mac/dependency_collector.rb b/Library/Homebrew/extend/os/mac/dependency_collector.rb
index d25d90261..108b6ccb2 100644
--- a/Library/Homebrew/extend/os/mac/dependency_collector.rb
+++ b/Library/Homebrew/extend/os/mac/dependency_collector.rb
@@ -1,6 +1,13 @@
require "os/mac/ld64_dependency"
class DependencyCollector
+ def git_dep_if_needed(tags)
+ return if MacOS.version >= :lion
+ Dependency.new("git", tags)
+ end
+
+ def subversion_dep_if_needed(tags); end
+
def cvs_dep_if_needed(tags)
return if MacOS.version < :lion
Dependency.new("cvs", tags)
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 8e4f80260..7b1d94eb2 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -2194,32 +2194,24 @@ class Formula
# <pre># If a dependency is only needed in certain cases:
# depends_on "sqlite" if MacOS.version == :leopard
# depends_on :xcode # If the formula really needs full Xcode.
- # depends_on :tex # Homebrew does not provide a Tex Distribution.
- # depends_on :fortran # Checks that `gfortran` is available or `FC` is set.
- # depends_on :mpi => :cc # Needs MPI with `cc`
- # depends_on :mpi => [:cc, :cxx, :optional] # Is optional. MPI with `cc` and `cxx`.
# depends_on :macos => :lion # Needs at least OS X Lion (10.7).
- # depends_on :apr # If a formula requires the CLT-provided apr library to exist.
# depends_on :arch => :intel # If this formula only builds on Intel architecture.
# depends_on :arch => :x86_64 # If this formula only builds on Intel x86 64-bit.
# depends_on :arch => :ppc # Only builds on PowerPC?
# depends_on :ld64 # Sometimes ld fails on `MacOS.version < :leopard`. Then use this.
- # depends_on :x11 # X11/XQuartz components.
+ # depends_on :x11 => :optional # X11/XQuartz components.
# depends_on :osxfuse # Permits the use of the upstream signed binary or our source package.
# depends_on :tuntap # Does the same thing as above. This is vital for Yosemite and above.
- # depends_on :mysql => :recommended</pre>
# <pre># It is possible to only depend on something if
# # `build.with?` or `build.without? "another_formula"`:
- # depends_on :mysql # allows brewed or external mysql to be used
- # depends_on :postgresql if build.without? "sqlite"
- # depends_on :hg # Mercurial (external or brewed) is needed</pre>
+ # depends_on "postgresql" if build.without? "sqlite"
#
- # <pre># If any Python >= 2.7 < 3.x is okay (either from macOS or brewed):
- # depends_on :python</pre>
- # <pre># to depend on Python >= 2.7 but use system Python where possible
- # depends_on :python if MacOS.version <= :snow_leopard</pre>
+ # <pre># Python 2.7:
+ # depends_on "python"</pre>
+ # <pre># Python 2.7 but use system Python where possible
+ # depends_on "python" if MacOS.version <= :snow_leopard</pre>
# <pre># Python 3.x if the `--with-python3` is given to `brew install example`
- # depends_on :python3 => :optional</pre>
+ # depends_on "python3" => :optional</pre>
def depends_on(dep)
specs.each { |spec| spec.depends_on(dep) }
end
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 1e2d77b2c..4f8708a4d 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -32,11 +32,11 @@ class FormulaInstaller
attr_reader :formula
attr_accessor :options, :build_bottle, :invalid_option_names
- attr_accessor :installed_as_dependency, :installed_on_request
+ attr_accessor :installed_as_dependency, :installed_on_request, :link_keg
mode_attr_accessor :show_summary_heading, :show_header
mode_attr_accessor :build_from_source, :force_bottle
mode_attr_accessor :ignore_deps, :only_deps, :interactive, :git
- mode_attr_accessor :verbose, :debug, :quieter, :link_keg
+ mode_attr_accessor :verbose, :debug, :quieter
def initialize(formula)
@formula = formula
@@ -149,7 +149,7 @@ class FormulaInstaller
recursive_deps = formula.recursive_dependencies
recursive_formulae = recursive_deps.map(&:to_formula)
- recursive_runtime_deps = formula.recursive_dependencies.reject(&:build?)
+ recursive_runtime_deps = formula.runtime_dependencies
recursive_runtime_formulae = recursive_runtime_deps.map(&:to_formula)
recursive_dependencies = []
@@ -553,18 +553,18 @@ class FormulaInstaller
end
fi = FormulaInstaller.new(df)
- fi.options |= tab.used_options
- fi.options |= Tab.remap_deprecated_options(df.deprecated_options, dep.options)
- fi.options |= inherited_options
- fi.options &= df.options
- fi.build_from_source = ARGV.build_formula_from_source?(df)
- fi.force_bottle = false
- fi.verbose = verbose?
- fi.quieter = quieter?
- fi.debug = debug?
- fi.link_keg = keg_was_linked if keg_had_linked_keg
+ fi.options |= tab.used_options
+ fi.options |= Tab.remap_deprecated_options(df.deprecated_options, dep.options)
+ fi.options |= inherited_options
+ fi.options &= df.options
+ fi.build_from_source = ARGV.build_formula_from_source?(df)
+ fi.force_bottle = false
+ fi.verbose = verbose?
+ fi.quieter = quieter?
+ fi.debug = debug?
+ fi.link_keg ||= keg_was_linked if keg_had_linked_keg
fi.installed_as_dependency = true
- fi.installed_on_request = false
+ fi.installed_on_request = df.any_version_installed? && tab.installed_on_request
fi.prelude
oh1 "Installing #{formula.full_name} dependency: #{Formatter.identifier(dep.name)}"
fi.install
diff --git a/Library/Homebrew/requirements.rb b/Library/Homebrew/requirements.rb
index e8c33465b..6128db516 100644
--- a/Library/Homebrew/requirements.rb
+++ b/Library/Homebrew/requirements.rb
@@ -9,15 +9,3 @@ require "requirements/unsigned_kext_requirement"
require "requirements/x11_requirement"
require "requirements/arch_requirement"
require "requirements/xcode_requirement"
-
-class GitRequirement < Requirement
- fatal true
- default_formula "git"
- satisfy { Utils.git_available? }
-end
-
-class SubversionRequirement < Requirement
- fatal true
- default_formula "subversion"
- satisfy { Utils.svn_available? }
-end
diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb
index 71a5caf74..de369a0aa 100644
--- a/Library/Homebrew/rubocops/extend/formula_cop.rb
+++ b/Library/Homebrew/rubocops/extend/formula_cop.rb
@@ -214,7 +214,7 @@ module RuboCop
EOS
def_node_search :dependency_name_hash_match?, <<~EOS
- (hash (pair ({str sym} %1) ({str sym array} _)))
+ (hash (pair ({str sym} %1) (...)))
EOS
# To compare node with appropriate Ruby variable
diff --git a/Library/Homebrew/test/dependency_collector_spec.rb b/Library/Homebrew/test/dependency_collector_spec.rb
index cfbd260b3..216bbf316 100644
--- a/Library/Homebrew/test/dependency_collector_spec.rb
+++ b/Library/Homebrew/test/dependency_collector_spec.rb
@@ -78,24 +78,12 @@ describe DependencyCollector do
expect(spec).to eq(copy)
end
- it "creates a resource dependency from a '.git' URL" do
- resource = Resource.new
- resource.url("git://example.com/foo/bar.git")
- expect(subject.add(resource)).to be_an_instance_of(GitRequirement)
- end
-
it "creates a resource dependency from a CVS URL" do
resource = Resource.new
resource.url(":pserver:anonymous:@example.com:/cvsroot/foo/bar", using: :cvs)
expect(subject.add(resource)).to eq(Dependency.new("cvs", [:build]))
end
- it "creates a resource dependency from a Subversion URL" do
- resource = Resource.new
- resource.url("svn://example.com/foo/bar")
- expect(subject.add(resource)).to be_an_instance_of(SubversionRequirement)
- end
-
it "creates a resource dependency from a '.7z' URL" do
resource = Resource.new
resource.url("http://example.com/foo.7z")
diff --git a/Library/Homebrew/test/os/mac/dependency_collector_spec.rb b/Library/Homebrew/test/os/mac/dependency_collector_spec.rb
index 357c35c2d..5d260ebf7 100644
--- a/Library/Homebrew/test/os/mac/dependency_collector_spec.rb
+++ b/Library/Homebrew/test/os/mac/dependency_collector_spec.rb
@@ -35,4 +35,16 @@ describe DependencyCollector do
resource.url("http://example.com/foo.tar.xz")
expect(subject.add(resource)).to be nil
end
+
+ specify "Resource dependency from a '.git' URL" do
+ resource = Resource.new
+ resource.url("git://example.com/foo/bar.git")
+ expect(subject.add(resource)).to be nil
+ end
+
+ specify "Resource dependency from a Subversion URL" do
+ resource = Resource.new
+ resource.url("svn://example.com/foo/bar")
+ expect(subject.add(resource)).to be nil
+ end
end
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index c6e7d22df..a1fb0d235 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -101,7 +101,8 @@ def odeprecated(method, replacement = nil, disable: false, disable_on: nil, call
if ARGV.homebrew_developer? || disable ||
Homebrew.raise_deprecation_exceptions?
- raise MethodDeprecatedError, message
+ developer_message = message + "Or, even better, submit a PR to fix it!"
+ raise MethodDeprecatedError, developer_message
elsif !Homebrew.auditing?
opoo "#{message}\n"
end
diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb
index cf1735576..65edd85df 100644
--- a/Library/Homebrew/utils/curl.rb
+++ b/Library/Homebrew/utils/curl.rb
@@ -2,10 +2,13 @@ require "pathname"
require "open3"
def curl_executable
- curl = Pathname.new ENV["HOMEBREW_CURL"]
- curl = which("curl") unless curl.exist?
- return curl if curl.executable?
- raise "#{curl} is not executable"
+ @curl ||= [
+ ENV["HOMEBREW_CURL"],
+ which("curl"),
+ "/usr/bin/curl",
+ ].map { |c| Pathname(c) }.find(&:executable?)
+ raise "curl is not executable" unless @curl
+ @curl
end
def curl_args(*extra_args, show_output: false, user_agent: :default)