Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

Commit

Permalink
Merge tag Homebrew/1.8.6 into Linuxbrew/master
Browse files Browse the repository at this point in the history
  • Loading branch information
sjackman committed Dec 17, 2018
2 parents e659ce9 + 858c5e1 commit aed4548
Show file tree
Hide file tree
Showing 140 changed files with 174 additions and 61 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def check_https_availability
check_url_for_https_availability(cask.url, user_agents: [cask.url.user_agent])
end
check_url_for_https_availability(cask.appcast) unless cask.appcast.blank?
check_url_for_https_availability(cask.homepage) unless cask.homepage.blank?
check_url_for_https_availability(cask.homepage, user_agents: [:browser]) unless cask.homepage.blank?
end

def check_url_for_https_availability(url_to_check, user_agents: [:default])
Expand Down
30 changes: 25 additions & 5 deletions Library/Homebrew/cmd/cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,32 @@
module Homebrew
module_function

def cleanup
CLI::Parser.parse do
switch "-n", "--dry-run"
switch "-s"
flag "--prune="
def cleanup_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`cleanup` [<options>] [<formulae>|<casks>]
Remove stale lock files and outdated downloads for formulae and casks,
and remove old versions of installed formulae. If arguments are specified,
only do this for the specified formulae and casks.
EOS

flag "--prune=",
description: "Remove all cache files older than specified <days>."
switch "-n", "--dry-run",
description: "Show what would be removed, but do not actually remove anything."
switch "-s",
description: "Scrub the cache, including downloads for even the latest versions. "\
"Note downloads for any installed formula or cask will still not be deleted. "\
"If you want to delete those too: `rm -rf \"$(brew --cache)\"`"
switch :verbose
switch :debug
end
end

def cleanup
cleanup_args.parse

cleanup = Cleanup.new(*args.remaining, dry_run: args.dry_run?, scrub: args.s?, days: args.prune&.to_i)

Expand Down
58 changes: 48 additions & 10 deletions Library/Homebrew/cmd/info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

require "missing_formula"
require "caveats"
require "cli_parser"
require "options"
require "formula"
require "keg"
Expand All @@ -45,12 +46,49 @@
module Homebrew
module_function

def info_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`info [<formulae>]`
Display brief statistics for your Homebrew installation.
EOS
switch "--analytics",
description: "Display Homebrew analytics data (provided neither `HOMEBREW_NO_ANALYTICS` "\
"or `HOMEBREW_NO_GITHUB_API` are set)."
flag "--days",
depends_on: "--analytics",
description: "The value for `days` must be `30`, `90` or `365`. The default is `30`."
flag "--category",
depends_on: "--analytics",
description: "The value for `category` must be `install`, `install-on-request`, "\
"`build-error` or `os-version`. The default is `install`."
switch "--github",
description: "Open a browser to the GitHub History page for provided <formula>. "\
"To view formula history locally: `brew log -p` <formula>"
flag "--json=",
description: "Print a JSON representation of <formulae>. Currently the only accepted "\
"value for <version> is `v1`. See the docs for examples of using the JSON "\
"output: <https://docs.brew.sh/Querying-Brew>"
switch "--all",
depends_on: "--json",
description: "Get information on all formulae."
switch "--installed",
depends_on: "--json",
description: "Get information on all installed formulae."
switch :verbose,
description: "See more verbose analytics data."
switch :debug
end
end

def info
info_args.parse
# eventually we'll solidify an API, but we'll keep old versions
# awhile around for compatibility
if ARGV.json == "v1"
if args.json == "v1"
print_json
elsif ARGV.flag? "--github"
elsif args.github?
exec_browser(*ARGV.formulae.map { |f| github_info(f) })
else
print_info
Expand All @@ -59,7 +97,7 @@ def info

def print_info
if ARGV.named.empty?
if ARGV.include?("--analytics")
if args.analytics?
output_analytics
elsif HOMEBREW_CELLAR.exist?
count = Formula.racks.length
Expand All @@ -74,13 +112,13 @@ def print_info
else
Formulary.find_with_priority(f)
end
if ARGV.include?("--analytics")
if args.analytics?
output_formula_analytics(formula)
else
info_formula(formula)
end
rescue FormulaUnavailableError => e
if ARGV.include?("--analytics")
if args.analytics?
output_analytics(filter: f)
next
end
Expand All @@ -95,9 +133,9 @@ def print_info
end

