diff options
| author | Mike McQuaid | 2018-02-05 16:29:01 +0100 |
|---|---|---|
| committer | GitHub | 2018-02-05 16:29:01 +0100 |
| commit | af8f8f11e32fe78677fc1d4cd62c07a29dc6d326 (patch) | |
| tree | 79b037e1d66772c089abc31ea4caaaf4876390b6 | |
| parent | 62f85cfabbcff722afb406e48e56d5b10e6fc654 (diff) | |
| parent | 3a2e6b82fd008974c47b87a98c6c7bbf1dcdcea7 (diff) | |
| download | brew-af8f8f11e32fe78677fc1d4cd62c07a29dc6d326.tar.bz2 | |
Merge pull request #3748 from MikeMcQuaid/pin-more-robust1.5.3
Make pinning more robust
| -rw-r--r-- | Library/Homebrew/cmd/pin.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/uninstall.rb | 10 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/upgrade.rb | 22 | ||||
| -rw-r--r-- | docs/Manpage.md | 3 | ||||
| -rw-r--r-- | manpages/brew.1 | 2 |
5 files changed, 17 insertions, 23 deletions
diff --git a/Library/Homebrew/cmd/pin.rb b/Library/Homebrew/cmd/pin.rb index 5a14f853c..9935d1636 100644 --- a/Library/Homebrew/cmd/pin.rb +++ b/Library/Homebrew/cmd/pin.rb @@ -1,7 +1,6 @@ #: * `pin` <formulae>: #: Pin the specified <formulae>, preventing them from being upgraded when -#: issuing the `brew upgrade <formulae>` command (but can still be upgraded -#: as dependencies for other formulae). See also `unpin`. +#: issuing the `brew upgrade <formulae>` command. See also `unpin`. require "formula" diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb index f95b6c7bb..af0efaf62 100644 --- a/Library/Homebrew/cmd/uninstall.rb +++ b/Library/Homebrew/cmd/uninstall.rb @@ -46,6 +46,16 @@ module Homebrew rm_pin rack else kegs.each do |keg| + begin + f = Formulary.from_rack(rack) + if f.pinned? + onoe "#{f.full_name} is pinned. You must unpin it to uninstall." + next + end + rescue + nil + end + keg.lock do puts "Uninstalling #{keg}... (#{keg.abv})" keg.unlink diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 7832983e3..401a02e67 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -50,11 +50,8 @@ module Homebrew exit 1 if outdated.empty? end - unless upgrade_pinned? - pinned = outdated.select(&:pinned?) - outdated -= pinned - end - + pinned = outdated.select(&:pinned?) + outdated -= pinned formulae_to_install = outdated.map(&:latest_formula) if formulae_to_install.empty? @@ -64,8 +61,8 @@ module Homebrew puts formulae_to_install.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", " end - unless upgrade_pinned? || pinned.empty? - oh1 "Not upgrading #{Formatter.pluralize(pinned.length, "pinned package")}:" + unless pinned.empty? + onoe "Not upgrading #{Formatter.pluralize(pinned.length, "pinned package")}:" puts pinned.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", " end @@ -95,10 +92,6 @@ module Homebrew end end - def upgrade_pinned? - !ARGV.named.empty? - end - def upgrade_formula(f) if f.opt_prefix.directory? keg = Keg.new(f.opt_prefix.resolved_path) @@ -143,13 +136,6 @@ module Homebrew fi.install fi.finish - - # If the formula was pinned, and we were force-upgrading it, unpin and - # pin it again to get a symlink pointing to the correct keg. - if f.pinned? - f.unpin - f.pin - end 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. diff --git a/docs/Manpage.md b/docs/Manpage.md index 53c41873b..920518376 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -371,8 +371,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note * `pin` `formulae`: Pin the specified `formulae`, preventing them from being upgraded when - issuing the `brew upgrade `formulae command (but can still be upgraded - as dependencies for other formulae). See also `unpin`. + issuing the `brew upgrade `formulae command. See also `unpin`. * `postinstall` `formula`: Rerun the post-install steps for `formula`. diff --git a/manpages/brew.1 b/manpages/brew.1 index 3e91e0a82..56581bfc0 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -384,7 +384,7 @@ If \fB\-\-fetch\-HEAD\fR is passed, fetch the upstream repository to detect if t . .TP \fBpin\fR \fIformulae\fR -Pin the specified \fIformulae\fR, preventing them from being upgraded when issuing the \fBbrew upgrade <formulae>\fR command (but can still be upgraded as dependencies for other formulae)\. See also \fBunpin\fR\. +Pin the specified \fIformulae\fR, preventing them from being upgraded when issuing the \fBbrew upgrade <formulae>\fR command\. See also \fBunpin\fR\. . .TP \fBpostinstall\fR \fIformula\fR |
