aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
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/cmd
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/cmd')
-rw-r--r--Library/Homebrew/cmd/deps.rb134
-rw-r--r--Library/Homebrew/cmd/fetch.rb6
-rw-r--r--Library/Homebrew/cmd/install.rb2
-rw-r--r--Library/Homebrew/cmd/irb.rb8
-rw-r--r--Library/Homebrew/cmd/list.rb10
-rw-r--r--Library/Homebrew/cmd/pin.rb3
-rw-r--r--Library/Homebrew/cmd/postinstall.rb2
-rw-r--r--Library/Homebrew/cmd/prune.rb2
-rw-r--r--Library/Homebrew/cmd/reinstall.rb4
-rw-r--r--Library/Homebrew/cmd/search.rb31
-rw-r--r--Library/Homebrew/cmd/style.rb5
-rw-r--r--Library/Homebrew/cmd/tap-info.rb4
-rw-r--r--Library/Homebrew/cmd/tap.rb3
-rw-r--r--Library/Homebrew/cmd/unlinkapps.rb2
-rw-r--r--Library/Homebrew/cmd/unpin.rb4
-rw-r--r--Library/Homebrew/cmd/update-report.rb9
-rw-r--r--Library/Homebrew/cmd/update.sh7
-rw-r--r--Library/Homebrew/cmd/upgrade.rb1
-rw-r--r--Library/Homebrew/cmd/uses.rb6
-rw-r--r--Library/Homebrew/cmd/vendor-install.sh21
20 files changed, 176 insertions, 88 deletions
diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb
index bbf0c1b0b..de7aa4a51 100644
--- a/Library/Homebrew/cmd/deps.rb
+++ b/Library/Homebrew/cmd/deps.rb
@@ -1,4 +1,4 @@
-#: * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] <formulae>:
+#: * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] <formulae>:
#: Show dependencies for <formulae>. When given multiple formula arguments,
#: show the intersection of dependencies for <formulae>.
#:
@@ -19,15 +19,22 @@
#: <formulae>. To include the `:build` type dependencies, pass `--include-build`.
#: Similarly, pass `--include-optional` to include `:optional` dependencies.
#: To skip `:recommended` type dependencies, pass `--skip-recommended`.
+#: To include requirements in addition to dependencies, pass `--include-requirements`.
#:
-#: * `deps` `--tree` [<filters>] (<formulae>|`--installed`):
+#: * `deps` `--tree` [`--1`] [<filters>] [`--annotate`] (<formulae>|`--installed`):
#: Show dependencies as a tree. When given multiple formula arguments, output
#: individual trees for every formula.
#:
+#: If `--1` is passed, only one level of children is displayed.
+#:
#: If `--installed` is passed, output a tree for every installed formula.
#:
#: The <filters> placeholder is any combination of options `--include-build`,
-#: `--include-optional`, and `--skip-recommended` as documented above.
+#: `--include-optional`, `--skip-recommended`, and `--include-requirements` as
+#: documented above.
+#:
+#: If `--annotate` is passed, the build, optional, and recommended dependencies
+#: are marked as such in the output.
#:
#: * `deps` [<filters>] (`--installed`|`--all`):
#: Show dependencies for installed or all available formulae. Every line of
@@ -37,6 +44,10 @@
#: The <filters> placeholder is any combination of options `--include-build`,
#: `--include-optional`, and `--skip-recommended` as documented above.
+# The undocumented `--for-each` option will switch into the mode used by `deps --all`,
+# but only list dependencies for specified formula, one specified formula per line.
+# This is used for debugging the `--installed`/`--all` display mode.
+
# encoding: UTF-8
require "formula"
@@ -52,20 +63,26 @@ module Homebrew
all?: ARGV.include?("--all"),
topo_order?: ARGV.include?("-n"),
union?: ARGV.include?("--union"),
+ for_each?: ARGV.include?("--for-each"),
)
- if mode.installed? && mode.tree?
- puts_deps_tree Formula.installed
+ if mode.tree?
+ if mode.installed?
+ puts_deps_tree Formula.installed, !ARGV.one?
+ else
+ raise FormulaUnspecifiedError if ARGV.named.empty?
+ puts_deps_tree ARGV.formulae, !ARGV.one?
+ end
elsif mode.all?
puts_deps Formula
- elsif mode.tree?
- raise FormulaUnspecifiedError if ARGV.named.empty?
- puts_deps_tree ARGV.formulae
elsif ARGV.named.empty?
raise FormulaUnspecifiedError unless mode.installed?
puts_deps Formula.installed
+ elsif mode.for_each?
+ puts_deps ARGV.formulae
else
all_deps = deps_for_formulae(ARGV.formulae, !ARGV.one?, &(mode.union? ? :| : :&))
+ all_deps = condense_requirements(all_deps)
all_deps = all_deps.select(&:installed?) if mode.installed?
all_deps = all_deps.map(&method(:dep_display_name)).uniq
all_deps.sort! unless mode.topo_order?
@@ -73,24 +90,59 @@ module Homebrew
end
end
- def dep_display_name(d)
- ARGV.include?("--full-name") ? d.to_formula.full_name : d.name
+ def condense_requirements(deps)
+ if ARGV.include?("--include-requirements")
+ deps
+ else
+ deps.map do |dep|
+ if dep.is_a? Dependency
+ dep
+ elsif dep.default_formula?
+ dep.to_dependency
+ end
+ end.compact
+ end
+ end
+
+ def dep_display_name(dep)
+ str = if dep.is_a? Requirement
+ if ARGV.include?("--include-requirements")
+ if dep.default_formula?
+ ":#{dep.display_s} (#{dep_display_name(dep.to_dependency)})"
+ else
+ ":#{dep.display_s}"
+ end
+ elsif dep.default_formula?
+ dep_display_name(dep.to_dependency)
+ else
+ # This shouldn't happen, but we'll put something here to help debugging
+ "::#{dep.name}"
+ end
+ else
+ ARGV.include?("--full-name") ? dep.to_formula.full_name : dep.name
+ end
+ if ARGV.include?("--annotate")
+ str = "#{str} [build]" if dep.build?
+ str = "#{str} [optional" if dep.optional?
+ str = "#{str} [recommended]" if dep.recommended?
+ end
+ str
end
def deps_for_formula(f, recursive = false)
includes = []
ignores = []
- if ARGV.include? "--include-build"
+ if ARGV.include?("--include-build")
includes << "build?"
else
ignores << "build?"
end
- if ARGV.include? "--include-optional"
+ if ARGV.include?("--include-optional")
includes << "optional?"
else
ignores << "optional?"
end
- ignores << "recommended?" if ARGV.include? "--skip-recommended"
+ ignores << "recommended?" if ARGV.include?("--skip-recommended")
if recursive
deps = f.recursive_dependencies do |dependent, dep|
@@ -120,7 +172,7 @@ module Homebrew
end
end
- deps + reqs.select(&:default_formula?).map(&:to_dependency)
+ deps + reqs.to_a
end
def deps_for_formulae(formulae, recursive = false, &block)
@@ -129,41 +181,55 @@ module Homebrew
def puts_deps(formulae)
formulae.each do |f|
- deps = deps_for_formula(f).sort_by(&:name).map(&method(:dep_display_name))
+ deps = deps_for_formula(f)
+ deps = condense_requirements(deps)
+ deps = deps.sort_by(&:name).map(&method(:dep_display_name))
puts "#{f.full_name}: #{deps.join(" ")}"
end
end
- def puts_deps_tree(formulae)
+ def puts_deps_tree(formulae, recursive = false)
formulae.each do |f|
- puts "#{f.full_name} (required dependencies)"
- recursive_deps_tree(f, "")
+ puts f.full_name
+ @dep_stack = []
+ recursive_deps_tree(f, "", recursive)
puts
end
end
- def recursive_deps_tree(f, prefix)
- reqs = f.requirements.select(&:default_formula?)
- deps = f.deps.default
- max = reqs.length - 1
- reqs.each_with_index do |req, i|
- chr = if i == max && deps.empty?
+ def recursive_deps_tree(f, prefix, recursive)
+ reqs = f.requirements
+ deps = f.deps
+ dependables = reqs + deps
+ dependables = dependables.reject(&:optional?) unless ARGV.include?("--include-optional")
+ dependables = dependables.reject(&:build?) unless ARGV.include?("--include-build")
+ dependables = dependables.reject(&:recommended?) if ARGV.include?("--skip-recommended")
+ max = dependables.length - 1
+ @dep_stack.push f.name
+ dependables.each_with_index do |dep, i|
+ next if !ARGV.include?("--include-requirements") && dep.is_a?(Requirement) && !dep.default_formula?
+ tree_lines = if i == max
"└──"
else
"├──"
end
- puts prefix + "#{chr} :#{dep_display_name(req.to_dependency)}"
- end
- max = deps.length - 1
- deps.each_with_index do |dep, i|
- chr = if i == max
- "└──"
+ display_s = "#{tree_lines} #{dep_display_name(dep)}"
+ is_circular = @dep_stack.include?(dep.name)
+ display_s = "#{display_s} (CIRCULAR DEPENDENCY)" if is_circular
+ puts "#{prefix}#{display_s}"
+ next if !recursive || is_circular
+ prefix_addition = if i == max
+ " "
else
- "├──"
+ "│ "
+ end
+ if dep.is_a?(Requirement) && dep.default_formula?
+ recursive_deps_tree(Formulary.factory(dep.to_dependency.name), prefix + prefix_addition, true)
+ end
+ if dep.is_a? Dependency
+ recursive_deps_tree(Formulary.factory(dep.name), prefix + prefix_addition, true)
end
- prefix_ext = (i == max) ? " " : "│ "
- puts prefix + "#{chr} #{dep_display_name(dep)}"
- recursive_deps_tree(Formulary.factory(dep.name), prefix + prefix_ext)
end
+ @dep_stack.pop
end
end
diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb
index 006c63746..411753992 100644
--- a/Library/Homebrew/cmd/fetch.rb
+++ b/Library/Homebrew/cmd/fetch.rb
@@ -49,8 +49,10 @@ module Homebrew
if fetch_bottle?(f)
begin
fetch_formula(f.bottle)
- rescue Exception => e
- raise if ARGV.homebrew_developer? || e.is_a?(Interrupt)
+ rescue Interrupt
+ raise
+ rescue => e
+ raise if ARGV.homebrew_developer?
fetched_bottle = false
onoe e.message
opoo "Bottle fetch failed: fetching the source."
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index c00087705..ca8f29477 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -219,6 +219,7 @@ module Homebrew
end
end
+ return if formulae.empty?
perform_preinstall_checks
formulae.each do |f|
@@ -338,6 +339,7 @@ module Homebrew
rescue FormulaInstallationAlreadyAttemptedError
# We already attempted to install f as part of the dependency tree of
# another formula. In that case, don't generate an error, just move on.
+ return
rescue CannotInstallFormulaError => e
ofail e.message
end
diff --git a/Library/Homebrew/cmd/irb.rb b/Library/Homebrew/cmd/irb.rb
index cba8a5b82..4cd3d4c9e 100644
--- a/Library/Homebrew/cmd/irb.rb
+++ b/Library/Homebrew/cmd/irb.rb
@@ -19,15 +19,13 @@ class String
end
end
-def cask
- $LOAD_PATH.unshift("#{HOMEBREW_LIBRARY_PATH}/cask/lib")
- require "hbc"
-end
-
module Homebrew
module_function
def irb
+ $LOAD_PATH.unshift("#{HOMEBREW_LIBRARY_PATH}/cask/lib")
+ require "hbc"
+
if ARGV.include? "--examples"
puts "'v8'.f # => instance of the v8 formula"
puts ":hub.f.installed?"
diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb
index f5c4e68ac..436fc1f97 100644
--- a/Library/Homebrew/cmd/list.rb
+++ b/Library/Homebrew/cmd/list.rb
@@ -39,15 +39,7 @@ module Homebrew
filtered_list
elsif ARGV.named.empty?
if ARGV.include? "--full-name"
- full_names = Formula.installed.map(&:full_name).sort do |a, b|
- if a.include?("/") && !b.include?("/")
- 1
- elsif !a.include?("/") && b.include?("/")
- -1
- else
- a <=> b
- end
- end
+ full_names = Formula.installed.map(&:full_name).sort &tap_and_name_comparison
return if full_names.empty?
puts Formatter.columns(full_names)
else
diff --git a/Library/Homebrew/cmd/pin.rb b/Library/Homebrew/cmd/pin.rb
index c5087f6d4..5a14f853c 100644
--- a/Library/Homebrew/cmd/pin.rb
+++ b/Library/Homebrew/cmd/pin.rb
@@ -1,6 +1,7 @@
#: * `pin` <formulae>:
#: Pin the specified <formulae>, preventing them from being upgraded when
-#: issuing the `brew upgrade` command. See also `unpin`.
+#: issuing the `brew upgrade <formulae>` command (but can still be upgraded
+#: as dependencies for other formulae). See also `unpin`.
require "formula"
diff --git a/Library/Homebrew/cmd/postinstall.rb b/Library/Homebrew/cmd/postinstall.rb
index f5d091227..02fd8a5f6 100644
--- a/Library/Homebrew/cmd/postinstall.rb
+++ b/Library/Homebrew/cmd/postinstall.rb
@@ -29,8 +29,6 @@ module Homebrew
args << "--devel"
end
- Sandbox.print_sandbox_message if Sandbox.formula?(formula)
-
Utils.safe_fork do
if Sandbox.formula?(formula)
sandbox = Sandbox.new
diff --git a/Library/Homebrew/cmd/prune.rb b/Library/Homebrew/cmd/prune.rb
index 9fc6dbcd9..7ec2838ba 100644
--- a/Library/Homebrew/cmd/prune.rb
+++ b/Library/Homebrew/cmd/prune.rb
@@ -55,7 +55,7 @@ module Homebrew
else
n, d = ObserverPathnameExtension.counts
print "Pruned #{n} symbolic links "
- print "and #{d} directories " if d > 0
+ print "and #{d} directories " if d.positive?
puts "from #{HOMEBREW_PREFIX}"
end
end
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb
index 94096d2dd..6727c0b6b 100644
--- a/Library/Homebrew/cmd/reinstall.rb
+++ b/Library/Homebrew/cmd/reinstall.rb
@@ -47,8 +47,8 @@ module Homebrew
fi.install
fi.finish
rescue FormulaInstallationAlreadyAttemptedError
- # next
- rescue Exception
+ return
+ rescue Exception # rubocop:disable Lint/RescueException
ignore_interrupts { restore_backup(keg, keg_was_linked) }
raise
else
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index b2d069744..c01a11c10 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -34,38 +34,40 @@ module Homebrew
elsif ARGV.include? "--opensuse"
exec_browser "https://software.opensuse.org/search?q=#{ARGV.next}"
elsif ARGV.include? "--fedora"
- exec_browser "https://admin.fedoraproject.org/pkgdb/packages/%2A#{ARGV.next}%2A/"
+ exec_browser "https://apps.fedoraproject.org/packages/s/#{ARGV.next}"
elsif ARGV.include? "--ubuntu"
- exec_browser "http://packages.ubuntu.com/search?keywords=#{ARGV.next}&searchon=names&suite=all&section=all"
+ exec_browser "https://packages.ubuntu.com/search?keywords=#{ARGV.next}&searchon=names&suite=all&section=all"
elsif ARGV.include? "--desc"
query = ARGV.next
regex = query_regexp(query)
Descriptions.search(regex, :desc).print
elsif ARGV.first =~ HOMEBREW_TAP_FORMULA_REGEX
query = ARGV.first
- user, repo, name = query.split("/", 3)
begin
result = Formulary.factory(query).name
+ results = Array(result)
rescue FormulaUnavailableError
- result = search_tap(user, repo, name)
+ _, _, name = query.split("/", 3)
+ results = search_taps(name)
end
- results = Array(result)
puts Formatter.columns(results) unless results.empty?
else
query = ARGV.first
regex = query_regexp(query)
local_results = search_formulae(regex)
puts Formatter.columns(local_results) unless local_results.empty?
+
tap_results = search_taps(query)
puts Formatter.columns(tap_results) unless tap_results.empty?
if $stdout.tty?
count = local_results.length + tap_results.length
+ ohai "Searching blacklisted, migrated and deleted formulae..."
if reason = Homebrew::MissingFormula.reason(query, silent: true)
- if count > 0
+ if count.positive?
puts
puts "If you meant #{query.inspect} specifically:"
end
@@ -100,10 +102,18 @@ module Homebrew
odie "#{query} is not a valid regex"
end
- def search_taps(query)
+ def search_taps(query, silent: false)
+ return [] if ENV["HOMEBREW_NO_GITHUB_API"]
+
+ # Use stderr to avoid breaking parsed output
+ unless silent
+ $stderr.puts Formatter.headline("Searching taps on GitHub...", color: :blue)
+ end
+
valid_dirnames = ["Formula", "HomebrewFormula", "Casks", "."].freeze
- matches = GitHub.search_code("user:Homebrew", "user:caskroom", "filename:#{query}", "extension:rb")
- [*matches].map do |match|
+ matches = GitHub.search_code(user: ["Homebrew", "caskroom"], filename: query, extension: "rb")
+
+ matches.map do |match|
dirname, filename = File.split(match["path"])
next unless valid_dirnames.include?(dirname)
tap = Tap.fetch(match["repository"]["full_name"])
@@ -113,6 +123,9 @@ module Homebrew
end
def search_formulae(regex)
+ # Use stderr to avoid breaking parsed output
+ $stderr.puts Formatter.headline("Searching local taps...", color: :blue)
+
aliases = Formula.alias_full_names
results = (Formula.full_names + aliases).grep(regex).sort
diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb
index b0f46fadc..58f430a27 100644
--- a/Library/Homebrew/cmd/style.rb
+++ b/Library/Homebrew/cmd/style.rb
@@ -117,12 +117,13 @@ module Homebrew
case output_type
when :print
+ args << "--debug" if ARGV.debug?
args << "--display-cop-names" if ARGV.include? "--display-cop-names"
args << "--format" << "simple" if files
- system(cache_env, "rubocop", *args)
+ system(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", *args)
!$CHILD_STATUS.success?
when :json
- json, _, status = Open3.capture3(cache_env, "rubocop", "--format", "json", *args)
+ json, _, status = Open3.capture3(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", "--format", "json", *args)
# exit status of 1 just means violations were found; other numbers mean
# execution errors.
# exitstatus can also be nil if RuboCop process crashes, e.g. due to
diff --git a/Library/Homebrew/cmd/tap-info.rb b/Library/Homebrew/cmd/tap-info.rb
index af087645d..cb0e0b387 100644
--- a/Library/Homebrew/cmd/tap-info.rb
+++ b/Library/Homebrew/cmd/tap-info.rb
@@ -64,10 +64,10 @@ module Homebrew
if tap.installed?
info += tap.pinned? ? "pinned" : "unpinned"
info += ", private" if tap.private?
- if (formula_count = tap.formula_files.size) > 0
+ if (formula_count = tap.formula_files.size).positive?
info += ", #{Formatter.pluralize(formula_count, "formula")}"
end
- if (command_count = tap.command_files.size) > 0
+ if (command_count = tap.command_files.size).positive?
info += ", #{Formatter.pluralize(command_count, "command")}"
end
info += ", no formulae/commands" if (formula_count + command_count).zero?
diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb
index 2a07c1b2f..fa520e2c5 100644
--- a/Library/Homebrew/cmd/tap.rb
+++ b/Library/Homebrew/cmd/tap.rb
@@ -54,8 +54,7 @@ module Homebrew
quiet: ARGV.quieter?
rescue TapRemoteMismatchError => e
odie e
- rescue TapAlreadyTappedError, TapAlreadyUnshallowError
- # Do nothing.
+ rescue TapAlreadyTappedError, TapAlreadyUnshallowError # rubocop:disable Lint/HandleExceptions
end
end
end
diff --git a/Library/Homebrew/cmd/unlinkapps.rb b/Library/Homebrew/cmd/unlinkapps.rb
index 7cae97e27..56dba3603 100644
--- a/Library/Homebrew/cmd/unlinkapps.rb
+++ b/Library/Homebrew/cmd/unlinkapps.rb
@@ -77,7 +77,7 @@ module Homebrew
def unlinkapps_unlink?(target_app, opts = {})
# Skip non-symlinks and symlinks that don't point into the Homebrew prefix.
app = target_app.readlink.to_s if target_app.symlink?
- return false unless app && app.start_with?(*UNLINKAPPS_PREFIXES)
+ return false unless app&.start_with?(*UNLINKAPPS_PREFIXES)
if opts.fetch(:prune, false)
!File.exist?(app) # Remove only broken symlinks in prune mode.
diff --git a/Library/Homebrew/cmd/unpin.rb b/Library/Homebrew/cmd/unpin.rb
index a669df1ec..e15a156ea 100644
--- a/Library/Homebrew/cmd/unpin.rb
+++ b/Library/Homebrew/cmd/unpin.rb
@@ -1,6 +1,6 @@
#: * `unpin` <formulae>:
-#: Unpin <formulae>, allowing them to be upgraded by `brew upgrade`. See also
-#: `pin`.
+#: Unpin <formulae>, allowing them to be upgraded by `brew upgrade <formulae>`.
+#: See also `pin`.
require "formula"
diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb
index ea915f99c..0974df0b4 100644
--- a/Library/Homebrew/cmd/update-report.rb
+++ b/Library/Homebrew/cmd/update-report.rb
@@ -124,7 +124,7 @@ module Homebrew
return if ENV["HOMEBREW_UPDATE_TEST"]
core_tap = CoreTap.instance
return if core_tap.installed?
- CoreTap.ensure_installed! quiet: false
+ CoreTap.ensure_installed!
revision = core_tap.git_head
ENV["HOMEBREW_UPDATE_BEFORE_HOMEBREW_HOMEBREW_CORE"] = revision
ENV["HOMEBREW_UPDATE_AFTER_HOMEBREW_HOMEBREW_CORE"] = revision
@@ -203,6 +203,7 @@ module Homebrew
end
new_homebrew_repository = Pathname.new "/usr/local/Homebrew"
+ new_homebrew_repository.rmdir_if_possible
if new_homebrew_repository.exist?
ofail <<-EOS.undent
#{new_homebrew_repository} already exists.
@@ -371,7 +372,7 @@ class Reporter
new_version = formula.pkg_version
old_version = FormulaVersions.new(formula).formula_at_revision(@initial_revision, &:pkg_version)
next if new_version == old_version
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer?
end
@report[:M] << tap.formula_file_to_name(src)
@@ -459,7 +460,7 @@ class Reporter
unless Formulary.factory(new_full_name).keg_only?
system HOMEBREW_BREW_FILE, "link", new_full_name, "--overwrite"
end
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer?
end
next
@@ -520,7 +521,7 @@ class Reporter
begin
f = Formulary.factory(new_full_name)
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer?
next
end
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh
index fb6a3459c..3507fa92b 100644
--- a/Library/Homebrew/cmd/update.sh
+++ b/Library/Homebrew/cmd/update.sh
@@ -385,6 +385,12 @@ EOS
if ! git --version >/dev/null 2>&1
then
+ # we need a new enough curl to install git
+ if [[ -n "$HOMEBREW_SYSTEM_CURL_TOO_OLD" &&
+ ! -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]]
+ then
+ brew install curl
+ fi
# we cannot install brewed git if homebrew/core is unavailable.
[[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && brew install git
unset GIT_EXECUTABLE
@@ -564,6 +570,7 @@ EOS
-d "$HOMEBREW_LIBRARY/LinkedKegs" ||
(-n "$HOMEBREW_DEVELOPER" && -z "$HOMEBREW_UPDATE_PREINSTALL") ]]
then
+ unset HOMEBREW_RUBY_PATH
brew update-report "$@"
return $?
elif [[ -z "$HOMEBREW_UPDATE_PREINSTALL" ]]
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index 1cdb497cf..f1ce3c7da 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -150,6 +150,7 @@ module Homebrew
rescue FormulaInstallationAlreadyAttemptedError
# We already attempted to upgrade f as part of the dependency tree of
# another formula. In that case, don't generate an error, just move on.
+ return
rescue CannotInstallFormulaError => e
ofail e
rescue BuildError => e
diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb
index 24684c3b6..0b09e1bf1 100644
--- a/Library/Homebrew/cmd/uses.rb
+++ b/Library/Homebrew/cmd/uses.rb
@@ -74,12 +74,13 @@ module Homebrew
end
end
- dep_formulae = deps.map do |dep|
+ dep_formulae = deps.flat_map do |dep|
begin
dep.to_formula
rescue
+ []
end
- end.compact
+ end
reqs_by_formula = ([f] + dep_formulae).flat_map do |formula|
formula.requirements.map { |req| [formula, req] }
@@ -118,6 +119,7 @@ module Homebrew
rescue FormulaUnavailableError
# Silently ignore this case as we don't care about things used in
# taps that aren't currently tapped.
+ next
end
end
end
diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh
index fe7e26dd4..6d16a297d 100644
--- a/Library/Homebrew/cmd/vendor-install.sh
+++ b/Library/Homebrew/cmd/vendor-install.sh
@@ -13,16 +13,16 @@ if [[ -n "$HOMEBREW_MACOS" ]]
then
if [[ "$HOMEBREW_PROCESSOR" = "Intel" ]]
then
- ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.0.0-p648.leopard_64.bottle.tar.gz"
- ruby_SHA="5c1240abe4be91c9774a0089c2a38a8ccfff87c009e8e5786730c659d5e633f7"
+ ruby_URL="https://homebrew.bintray.com/bottles-portable/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
- ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.0.0-p648.x86_64_linux.bottle.tar.gz"
- ruby_SHA="dbb5118a22a6a75cc77e62544a3d8786d383fab1bdaf8c154951268807357bf0"
+ ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.x86_64_linux.bottle.tar.gz"
+ ruby_SHA="543c18bd33a300e6c16671437b1e0f17b03bb64e6a485fc15ff7de1eb1a0bc2a"
fi
fetch() {
@@ -45,20 +45,25 @@ fetch() {
curl_args[${#curl_args[*]}]="--progress-bar"
fi
+ if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100600" ]]
+ then
+ curl_args[${#curl_args[*]}]="--insecure"
+ fi
+
temporary_path="$CACHED_LOCATION.incomplete"
mkdir -p "$HOMEBREW_CACHE"
- [[ -n "$HOMEBREW_QUIET" ]] || echo "==> Downloading $VENDOR_URL"
+ [[ -n "$HOMEBREW_QUIET" ]] || echo "==> Downloading $VENDOR_URL" >&2
if [[ -f "$CACHED_LOCATION" ]]
then
- [[ -n "$HOMEBREW_QUIET" ]] || echo "Already downloaded: $CACHED_LOCATION"
+ [[ -n "$HOMEBREW_QUIET" ]] || echo "Already downloaded: $CACHED_LOCATION" >&2
else
if [[ -f "$temporary_path" ]]
then
"$HOMEBREW_CURL" "${curl_args[@]}" -C - "$VENDOR_URL" -o "$temporary_path"
if [[ $? -eq 33 ]]
then
- [[ -n "$HOMEBREW_QUIET" ]] || echo "Trying a full download"
+ [[ -n "$HOMEBREW_QUIET" ]] || echo "Trying a full download" >&2
rm -f "$temporary_path"
"$HOMEBREW_CURL" "${curl_args[@]}" "$VENDOR_URL" -o "$temporary_path"
fi
@@ -135,7 +140,7 @@ install() {
fi
safe_cd "$VENDOR_DIR"
- [[ -n "$HOMEBREW_QUIET" ]] || echo "==> Unpacking $(basename "$VENDOR_URL")"
+ [[ -n "$HOMEBREW_QUIET" ]] || echo "==> Pouring $(basename "$VENDOR_URL")" >&2
tar "$tar_args" "$CACHED_LOCATION"
safe_cd "$VENDOR_DIR/portable-$VENDOR_NAME"