def print_json
ff = if ARGV.include? "--all"
ff = if args.all?
Formula.sort
elsif ARGV.include? "--installed"
elsif args.installed?
Formula.installed.sort
else
ARGV.formulae
Expand Down Expand Up @@ -308,13 +346,13 @@ def analytics_table(category, days, results, os_version: false)
end

def output_analytics(filter: nil)
days = ARGV.value("days") || "30"
days = args.days || "30"
valid_days = %w[30 90 365]
unless valid_days.include?(days)
raise ArgumentError("Days must be one of #{valid_days.join(", ")}!")
end

category = ARGV.value("category") || "install"
category = args.category || "install"
valid_categories = %w[install install-on-request build-error os-version]
unless valid_categories.include?(category)
raise ArgumentError("Categories must be one of #{valid_categories.join(", ")}")
Expand Down Expand Up @@ -349,7 +387,7 @@ def output_formula_analytics(f)
json = formulae_api_json("formula/#{f}.json")
return if json.blank? || json["analytics"].blank?

full_analytics = ARGV.include?("--analytics") || ARGV.verbose?
full_analytics = args.analytics? || args.verbose?

ohai "Analytics"
json["analytics"].each do |category, value|
Expand Down
27 changes: 23 additions & 4 deletions Library/Homebrew/cmd/uninstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,33 @@
require "formula"
require "diagnostic"
require "migrator"
require "cli_parser"

module Homebrew
module_function

def uninstall_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`uninstall`, `rm`, `remove` [<options>] <formula>
Uninstall <formula>.
EOS
switch :force,
description: "Delete all installed versions of the <formula>"
switch "--ignore-dependencies",
description: "Dont fail uninstall, even if <formula> is a dependency of any installed "\
"formulae."
switch :debug
end
end

def uninstall
raise KegUnspecifiedError if ARGV.named.empty?
uninstall_args.parse

raise KegUnspecifiedError if args.remaining.empty?

