aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMike McQuaid2017-02-26 20:48:36 +0000
committerMike McQuaid2017-02-26 20:48:36 +0000
commitc2a460ec6d857ba33c89174d8d93fcaa403c3717 (patch)
tree089045fec4c46fb74e3b48868e2b335497df7b84 /Library/Homebrew/cmd
parentd3ae1cc264dc9eb9b602dd6aa21c4282dc049c79 (diff)
parentff93e1624b214c9b48731174a9135789fc3695a8 (diff)
downloadbrew-c2a460ec6d857ba33c89174d8d93fcaa403c3717.tar.bz2
Merge branch 'master' into filter_all_env_vars_932
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/--prefix.rb4
-rw-r--r--Library/Homebrew/cmd/cleanup.rb2
-rw-r--r--Library/Homebrew/cmd/deps.rb2
-rw-r--r--Library/Homebrew/cmd/desc.rb7
-rw-r--r--Library/Homebrew/cmd/info.rb4
-rw-r--r--Library/Homebrew/cmd/install.rb8
-rw-r--r--Library/Homebrew/cmd/irb.rb1
-rw-r--r--Library/Homebrew/cmd/log.rb2
-rw-r--r--Library/Homebrew/cmd/outdated.rb2
-rw-r--r--Library/Homebrew/cmd/readall.rb2
-rw-r--r--Library/Homebrew/cmd/reinstall.rb20
-rw-r--r--Library/Homebrew/cmd/search.rb2
-rw-r--r--Library/Homebrew/cmd/style.rb2
-rw-r--r--Library/Homebrew/cmd/tap-info.rb2
-rw-r--r--Library/Homebrew/cmd/unlink.rb2
-rw-r--r--Library/Homebrew/cmd/unpack.rb2
-rw-r--r--Library/Homebrew/cmd/update-report.rb10
-rw-r--r--Library/Homebrew/cmd/update-reset.sh2
-rw-r--r--Library/Homebrew/cmd/update.sh2
-rw-r--r--Library/Homebrew/cmd/upgrade.rb24
-rw-r--r--Library/Homebrew/cmd/uses.rb32
21 files changed, 91 insertions, 43 deletions
diff --git a/Library/Homebrew/cmd/--prefix.rb b/Library/Homebrew/cmd/--prefix.rb
index f6e7d2ee2..956ab0403 100644
--- a/Library/Homebrew/cmd/--prefix.rb
+++ b/Library/Homebrew/cmd/--prefix.rb
@@ -11,7 +11,9 @@ module Homebrew
if ARGV.named.empty?
puts HOMEBREW_PREFIX
else
- puts ARGV.resolved_formulae.map(&:installed_prefix)
+ puts ARGV.resolved_formulae.map { |f|
+ f.opt_prefix.exist? ? f.opt_prefix : f.installed_prefix
+ }
end
end
end
diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb
index 5b46e0872..126309579 100644
--- a/Library/Homebrew/cmd/cleanup.rb
+++ b/Library/Homebrew/cmd/cleanup.rb
@@ -7,7 +7,7 @@
#: If `--dry-run` or `-n` is passed, show what would be removed, but do not
#: actually remove anything.
#:
-#: If `-s` is passed, scrubs the cache, removing downloads for even the latest
+#: If `-s` is passed, scrub the cache, removing downloads for even the latest
#: versions of formulae. Note downloads for any installed formulae will still not be
#: deleted. If you want to delete those too: `rm -rf $(brew --cache)`
diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb
index 205cbe172..f80bdfb0d 100644
--- a/Library/Homebrew/cmd/deps.rb
+++ b/Library/Homebrew/cmd/deps.rb
@@ -50,7 +50,7 @@ module Homebrew
tree?: ARGV.include?("--tree"),
all?: ARGV.include?("--all"),
topo_order?: ARGV.include?("-n"),
- union?: ARGV.include?("--union")
+ union?: ARGV.include?("--union"),
)
if mode.installed? && mode.tree?
diff --git a/Library/Homebrew/cmd/desc.rb b/Library/Homebrew/cmd/desc.rb
index 3ef02288b..53291602e 100644
--- a/Library/Homebrew/cmd/desc.rb
+++ b/Library/Homebrew/cmd/desc.rb
@@ -1,11 +1,10 @@
#: * `desc` <formula>:
#: Display <formula>'s name and one-line description.
#:
-#: * `desc` [`-s`|`-n`|`-d`] <pattern>:
+#: * `desc` [`-s`|`-n`|`-d`] (<text>|`/`<text>`/`):
#: Search both name and description (`-s`), just the names (`-n`), or just the
-#: descriptions (`-d`) for `<pattern>`. `<pattern>` is by default interpreted
-#: as a literal string; if flanked by slashes, it is instead interpreted as a
-#: regular expression. Formula descriptions are cached; the cache is created on
+#: descriptions (`-d`) for <text>. If <text> is flanked by slashes, it is interpreted
+#: as a regular expression. Formula descriptions are cached; the cache is created on
#: the first search, making that search slower than subsequent ones.
require "descriptions"
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index 1850ae003..b06d99466 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -4,7 +4,7 @@
#: * `info` `--github` <formula>:
#: Open a browser to the GitHub History page for formula <formula>.
#:
-#: To view formula history locally: `brew log -p <formula>`.
+#: To view formula history locally: `brew log -p <formula>`
#:
#: * `info` `--json=`<version> (`--all`|`--installed`|<formulae>):
#: Print a JSON representation of <formulae>. Currently the only accepted value
@@ -13,7 +13,7 @@
#: Pass `--all` to get information on all formulae, or `--installed` to get
#: information on all installed formulae.
#:
-#: See the docs for examples of using the JSON:
+#: See the docs for examples of using the JSON output:
#: <http://docs.brew.sh/Querying-Brew.html>
require "blacklist"
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index fbfe46e71..5a3aeb7b3 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -184,6 +184,14 @@ module Homebrew
# FormulaInstaller will handle this case.
formulae << f
end
+
+ # Even if we don't install this formula mark it as no longer just
+ # installed as a dependency.
+ next unless f.opt_prefix.directory?
+ keg = Keg.new(f.opt_prefix.resolved_path)
+ tab = Tab.for_keg(keg)
+ tab.installed_on_request = true
+ tab.write
end
perform_preinstall_checks
diff --git a/Library/Homebrew/cmd/irb.rb b/Library/Homebrew/cmd/irb.rb
index d162e3f4a..5561845e7 100644
--- a/Library/Homebrew/cmd/irb.rb
+++ b/Library/Homebrew/cmd/irb.rb
@@ -12,6 +12,7 @@ class Symbol
Formulary.factory(to_s, *args)
end
end
+
class String
def f(*args)
Formulary.factory(self, *args)
diff --git a/Library/Homebrew/cmd/log.rb b/Library/Homebrew/cmd/log.rb
index 81f972b02..22a3ee11d 100644
--- a/Library/Homebrew/cmd/log.rb
+++ b/Library/Homebrew/cmd/log.rb
@@ -26,7 +26,7 @@ module Homebrew
EOS
end
args = ARGV.options_only
- args += ["--", path] unless path.nil?
+ args += ["--follow", "--", path] unless path.nil?
exec "git", "log", *args
end
end
diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb
index 9ed7a0f79..a18f4e399 100644
--- a/Library/Homebrew/cmd/outdated.rb
+++ b/Library/Homebrew/cmd/outdated.rb
@@ -1,4 +1,4 @@
-#: * `outdated` [`--quiet`|`--verbose`|`--json=v1`] [`--fetch-HEAD`]:
+#: * `outdated` [`--quiet`|`--verbose`|`--json=`<version>] [`--fetch-HEAD`]:
#: Show formulae that have an updated version available.
#:
#: By default, version information is displayed in interactive shells, and
diff --git a/Library/Homebrew/cmd/readall.rb b/Library/Homebrew/cmd/readall.rb
index 7c1a085c9..3591e0c09 100644
--- a/Library/Homebrew/cmd/readall.rb
+++ b/Library/Homebrew/cmd/readall.rb
@@ -4,7 +4,7 @@
#:
#: This can be useful for debugging issues across all formulae
#: when making significant changes to `formula.rb`,
-#: or to determine if any current formulae have Ruby issues
+#: or to determine if any current formulae have Ruby issues.
require "readall"
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb
index 2eb2840a5..586405909 100644
--- a/Library/Homebrew/cmd/reinstall.rb
+++ b/Library/Homebrew/cmd/reinstall.rb
@@ -25,19 +25,21 @@ module Homebrew
backup keg
end
- options = BuildOptions.new(Options.create(ARGV.flags_only), f.options).used_options
+ build_options = BuildOptions.new(Options.create(ARGV.flags_only), f.options)
+ options = build_options.used_options
options |= f.build.used_options
options &= f.options
fi = FormulaInstaller.new(f)
- fi.options = options
- fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
- fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source?
- fi.force_bottle = ARGV.force_bottle?
- fi.interactive = ARGV.interactive?
- fi.git = ARGV.git?
- fi.verbose = ARGV.verbose?
- fi.debug = ARGV.debug?
+ fi.options = options
+ fi.invalid_option_names = build_options.invalid_option_names
+ fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
+ fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source?
+ fi.force_bottle = ARGV.force_bottle?
+ fi.interactive = ARGV.interactive?
+ fi.git = ARGV.git?
+ fi.verbose = ARGV.verbose?
+ fi.debug = ARGV.debug?
fi.prelude
oh1 "Reinstalling #{f.full_name} #{options.to_a.join " "}"
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index d69164eb9..e834a00b5 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -2,7 +2,7 @@
#: Display all locally available formulae for brewing (including tapped ones).
#: No online search is performed if called without arguments.
#:
-#: * `search` [`--desc`] <text>|`/`<text>`/`:
+#: * `search` [`--desc`] (<text>|`/`<text>`/`):
#: Perform a substring search of formula names for <text>. If <text> is
#: surrounded with slashes, then it is interpreted as a regular expression.
#: The search for <text> is extended online to some popular taps.
diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb
index 9befcf9ac..3d12561c1 100644
--- a/Library/Homebrew/cmd/style.rb
+++ b/Library/Homebrew/cmd/style.rb
@@ -47,7 +47,7 @@ module Homebrew
def check_style_impl(files, output_type, options = {})
fix = options[:fix]
- Homebrew.install_gem_setup_path! "rubocop", "0.45.0"
+ Homebrew.install_gem_setup_path! "rubocop", HOMEBREW_RUBOCOP_VERSION
args = %w[
--force-exclusion
diff --git a/Library/Homebrew/cmd/tap-info.rb b/Library/Homebrew/cmd/tap-info.rb
index b46de30c1..225b70097 100644
--- a/Library/Homebrew/cmd/tap-info.rb
+++ b/Library/Homebrew/cmd/tap-info.rb
@@ -12,7 +12,7 @@
#:
#: Pass `--installed` to get information on installed taps.
#:
-#: See the docs for examples of using the JSON:
+#: See the docs for examples of using the JSON output:
#: <http://docs.brew.sh/Querying-Brew.html>
require "tap"
diff --git a/Library/Homebrew/cmd/unlink.rb b/Library/Homebrew/cmd/unlink.rb
index a105f9c56..3f858b2c4 100644
--- a/Library/Homebrew/cmd/unlink.rb
+++ b/Library/Homebrew/cmd/unlink.rb
@@ -1,7 +1,7 @@
#: * `unlink` [`--dry-run`] <formula>:
#: Remove symlinks for <formula> from the Homebrew prefix. This can be useful
#: for temporarily disabling a formula:
-#: `brew unlink foo && commands && brew link foo`.
+#: `brew unlink <formula> && <commands> && brew link <formula>`
#:
#: If `--dry-run` or `-n` is passed, Homebrew will list all files which would
#: be unlinked, but will not actually unlink or delete any files.
diff --git a/Library/Homebrew/cmd/unpack.rb b/Library/Homebrew/cmd/unpack.rb
index 4e6584e70..60d796d9f 100644
--- a/Library/Homebrew/cmd/unpack.rb
+++ b/Library/Homebrew/cmd/unpack.rb
@@ -1,7 +1,7 @@
#: * `unpack` [`--git`|`--patch`] [`--destdir=`<path>] <formulae>:
#: Unpack the source files for <formulae> into subdirectories of the current
#: working directory. If `--destdir=`<path> is given, the subdirectories will
-#: be created in the directory named by `<path>` instead.
+#: be created in the directory named by <path> instead.
#:
#: If `--patch` is passed, patches for <formulae> will be applied to the
#: unpacked source.
diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb
index dcf2891d9..7cc1ce264 100644
--- a/Library/Homebrew/cmd/update-report.rb
+++ b/Library/Homebrew/cmd/update-report.rb
@@ -475,12 +475,18 @@ class Reporter
if new_tap_name == "caskroom/cask"
if new_tap.installed? && (HOMEBREW_PREFIX/"Caskroom").directory?
ohai "#{name} has been moved to Homebrew-Cask."
- ohai "brew uninstall --force #{name}"
- system HOMEBREW_BREW_FILE, "uninstall", "--force", name
+ ohai "brew unlink #{name}"
+ system HOMEBREW_BREW_FILE, "unlink", name
ohai "brew prune"
system HOMEBREW_BREW_FILE, "prune"
ohai "brew cask install #{new_name}"
system HOMEBREW_BREW_FILE, "cask", "install", new_name
+ ohai <<-EOS.undent
+ #{name} has been moved to Homebrew-Cask.
+ The existing keg has been unlinked.
+ Please uninstall the formula when convenient by running:
+ brew uninstall --force #{name}
+ EOS
else
ohai "#{name} has been moved to Homebrew-Cask.", <<-EOS.undent
To uninstall the formula and install the cask run:
diff --git a/Library/Homebrew/cmd/update-reset.sh b/Library/Homebrew/cmd/update-reset.sh
index 32daffc96..3a9e1caa9 100644
--- a/Library/Homebrew/cmd/update-reset.sh
+++ b/Library/Homebrew/cmd/update-reset.sh
@@ -37,7 +37,7 @@ EOS
echo
echo "==> Resetting $DIR..."
- git checkout -B master origin/master
+ git checkout --force -B master origin/master
echo
done
}
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh
index 678622230..c5e618403 100644
--- a/Library/Homebrew/cmd/update.sh
+++ b/Library/Homebrew/cmd/update.sh
@@ -1,6 +1,6 @@
#: * `update` [`--merge`] [`--force`]:
#: Fetch the newest version of Homebrew and all formulae from GitHub using
-#: `git`(1).
+#: `git`(1) and perform any necessary migrations.
#:
#: If `--merge` is specified then `git merge` is used to include updates
#: (rather than `git rebase`).
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index 5b49a9f65..ce892f85c 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -94,14 +94,24 @@ module Homebrew
.select(&:directory?)
.map { |k| Keg.new(k.resolved_path) }
+ if f.opt_prefix.directory?
+ keg = Keg.new(f.opt_prefix.resolved_path)
+ tab = Tab.for_keg(keg)
+ end
+
fi = FormulaInstaller.new(f)
- fi.options = f.build.used_options
- fi.options &= f.options
- fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
- fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source?
- fi.verbose = ARGV.verbose?
- fi.quieter = ARGV.quieter?
- fi.debug = ARGV.debug?
+ fi.options = f.build.used_options
+ fi.options &= f.options
+ fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
+ fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source?
+ fi.verbose = ARGV.verbose?
+ fi.quieter = ARGV.quieter?
+ fi.debug = ARGV.debug?
+ fi.installed_on_request = !ARGV.named.empty?
+ if tab
+ fi.installed_as_dependency = tab.installed_as_dependency
+ fi.installed_on_request ||= tab.installed_on_request
+ end
fi.prelude
oh1 "Upgrading #{f.full_specified_name} #{fi.options.to_a.join " "}"
diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb
index fb11a31a7..b1122c90a 100644
--- a/Library/Homebrew/cmd/uses.rb
+++ b/Library/Homebrew/cmd/uses.rb
@@ -12,8 +12,8 @@
#: `--include-build`. Similarly, pass `--include-optional` to include `:optional`
#: dependencies. To skip `:recommended` type dependencies, pass `--skip-recommended`.
#:
-#: By default, `uses` shows usages of `formula` by stable builds. To find
-#: cases where `formula` is used by development or HEAD build, pass
+#: By default, `uses` shows usages of <formulae> by stable builds. To find
+#: cases where <formulae> is used by development or HEAD build, pass
#: `--devel` or `--HEAD`.
require "formula"
@@ -57,16 +57,36 @@ module Homebrew
elsif dep.build?
Dependency.prune unless includes.include?("build?")
end
+
+ # If a tap isn't installed, we can't find the dependencies of one
+ # its formulae, and an exception will be thrown if we try.
+ if dep.is_a?(TapDependency) && !dep.tap.installed?
+ Dependency.keep_but_prune_recursive_deps
+ end
+ end
+
+ dep_formulae = deps.map do |dep|
+ begin
+ dep.to_formula
+ rescue
+ end
+ end.compact
+
+ reqs_by_formula = ([f] + dep_formulae).flat_map do |formula|
+ formula.requirements.map { |req| [formula, req] }
end
- reqs = f.recursive_requirements do |dependent, req|
+
+ reqs_by_formula.reject! do |dependent, req|
if req.recommended?
- Requirement.prune if ignores.include?("recommended?") || dependent.build.without?(req)
+ ignores.include?("recommended?") || dependent.build.without?(req)
elsif req.optional?
- Requirement.prune if !includes.include?("optional?") && !dependent.build.with?(req)
+ !includes.include?("optional?") && !dependent.build.with?(req)
elsif req.build?
- Requirement.prune unless includes.include?("build?")
+ !includes.include?("build?")
end
end
+
+ reqs = reqs_by_formula.map(&:last)
else
deps = f.deps.reject do |dep|
ignores.any? { |ignore| dep.send(ignore) } && !includes.any? { |include| dep.send(include) }