mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
upgrade: make pinned error have correct exit code.
Also, display before saying "no packages to upgrade". Fixes #3936.
This commit is contained in:
parent
6c7e8608be
commit
96ff688b9d
@ -1,4 +1,4 @@
|
|||||||
#: * `upgrade` [<install-options>] [`--cleanup`] [`--fetch-HEAD`] [<formulae>]:
|
#: * `upgrade` [<install-options>] [`--cleanup`] [`--fetch-HEAD`] [`--ignore-pinned`] [<formulae>]:
|
||||||
#: Upgrade outdated, unpinned brews (with existing install options).
|
#: Upgrade outdated, unpinned brews (with existing install options).
|
||||||
#:
|
#:
|
||||||
#: Options for the `install` command are also valid here.
|
#: Options for the `install` command are also valid here.
|
||||||
@ -11,6 +11,9 @@
|
|||||||
#: repository's HEAD will be checked for updates when a new stable or devel
|
#: repository's HEAD will be checked for updates when a new stable or devel
|
||||||
#: version has been released.
|
#: version has been released.
|
||||||
#:
|
#:
|
||||||
|
#: If `--ignore-pinned` is passed, set a 0 exit code even if pinned formulae
|
||||||
|
#: are not upgraded.
|
||||||
|
#:
|
||||||
#: If <formulae> are given, upgrade only the specified brews (unless they
|
#: If <formulae> are given, upgrade only the specified brews (unless they
|
||||||
#: are pinned; see `pin`, `unpin`).
|
#: are pinned; see `pin`, `unpin`).
|
||||||
|
|
||||||
@ -55,6 +58,11 @@ module Homebrew
|
|||||||
outdated -= pinned
|
outdated -= pinned
|
||||||
formulae_to_install = outdated.map(&:latest_formula)
|
formulae_to_install = outdated.map(&:latest_formula)
|
||||||
|
|
||||||
|
if !pinned.empty? && !ARGV.include?("--ignore-pinned")
|
||||||
|
ofail "Not upgrading #{Formatter.pluralize(pinned.length, "pinned package")}:"
|
||||||
|
puts pinned.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", "
|
||||||
|
end
|
||||||
|
|
||||||
if formulae_to_install.empty?
|
if formulae_to_install.empty?
|
||||||
oh1 "No packages to upgrade"
|
oh1 "No packages to upgrade"
|
||||||
else
|
else
|
||||||
@ -62,11 +70,6 @@ module Homebrew
|
|||||||
puts formulae_to_install.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", "
|
puts formulae_to_install.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", "
|
||||||
end
|
end
|
||||||
|
|
||||||
unless pinned.empty?
|
|
||||||
onoe "Not upgrading #{Formatter.pluralize(pinned.length, "pinned package")}:"
|
|
||||||
puts pinned.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", "
|
|
||||||
end
|
|
||||||
|
|
||||||
# Sort keg_only before non-keg_only formulae to avoid any needless conflicts
|
# Sort keg_only before non-keg_only formulae to avoid any needless conflicts
|
||||||
# with outdated, non-keg_only versions of formulae being upgraded.
|
# with outdated, non-keg_only versions of formulae being upgraded.
|
||||||
formulae_to_install.sort! do |a, b|
|
formulae_to_install.sort! do |a, b|
|
||||||
|
@ -4,7 +4,7 @@ describe "brew pin", :integration_test do
|
|||||||
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
|
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
|
||||||
|
|
||||||
expect { brew "pin", "testball" }.to be_a_success
|
expect { brew "pin", "testball" }.to be_a_success
|
||||||
expect { brew "upgrade" }.to be_a_success
|
expect { brew "upgrade" }.to be_a_failure
|
||||||
|
|
||||||
expect(HOMEBREW_CELLAR/"testball/0.1").not_to be_a_directory
|
expect(HOMEBREW_CELLAR/"testball/0.1").not_to be_a_directory
|
||||||
end
|
end
|
||||||
|
@ -552,7 +552,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
|
|||||||
their latest `origin/master`. Note this will destroy all your uncommitted
|
their latest `origin/master`. Note this will destroy all your uncommitted
|
||||||
or committed changes.
|
or committed changes.
|
||||||
|
|
||||||
* `upgrade` [`install-options`] [`--cleanup`] [`--fetch-HEAD`] [`formulae`]:
|
* `upgrade` [`install-options`] [`--cleanup`] [`--fetch-HEAD`] [`--ignore-pinned`] [`formulae`]:
|
||||||
Upgrade outdated, unpinned brews (with existing install options).
|
Upgrade outdated, unpinned brews (with existing install options).
|
||||||
|
|
||||||
Options for the `install` command are also valid here.
|
Options for the `install` command are also valid here.
|
||||||
@ -565,6 +565,9 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
|
|||||||
repository's HEAD will be checked for updates when a new stable or devel
|
repository's HEAD will be checked for updates when a new stable or devel
|
||||||
version has been released.
|
version has been released.
|
||||||
|
|
||||||
|
If `--ignore-pinned` is passed, set a 0 exit code even if pinned formulae
|
||||||
|
are not upgraded.
|
||||||
|
|
||||||
If `formulae` are given, upgrade only the specified brews (unless they
|
If `formulae` are given, upgrade only the specified brews (unless they
|
||||||
are pinned; see `pin`, `unpin`).
|
are pinned; see `pin`, `unpin`).
|
||||||
|
|
||||||
|
@ -566,7 +566,7 @@ If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full upd
|
|||||||
Fetches and resets Homebrew and all tap repositories using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\.
|
Fetches and resets Homebrew and all tap repositories using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBupgrade\fR [\fIinstall\-options\fR] [\fB\-\-cleanup\fR] [\fB\-\-fetch\-HEAD\fR] [\fIformulae\fR]
|
\fBupgrade\fR [\fIinstall\-options\fR] [\fB\-\-cleanup\fR] [\fB\-\-fetch\-HEAD\fR] [\fB\-\-ignore\-pinned\fR] [\fIformulae\fR]
|
||||||
Upgrade outdated, unpinned brews (with existing install options)\.
|
Upgrade outdated, unpinned brews (with existing install options)\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
@ -579,6 +579,9 @@ If \fB\-\-cleanup\fR is specified or \fBHOMEBREW_UPGRADE_CLEANUP\fR is set then
|
|||||||
If \fB\-\-fetch\-HEAD\fR is passed, fetch the upstream repository to detect if the HEAD installation of the formula is outdated\. Otherwise, the repository\'s HEAD will be checked for updates when a new stable or devel version has been released\.
|
If \fB\-\-fetch\-HEAD\fR is passed, fetch the upstream repository to detect if the HEAD installation of the formula is outdated\. Otherwise, the repository\'s HEAD will be checked for updates when a new stable or devel version has been released\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
|
If \fB\-\-ignore\-pinned\fR is passed, set a 0 exit code even if pinned formulae are not upgraded\.
|
||||||
|
.
|
||||||
|
.IP
|
||||||
If \fIformulae\fR are given, upgrade only the specified brews (unless they are pinned; see \fBpin\fR, \fBunpin\fR)\.
|
If \fIformulae\fR are given, upgrade only the specified brews (unless they are pinned; see \fBpin\fR, \fBunpin\fR)\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user