kegs_by_rack = if ARGV.force?
kegs_by_rack = if args.force?
Hash[ARGV.named.map do |name|
rack = Formulary.to_rack(name)
next unless rack.directory?
Expand All @@ -33,7 +52,7 @@ def uninstall
return if Homebrew.failed?

kegs_by_rack.each do |rack, kegs|
if ARGV.force?
if args.force?
name = rack.basename

if rack.directory?
Expand Down Expand Up @@ -87,7 +106,7 @@ def uninstall
end

def handle_unsatisfied_dependents(kegs_by_rack)
return if ARGV.include?("--ignore-dependencies")
return if args.ignore_dependencies?

all_kegs = kegs_by_rack.values.flatten(1)
check_for_dependents all_kegs
Expand Down
17 changes: 17 additions & 0 deletions Library/Homebrew/dev-cmd/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,23 @@ def audit_keg_only_style
problem "keg_only reason should not end with a period."
end

def audit_postgresql
return unless formula.name == "postgresql"
major_version = formula.version
.to_s
.split(".")
.first
.to_i
previous_major_version = major_version - 1
previous_formula_name = "postgresql@#{previous_major_version}"
begin
Formula[previous_formula_name]
rescue FormulaUnavailableError
problem "Versioned #{previous_formula_name} must be created for " \
"`brew-postgresql-upgrade-database` and `pg_upgrade` to work."
end
end

def audit_versioned_keg_only
return unless @versioned_formula
return unless @core_tap
Expand Down
3 changes: 3 additions & 0 deletions Library/Homebrew/download_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,9 @@ def config_repo
system_command! "git",
args: ["config", "remote.origin.fetch", refspec],
chdir: cached_location
system_command! "git",
args: ["config", "remote.origin.tagOpt", "--no-tags"],
chdir: cached_location
end

def update_repo
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/ENV/shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def compiler_with_cxx11_support?(cc)
return if compiler_any_clang?(cc)

version = if cc == :gcc
non_apple_gcc_version "gcc"
DevelopmentTools.non_apple_gcc_version "gcc"
else
cc[/^gcc-(\d+(?:\.\d+)?)$/, 1]
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/requirements/java_requirement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def oracle_java_os
end

def satisfies_version(java)
java_version_s = system_command(java, args: ["-version"], print_stderr: false).stderr[/\d+.\d/]
java_version_s = system_command(java, args: ["-version"], print_stderr: false).stderr[/\d+\.\d/]
return false unless java_version_s

java_version = Version.create(java_version_s)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/rubocops/lines.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
end

[:mac?, :linux?].each do |method_name|
next if formula_tap != "homebrew-core" || file_path&.match(/linuxbrew/)
next if formula_tap != "homebrew-core" || file_path&.include?("linuxbrew")

find_instance_method_call(body_node, "OS", method_name) do |check|
problem "Don't use #{check.source}; Homebrew/core only supports macOS"
Expand Down
5 changes: 3 additions & 2 deletions Library/Homebrew/shims/super/cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def linux?
end

class Cmd
attr_reader :config, :prefix, :cellar, :opt, :tmpdir, :sysroot, :deps
attr_reader :config, :prefix, :cellar, :opt, :cachedir, :tmpdir, :sysroot, :deps
attr_reader :archflags, :optflags, :keg_regex, :formula_prefix

def initialize(arg0, args)
Expand All @@ -35,6 +35,7 @@ class Cmd
@config = ENV.fetch("HOMEBREW_CCCFG") { "" }
@prefix = ENV["HOMEBREW_PREFIX"]
@cellar = ENV["HOMEBREW_CELLAR"]
@cachedir = ENV["HOMEBREW_CACHE"]
@opt = ENV["HOMEBREW_OPT"]
@tmpdir = ENV["HOMEBREW_TEMP"]
@sysroot = ENV["HOMEBREW_SDKROOT"]
Expand Down Expand Up @@ -242,7 +243,7 @@ class Cmd
elsif path.start_with?(cellar) || path.start_with?(opt)
dep = path[keg_regex, 2]
dep && @deps.include?(dep)
elsif path.start_with?(prefix, tmpdir)
elsif path.start_with?(prefix, cachedir, tmpdir)
true
elsif path.start_with?("/opt/local", "/opt/boxen/homebrew", "/opt/X11", "/sw", "/usr/X11")
# ignore MacPorts, Boxen's Homebrew, X11, fink
Expand Down
4 changes: 3 additions & 1 deletion Library/Homebrew/test/cmd/uninstall_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
end

specify "when not developer and --ignore-dependencies is specified" do
ARGV << "--ignore-dependencies"
described_class.args = described_class.args.dup if described_class.args.frozen?
expect(described_class.args).to receive(:ignore_dependencies?).and_return(true)
described_class.args.freeze

expect {
described_class.handle_unsatisfied_dependents(opts)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/vendor/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GEM
tzinfo (~> 1.1)
ast (2.4.0)
backports (3.11.4)
concurrent-ruby (1.1.3)
concurrent-ruby (1.1.4)
i18n (1.1.1)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.1)
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
ruby_version = RbConfig::CONFIG["ruby_version"]
path = File.expand_path('..', __FILE__)
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.4/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.1.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.11.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib"
Expand All @@ -21,6 +21,6 @@
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.4.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.61.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.61.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.30.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.1.0/lib"
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ class JavaExecutorService < AbstractExecutorService

def initialize(*args, &block)
super
ns_make_executor_runnable
end

def post(*args, &task)
raise ArgumentError.new('no block given') unless block_given?
return handle_fallback(*args, &task) unless running?
@executor.submit_runnable Job.new(args, task)
@executor.submit Job.new(args, task)
true
rescue Java::JavaUtilConcurrent::RejectedExecutionException
raise RejectedExecutionError
Expand Down Expand Up @@ -75,14 +74,6 @@ def ns_shutdown?
@executor.isShutdown || @executor.isTerminated
end

def ns_make_executor_runnable
if !defined?(@executor.submit_runnable)
@executor.class.class_eval do
java_alias :submit_runnable, :submit, [java.lang.Runnable.java_class]
end
end
end

class Job
include Runnable
def initialize(args, block)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def ns_initialize(*values)
end
unless name.nil?
begin
parent.send :remove_const, name if parent.const_defined? name
parent.send :remove_const, name if parent.const_defined?(name, false)
parent.const_set(name, clazz)
clazz
rescue NameError
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Concurrent
VERSION = '1.1.3'
VERSION = '1.1.4'
EDGE_VERSION = '0.4.1'
end
Loading

0 comments on commit aed4548

Please sign in to comment.