aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/cleanup.rb14
-rw-r--r--Library/Homebrew/cmd/fetch.rb4
-rw-r--r--Library/Homebrew/cmd/install.rb24
-rw-r--r--Library/Homebrew/cmd/link.rb6
-rw-r--r--Library/Homebrew/cmd/migrate.rb2
-rw-r--r--Library/Homebrew/cmd/outdated.rb10
-rw-r--r--Library/Homebrew/cmd/reinstall.rb1
-rw-r--r--Library/Homebrew/cmd/uninstall.rb2
-rw-r--r--Library/Homebrew/cmd/unpack.rb2
-rw-r--r--Library/Homebrew/cmd/update-report.rb24
-rw-r--r--Library/Homebrew/cmd/update.sh2
-rw-r--r--Library/Homebrew/cmd/upgrade.rb1
12 files changed, 57 insertions, 35 deletions
diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb
index 126309579..d8f669e85 100644
--- a/Library/Homebrew/cmd/cleanup.rb
+++ b/Library/Homebrew/cmd/cleanup.rb
@@ -21,11 +21,14 @@ module Homebrew
if ARGV.named.empty?
Cleanup.cleanup
else
- ARGV.resolved_formulae.each { |f| Cleanup.cleanup_formula f }
+ Cleanup.cleanup_cellar(ARGV.resolved_formulae)
end
- return if Cleanup.disk_cleanup_size.zero?
+ report_disk_usage unless Cleanup.disk_cleanup_size.zero?
+ report_unremovable_kegs unless Cleanup.unremovable_kegs.empty?
+ end
+ def report_disk_usage
disk_space = disk_usage_readable(Cleanup.disk_cleanup_size)
if ARGV.dry_run?
ohai "This operation would free approximately #{disk_space} of disk space."
@@ -33,4 +36,11 @@ module Homebrew
ohai "This operation has freed approximately #{disk_space} of disk space."
end
end
+
+ def report_unremovable_kegs
+ ofail <<-EOS.undent
+ Could not cleanup old kegs! Fix your permissions on:
+ #{Cleanup.unremovable_kegs.join "\n "}
+ EOS
+ end
end
diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb
index 820a27e31..006c63746 100644
--- a/Library/Homebrew/cmd/fetch.rb
+++ b/Library/Homebrew/cmd/fetch.rb
@@ -8,14 +8,14 @@
#: If `-v` is passed, do a verbose VCS checkout, if the URL represents a VCS.
#: This is useful for seeing if an existing VCS cache has been updated.
#:
-#: If `--force` is passed, remove a previously cached version and re-fetch.
+#: If `--force` (or `-f`) is passed, remove a previously cached version and re-fetch.
#:
#: If `--retry` is passed, retry if a download fails or re-download if the
#: checksum of a previously cached version no longer matches.
#:
#: If `--deps` is passed, also download dependencies for any listed <formulae>.
#:
-#: If `--build-from-source` is passed, download the source rather than a
+#: If `--build-from-source` (or `-s`) is passed, download the source rather than a
#: bottle.
#:
#: If `--force-bottle` is passed, download a bottle if it exists for the
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index e54286f09..1808c4d9c 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -4,7 +4,7 @@
#: <formula> is usually the name of the formula to install, but it can be specified
#: in several different ways. See [SPECIFYING FORMULAE][].
#:
-#: If `--debug` is passed and brewing fails, open an interactive debugging
+#: If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging
#: session with access to IRB or a shell inside the temporary build directory.
#:
#: If `--env=std` is passed, use the standard build environment instead of superenv.
@@ -24,7 +24,7 @@
#: `gcc-4.2` for Apple's GCC 4.2, or `gcc-4.9` for a Homebrew-provided GCC
#: 4.9.
#:
-#: If `--build-from-source` or `-s` is passed, compile the specified <formula> from
+#: If `--build-from-source` (or `-s`) is passed, compile the specified <formula> from
#: source even if a bottle is provided. Dependencies will still be installed
#: from bottles if they are available.
#:
@@ -48,11 +48,12 @@
#: during installation.
#:
#: * `install` `--interactive` [`--git`] <formula>:
-#: Download and patch <formula>, then open a shell. This allows the user to
-#: run `./configure --help` and otherwise determine how to turn the software
-#: package into a Homebrew formula.
+#: If `--interactive` (or `-i`) is passed, download and patch <formula>, then
+#: open a shell. This allows the user to run `./configure --help` and
+#: otherwise determine how to turn the software package into a Homebrew
+#: formula.
#:
-#: If `--git` is passed, Homebrew will create a Git repository, useful for
+#: If `--git` (or `-g`) is passed, Homebrew will create a Git repository, useful for
#: creating patches to the software.
require "missing_formula"
@@ -193,13 +194,18 @@ module Homebrew
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
+ unless tab.installed_on_request
+ tab.installed_on_request = true
+ tab.write
+ end
end
perform_preinstall_checks
- formulae.each { |f| install_formula(f) }
+ formulae.each do |f|
+ Migrator.migrate_if_needed(f)
+ install_formula(f)
+ end
rescue FormulaClassUnavailableError => e
# Need to rescue before `FormulaUnavailableError` (superclass of this)
# is handled, as searching for a formula doesn't make sense here (the
diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb
index 293f09eef..5ce6bea48 100644
--- a/Library/Homebrew/cmd/link.rb
+++ b/Library/Homebrew/cmd/link.rb
@@ -10,7 +10,7 @@
#: be linked or which would be deleted by `brew link --overwrite`, but will not
#: actually link or delete any files.
#:
-#: If `--force` is passed, Homebrew will allow keg-only formulae to be linked.
+#: If `--force` (or `-f`) is passed, Homebrew will allow keg-only formulae to be linked.
require "ostruct"
@@ -86,8 +86,8 @@ module Homebrew
opt = HOMEBREW_PREFIX/"opt/#{keg.name}"
puts "\nIf you need to have this software first in your PATH instead consider running:"
- puts " #{Utils::Shell.prepend_path_in_shell_profile(opt)}/bin" if bin.directory?
- puts " #{Utils::Shell.prepend_path_in_shell_profile(opt)}/sbin" if sbin.directory?
+ puts " #{Utils::Shell.prepend_path_in_shell_profile(opt/"bin")}" if bin.directory?
+ puts " #{Utils::Shell.prepend_path_in_shell_profile(opt/"sbin")}" if sbin.directory?
end
def keg_only?(rack)
diff --git a/Library/Homebrew/cmd/migrate.rb b/Library/Homebrew/cmd/migrate.rb
index 2726b1480..951a2942e 100644
--- a/Library/Homebrew/cmd/migrate.rb
+++ b/Library/Homebrew/cmd/migrate.rb
@@ -2,7 +2,7 @@
#: Migrate renamed packages to new name, where <formulae> are old names of
#: packages.
#:
-#: If `--force` is passed, then treat installed <formulae> and passed <formulae>
+#: If `--force` (or `-f`) is passed, then treat installed <formulae> and passed <formulae>
#: like if they are from same taps and migrate them anyway.
require "migrator"
diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb
index a18f4e399..f163212e1 100644
--- a/Library/Homebrew/cmd/outdated.rb
+++ b/Library/Homebrew/cmd/outdated.rb
@@ -7,7 +7,7 @@
#: If `--quiet` is passed, list only the names of outdated brews (takes
#: precedence over `--verbose`).
#:
-#: If `--verbose` is passed, display detailed version information.
+#: If `--verbose` (or `-v`) is passed, display detailed version information.
#:
#: If `--json=`<version> is passed, the output will be in JSON format. The only
#: valid version is `v1`.
@@ -64,7 +64,9 @@ module Homebrew
"#{full_name} (#{kegs.map(&:version).join(", ")})"
end.join(", ")
- puts "#{outdated_versions} < #{current_version}"
+ pinned_version = " [pinned at #{f.pinned_version}]" if f.pinned?
+
+ puts "#{outdated_versions} < #{current_version}#{pinned_version}"
else
puts f.full_installed_specified_name
end
@@ -86,7 +88,9 @@ module Homebrew
json << { name: f.full_name,
installed_versions: outdated_versions.collect(&:to_s),
- current_version: current_version }
+ current_version: current_version,
+ pinned: f.pinned?,
+ pinned_version: f.pinned_version }
end
puts JSON.generate(json)
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb
index 586405909..c625d2d97 100644
--- a/Library/Homebrew/cmd/reinstall.rb
+++ b/Library/Homebrew/cmd/reinstall.rb
@@ -15,6 +15,7 @@ module Homebrew
onoe "#{f.full_name} is pinned. You must unpin it to reinstall."
next
end
+ Migrator.migrate_if_needed(f)
reinstall_formula(f)
end
end
diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb
index 5d02ebd1e..9c51a0d1c 100644
--- a/Library/Homebrew/cmd/uninstall.rb
+++ b/Library/Homebrew/cmd/uninstall.rb
@@ -1,7 +1,7 @@
#: * `uninstall`, `rm`, `remove` [`--force`] [`--ignore-dependencies`] <formula>:
#: Uninstall <formula>.
#:
-#: If `--force` is passed, and there are multiple versions of <formula>
+#: If `--force` (or `-f`) is passed, and there are multiple versions of <formula>
#: installed, delete all installed versions.
#:
#: If `--ignore-dependencies` is passed, uninstalling won't fail, even if
diff --git a/Library/Homebrew/cmd/unpack.rb b/Library/Homebrew/cmd/unpack.rb
index 60d796d9f..89992e1f0 100644
--- a/Library/Homebrew/cmd/unpack.rb
+++ b/Library/Homebrew/cmd/unpack.rb
@@ -6,7 +6,7 @@
#: If `--patch` is passed, patches for <formulae> will be applied to the
#: unpacked source.
#:
-#: If `--git` is passed, a Git repository will be initialized in the unpacked
+#: If `--git` (or `-g`) is passed, a Git repository will be initialized in the unpacked
#: source. This is useful for creating patches for the software.
require "stringio"
diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb
index 4002df75c..a6936c78c 100644
--- a/Library/Homebrew/cmd/update-report.rb
+++ b/Library/Homebrew/cmd/update-report.rb
@@ -502,12 +502,18 @@ class Reporter
end
def migrate_formula_rename
- Formula.installed.map(&:oldname).compact.each do |old_name|
- old_name_dir = HOMEBREW_CELLAR/old_name
- next if old_name_dir.symlink?
- next unless old_name_dir.directory? && !old_name_dir.subdirs.empty?
+ Formula.installed.each do |formula|
+ next unless Migrator.needs_migration?(formula)
- new_name = tap.formula_renames[old_name]
+ oldname = formula.oldname
+ oldname_rack = HOMEBREW_CELLAR/oldname
+
+ if oldname_rack.subdirs.empty?
+ oldname_rack.rmdir_if_possible
+ next
+ end
+
+ new_name = tap.formula_renames[oldname]
next unless new_name
new_full_name = "#{tap}/#{new_name}"
@@ -519,13 +525,7 @@ class Reporter
next
end
- begin
- migrator = Migrator.new(f)
- migrator.migrate
- rescue Migrator::MigratorDifferentTapsError
- rescue Exception => e
- onoe e
- end
+ Migrator.migrate_if_needed(f)
end
end
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh
index 5cfdb3f46..197a99f2e 100644
--- a/Library/Homebrew/cmd/update.sh
+++ b/Library/Homebrew/cmd/update.sh
@@ -5,7 +5,7 @@
#: If `--merge` is specified then `git merge` is used to include updates
#: (rather than `git rebase`).
#:
-#: If `--force` is specified then always do a slower, full update check even
+#: If `--force` (or `-f`) is specified then always do a slower, full update check even
#: if unnecessary.
# Hide shellcheck complaint:
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index ed36b8f33..d007ff8c8 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -88,6 +88,7 @@ module Homebrew
end
formulae_to_install.each do |f|
+ Migrator.migrate_if_needed(f)
upgrade_formula(f)
next unless ARGV.include?("--cleanup")
next unless f.installed?