cmd/deps: show deps for head spec with --HEAD

Plus a few man page fixes
This commit is contained in:
Eric Knibbe 2023-10-12 07:58:25 -04:00
parent d3fd36da48
commit 8e01227add
No known key found for this signature in database
GPG Key ID: 179D9CDDDB814168
9 changed files with 58 additions and 38 deletions

View File

@ -17,10 +17,10 @@ module Homebrew
If <formula> is provided, display the file or directory used to cache <formula>.
EOS
flag "--os=",
description: "Show cache file for the given operating system." \
description: "Show cache file for the given operating system. " \
"(Pass `all` to show cache files for all operating systems.)"
flag "--arch=",
description: "Show cache file for the given CPU architecture." \
description: "Show cache file for the given CPU architecture. " \
"(Pass `all` to show cache files for all architectures.)"
switch "-s", "--build-from-source",
description: "Show the cache file used when building from source."

View File

@ -51,7 +51,7 @@ module Homebrew
depends_on: "--graph",
description: "Show text-based graph description in DOT format."
switch "--annotate",
description: "Mark any build, test, optional, or recommended dependencies as " \
description: "Mark any build, test, implicit, optional, or recommended dependencies as " \
"such in the output."
switch "--installed",
description: "List dependencies for formulae that are currently installed. If <formula> is " \
@ -62,9 +62,11 @@ module Homebrew
description: "Evaluate all available formulae and casks, whether installed or not, to list " \
"their dependencies."
switch "--for-each",
description: "Switch into the mode used by the `--all` option, but only list dependencies " \
description: "Switch into the mode used by the `--eval-all` option, but only list dependencies " \
"for each provided <formula>, one formula per line. This is used for " \
"debugging the `--installed`/`--all` display mode."
"debugging the `--installed`/`--eval-all` display mode."
switch "--HEAD",
description: "Show dependencies for HEAD version instead of stable version."
switch "--formula", "--formulae",
description: "Treat all named arguments as formulae."
switch "--cask", "--casks",
@ -73,7 +75,6 @@ module Homebrew
conflicts "--tree", "--graph"
conflicts "--installed", "--missing"
conflicts "--installed", "--eval-all"
conflicts "--installed", "--all"
conflicts "--formula", "--cask"
formula_options
@ -94,6 +95,7 @@ module Homebrew
@use_runtime_dependencies = installed && recursive &&
!args.tree? &&
!args.graph? &&
!args.HEAD? &&
!args.include_build? &&
!args.include_test? &&
!args.include_optional? &&
@ -153,6 +155,7 @@ module Homebrew
end
dependents = dependents(args.named.to_formulae_and_casks)
check_head_spec(dependents) if args.HEAD?
all_deps = deps_for_dependents(dependents, recursive: recursive, args: args, &(args.union? ? :| : :&))
condense_requirements(all_deps, args: args)
@ -217,7 +220,14 @@ module Homebrew
dependents.map { |d| deps_for_dependent(d, recursive: recursive, args: args) }.reduce(&block)
end
def self.check_head_spec(dependents)
headless = dependents.select { |d| d.is_a?(Formula) && d.active_spec_sym != :head }
.to_sentence two_words_connector: " or ", last_word_connector: " or "
opoo "No head spec for #{headless}, using stable spec instead" unless headless.empty?
end
def self.puts_deps(dependents, args:, recursive: false)
check_head_spec(dependents) if args.HEAD?
dependents.each do |dependent|
deps = deps_for_dependent(dependent, recursive: recursive, args: args)
condense_requirements(deps, args: args)
@ -268,6 +278,7 @@ module Homebrew
end
def self.puts_deps_tree(dependents, args:, recursive: false)
check_head_spec(dependents) if args.HEAD?
dependents.each do |d|
puts d.full_name
recursive_deps_tree(d, dep_stack: [], prefix: "", recursive: recursive, args: args)

View File

@ -19,10 +19,10 @@ module Homebrew
and binaries for <cask>s. For files, also print SHA-256 checksums.
EOS
flag "--os=",
description: "Download for the given operating system." \
description: "Download for the given operating system. " \
"(Pass `all` to download for all operating systems.)"
flag "--arch=",
description: "Download for the given CPU architecture." \
description: "Download for the given CPU architecture. " \
"(Pass `all` to download for all architectures.)"
flag "--bottle-tag=",
description: "Download a bottle for given tag."

View File

@ -22,7 +22,7 @@ module Homebrew
switch "-f", "--force",
description: "Test formulae even if they are unlinked."
switch "--HEAD",
description: "Test the head version of a formula."
description: "Test the HEAD version of a formula."
switch "--keep-tmp",
description: "Retain the temporary files created for the test."
switch "--retry",

View File

@ -737,6 +737,7 @@ _brew_deps() {
case "${cur}" in
-*)
__brewcomp "
--HEAD
--annotate
--cask
--debug

View File

@ -192,7 +192,7 @@ end
__fish_brew_complete_cmd '--cache' 'Display Homebrew\'s download cache'
__fish_brew_complete_arg '--cache' -l HEAD -d 'Show the cache file used when building from HEAD'
__fish_brew_complete_arg '--cache' -l arch -d 'Show cache file for the given CPU architecture.(Pass `all` to show cache files for all architectures.)'
__fish_brew_complete_arg '--cache' -l arch -d 'Show cache file for the given CPU architecture. (Pass `all` to show cache files for all architectures.)'
__fish_brew_complete_arg '--cache' -l bottle-tag -d 'Show the cache file used when pouring a bottle for the given tag'
__fish_brew_complete_arg '--cache' -l build-from-source -d 'Show the cache file used when building from source'
__fish_brew_complete_arg '--cache' -l cask -d 'Only show cache files for casks'
@ -200,7 +200,7 @@ __fish_brew_complete_arg '--cache' -l debug -d 'Display any debugging informatio
__fish_brew_complete_arg '--cache' -l force-bottle -d 'Show the cache file used when pouring a bottle'
__fish_brew_complete_arg '--cache' -l formula -d 'Only show cache files for formulae'
__fish_brew_complete_arg '--cache' -l help -d 'Show this message'
__fish_brew_complete_arg '--cache' -l os -d 'Show cache file for the given operating system.(Pass `all` to show cache files for all operating systems.)'
__fish_brew_complete_arg '--cache' -l os -d 'Show cache file for the given operating system. (Pass `all` to show cache files for all operating systems.)'
__fish_brew_complete_arg '--cache' -l quiet -d 'Make some output more quiet'
__fish_brew_complete_arg '--cache' -l verbose -d 'Make some output more verbose'
__fish_brew_complete_arg '--cache; and not __fish_seen_argument -l cask -l casks' -a '(__fish_brew_suggest_formulae_all)'
@ -565,13 +565,14 @@ __fish_brew_complete_arg 'create' -l verbose -d 'Make some output more verbose'
__fish_brew_complete_cmd 'deps' 'Show dependencies for formula'
__fish_brew_complete_arg 'deps' -l annotate -d 'Mark any build, test, optional, or recommended dependencies as such in the output'
__fish_brew_complete_arg 'deps' -l HEAD -d 'Show dependencies for HEAD version instead of stable version'
__fish_brew_complete_arg 'deps' -l annotate -d 'Mark any build, test, implicit, optional, or recommended dependencies as such in the output'
__fish_brew_complete_arg 'deps' -l cask -d 'Treat all named arguments as casks'
__fish_brew_complete_arg 'deps' -l debug -d 'Display any debugging information'
__fish_brew_complete_arg 'deps' -l direct -d 'Show only the direct dependencies declared in the formula'
__fish_brew_complete_arg 'deps' -l dot -d 'Show text-based graph description in DOT format'
__fish_brew_complete_arg 'deps' -l eval-all -d 'Evaluate all available formulae and casks, whether installed or not, to list their dependencies'
__fish_brew_complete_arg 'deps' -l for-each -d 'Switch into the mode used by the `--all` option, but only list dependencies for each provided formula, one formula per line. This is used for debugging the `--installed`/`--all` display mode'
__fish_brew_complete_arg 'deps' -l for-each -d 'Switch into the mode used by the `--eval-all` option, but only list dependencies for each provided formula, one formula per line. This is used for debugging the `--installed`/`--eval-all` display mode'
__fish_brew_complete_arg 'deps' -l formula -d 'Treat all named arguments as formulae'
__fish_brew_complete_arg 'deps' -l full-name -d 'List dependencies by their full name'
__fish_brew_complete_arg 'deps' -l graph -d 'Show dependencies as a directed graph'
@ -706,7 +707,7 @@ __fish_brew_complete_arg 'extract' -a '(__fish_brew_suggest_taps_installed)'
__fish_brew_complete_cmd 'fetch' 'Download a bottle (if available) or source packages for formulae and binaries for casks'
__fish_brew_complete_arg 'fetch' -l HEAD -d 'Fetch HEAD version instead of stable version'
__fish_brew_complete_arg 'fetch' -l arch -d 'Download for the given CPU architecture.(Pass `all` to download for all architectures.)'
__fish_brew_complete_arg 'fetch' -l arch -d 'Download for the given CPU architecture. (Pass `all` to download for all architectures.)'
__fish_brew_complete_arg 'fetch' -l bottle-tag -d 'Download a bottle for given tag'
__fish_brew_complete_arg 'fetch' -l build-bottle -d 'Download source packages (for eventual bottling) rather than a bottle'
__fish_brew_complete_arg 'fetch' -l build-from-source -d 'Download source packages rather than a bottle'
@ -718,7 +719,7 @@ __fish_brew_complete_arg 'fetch' -l force-bottle -d 'Download a bottle if it exi
__fish_brew_complete_arg 'fetch' -l formula -d 'Treat all named arguments as formulae'
__fish_brew_complete_arg 'fetch' -l help -d 'Show this message'
__fish_brew_complete_arg 'fetch' -l no-quarantine -d 'Disable/enable quarantining of downloads (default: enabled)'
__fish_brew_complete_arg 'fetch' -l os -d 'Download for the given operating system.(Pass `all` to download for all operating systems.)'
__fish_brew_complete_arg 'fetch' -l os -d 'Download for the given operating system. (Pass `all` to download for all operating systems.)'
__fish_brew_complete_arg 'fetch' -l quarantine -d 'Disable/enable quarantining of downloads (default: enabled)'
__fish_brew_complete_arg 'fetch' -l quiet -d 'Make some output more quiet'
__fish_brew_complete_arg 'fetch' -l retry -d 'Retry if downloading fails or re-download if the checksum of a previously cached version no longer matches. Tries at most 5 times with exponential backoff'
@ -1454,7 +1455,7 @@ __fish_brew_complete_arg 'tc' -l verbose -d 'Make some output more verbose'
__fish_brew_complete_cmd 'test' 'Run the test method provided by an installed formula'
__fish_brew_complete_arg 'test' -l HEAD -d 'Test the head version of a formula'
__fish_brew_complete_arg 'test' -l HEAD -d 'Test the HEAD version of a formula'
__fish_brew_complete_arg 'test' -l debug -d 'Display any debugging information'
__fish_brew_complete_arg 'test' -l force -d 'Test formulae even if they are unlinked'
__fish_brew_complete_arg 'test' -l help -d 'Show this message'

View File

@ -264,13 +264,13 @@ __brew_diagnostic_checks() {
_brew___cache() {
_arguments \
'(--build-from-source --force-bottle --bottle-tag --cask)--HEAD[Show the cache file used when building from HEAD]' \
'(--bottle-tag)--arch[Show cache file for the given CPU architecture.(Pass `all` to show cache files for all architectures.)]' \
'(--bottle-tag)--arch[Show cache file for the given CPU architecture. (Pass `all` to show cache files for all architectures.)]' \
'(--build-from-source --force-bottle --HEAD --cask --os --arch)--bottle-tag[Show the cache file used when pouring a bottle for the given tag]' \
'(--force-bottle --bottle-tag --HEAD --cask)--build-from-source[Show the cache file used when building from source]' \
'--debug[Display any debugging information]' \
'(--build-from-source --bottle-tag --HEAD --cask)--force-bottle[Show the cache file used when pouring a bottle]' \
'--help[Show this message]' \
'(--bottle-tag)--os[Show cache file for the given operating system.(Pass `all` to show cache files for all operating systems.)]' \
'(--bottle-tag)--os[Show cache file for the given operating system. (Pass `all` to show cache files for all operating systems.)]' \
'--quiet[Make some output more quiet]' \
'--verbose[Make some output more verbose]' \
- formula \
@ -715,12 +715,13 @@ _brew_create() {
# brew deps
_brew_deps() {
_arguments \
'--annotate[Mark any build, test, optional, or recommended dependencies as such in the output]' \
'--HEAD[Show dependencies for HEAD version instead of stable version]' \
'--annotate[Mark any build, test, implicit, optional, or recommended dependencies as such in the output]' \
'--debug[Display any debugging information]' \
'--direct[Show only the direct dependencies declared in the formula]' \
'--dot[Show text-based graph description in DOT format]' \
'(--installed)--eval-all[Evaluate all available formulae and casks, whether installed or not, to list their dependencies]' \
'--for-each[Switch into the mode used by the `--all` option, but only list dependencies for each provided formula, one formula per line. This is used for debugging the `--installed`/`--all` display mode]' \
'--for-each[Switch into the mode used by the `--eval-all` option, but only list dependencies for each provided formula, one formula per line. This is used for debugging the `--installed`/`--eval-all` display mode]' \
'--full-name[List dependencies by their full name]' \
'(--tree)--graph[Show dependencies as a directed graph]' \
'--help[Show this message]' \
@ -728,7 +729,7 @@ _brew_deps() {
'--include-optional[Include `:optional` dependencies for formula]' \
'--include-requirements[Include requirements in addition to dependencies for formula]' \
'--include-test[Include `:test` dependencies for formula (non-recursive)]' \
'(--missing --eval-all --all)--installed[List dependencies for formulae that are currently installed. If formula is specified, list only its dependencies that are currently installed]' \
'(--missing --eval-all)--installed[List dependencies for formulae that are currently installed. If formula is specified, list only its dependencies that are currently installed]' \
'(--installed)--missing[Show only missing dependencies]' \
'--quiet[Make some output more quiet]' \
'--skip-recommended[Skip `:recommended` dependencies for formula]' \
@ -890,7 +891,7 @@ _brew_extract() {
_brew_fetch() {
_arguments \
'(--cask)--HEAD[Fetch HEAD version instead of stable version]' \
'(--bottle-tag)--arch[Download for the given CPU architecture.(Pass `all` to download for all architectures.)]' \
'(--bottle-tag)--arch[Download for the given CPU architecture. (Pass `all` to download for all architectures.)]' \
'(--build-from-source --build-bottle --force-bottle --cask --os --arch)--bottle-tag[Download a bottle for given tag]' \
'(--build-from-source --force-bottle --bottle-tag --cask)--build-bottle[Download source packages (for eventual bottling) rather than a bottle]' \
'(--build-bottle --force-bottle --bottle-tag)--build-from-source[Download source packages rather than a bottle]' \
@ -900,7 +901,7 @@ _brew_fetch() {
'(--build-from-source --build-bottle --bottle-tag --cask)--force-bottle[Download a bottle if it exists for the current or newest version of macOS, even if it would not be used during installation]' \
'--help[Show this message]' \
'--no-quarantine[Disable/enable quarantining of downloads (default: enabled)]' \
'(--bottle-tag)--os[Download for the given operating system.(Pass `all` to download for all operating systems.)]' \
'(--bottle-tag)--os[Download for the given operating system. (Pass `all` to download for all operating systems.)]' \
'--quarantine[Disable/enable quarantining of downloads (default: enabled)]' \
'--quiet[Make some output more quiet]' \
'--retry[Retry if downloading fails or re-download if the checksum of a previously cached version no longer matches. Tries at most 5 times with exponential backoff]' \
@ -1796,7 +1797,7 @@ _brew_tc() {
# brew test
_brew_test() {
_arguments \
'--HEAD[Test the head version of a formula]' \
'--HEAD[Test the HEAD version of a formula]' \
'--debug[Display any debugging information]' \
'--force[Test formulae even if they are unlinked]' \
'--help[Show this message]' \

View File

@ -173,7 +173,7 @@ dependencies if the installed versions are outdated.
* `--dot`:
Show text-based graph description in DOT format.
* `--annotate`:
Mark any build, test, optional, or recommended dependencies as such in the output.
Mark any build, test, implicit, optional, or recommended dependencies as such in the output.
* `--installed`:
List dependencies for formulae that are currently installed. If *`formula`* is specified, list only its dependencies that are currently installed.
* `--missing`:
@ -181,7 +181,9 @@ dependencies if the installed versions are outdated.
* `--eval-all`:
Evaluate all available formulae and casks, whether installed or not, to list their dependencies.
* `--for-each`:
Switch into the mode used by the `--all` option, but only list dependencies for each provided *`formula`*, one formula per line. This is used for debugging the `--installed`/`--all` display mode.
Switch into the mode used by the `--eval-all` option, but only list dependencies for each provided *`formula`*, one formula per line. This is used for debugging the `--installed`/`--eval-all` display mode.
* `--HEAD`:
Show dependencies for HEAD version instead of stable version.
* `--formula`:
Treat all named arguments as formulae.
* `--cask`:
@ -241,9 +243,9 @@ Download a bottle (if available) or source packages for *`formula`*e
and binaries for *`cask`*s. For files, also print SHA-256 checksums.
* `--os`:
Download for the given operating system.(Pass `all` to download for all operating systems.)
Download for the given operating system. (Pass `all` to download for all operating systems.)
* `--arch`:
Download for the given CPU architecture.(Pass `all` to download for all architectures.)
Download for the given CPU architecture. (Pass `all` to download for all architectures.)
* `--bottle-tag`:
Download a bottle for given tag.
* `--HEAD`:
@ -853,9 +855,9 @@ Display Homebrew's download cache. See also `HOMEBREW_CACHE`.
If *`formula`* is provided, display the file or directory used to cache *`formula`*.
* `--os`:
Show cache file for the given operating system.(Pass `all` to show cache files for all operating systems.)
Show cache file for the given operating system. (Pass `all` to show cache files for all operating systems.)
* `--arch`:
Show cache file for the given CPU architecture.(Pass `all` to show cache files for all architectures.)
Show cache file for the given CPU architecture. (Pass `all` to show cache files for all architectures.)
* `-s`, `--build-from-source`:
Show the cache file used when building from source.
* `--force-bottle`:
@ -1566,7 +1568,7 @@ user if something is wrong with the installed formula.
* `-f`, `--force`:
Test formulae even if they are unlinked.
* `--HEAD`:
Test the head version of a formula.
Test the HEAD version of a formula.
* `--keep-tmp`:
Retain the temporary files created for the test.
* `--retry`:

View File

@ -213,7 +213,7 @@ Show text\-based graph description in DOT format\.
.
.TP
\fB\-\-annotate\fR
Mark any build, test, optional, or recommended dependencies as such in the output\.
Mark any build, test, implicit, optional, or recommended dependencies as such in the output\.
.
.TP
\fB\-\-installed\fR
@ -229,7 +229,11 @@ Evaluate all available formulae and casks, whether installed or not, to list the
.
.TP
\fB\-\-for\-each\fR
Switch into the mode used by the \fB\-\-all\fR option, but only list dependencies for each provided \fIformula\fR, one formula per line\. This is used for debugging the \fB\-\-installed\fR/\fB\-\-all\fR display mode\.
Switch into the mode used by the \fB\-\-eval\-all\fR option, but only list dependencies for each provided \fIformula\fR, one formula per line\. This is used for debugging the \fB\-\-installed\fR/\fB\-\-eval\-all\fR display mode\.
.
.TP
\fB\-\-HEAD\fR
Show dependencies for HEAD version instead of stable version\.
.
.TP
\fB\-\-formula\fR
@ -299,11 +303,11 @@ Download a bottle (if available) or source packages for \fIformula\fRe and binar
.
.TP
\fB\-\-os\fR
Download for the given operating system\.(Pass \fBall\fR to download for all operating systems\.)
Download for the given operating system\. (Pass \fBall\fR to download for all operating systems\.)
.
.TP
\fB\-\-arch\fR
Download for the given CPU architecture\.(Pass \fBall\fR to download for all architectures\.)
Download for the given CPU architecture\. (Pass \fBall\fR to download for all architectures\.)
.
.TP
\fB\-\-bottle\-tag\fR
@ -1197,11 +1201,11 @@ If \fIformula\fR is provided, display the file or directory used to cache \fIfor
.
.TP
\fB\-\-os\fR
Show cache file for the given operating system\.(Pass \fBall\fR to show cache files for all operating systems\.)
Show cache file for the given operating system\. (Pass \fBall\fR to show cache files for all operating systems\.)
.
.TP
\fB\-\-arch\fR
Show cache file for the given CPU architecture\.(Pass \fBall\fR to show cache files for all architectures\.)
Show cache file for the given CPU architecture\. (Pass \fBall\fR to show cache files for all architectures\.)
.
.TP
\fB\-s\fR, \fB\-\-build\-from\-source\fR
@ -2239,7 +2243,7 @@ Test formulae even if they are unlinked\.
.
.TP
\fB\-\-HEAD\fR
Test the head version of a formula\.
Test the HEAD version of a formula\.
.
.TP
\fB\-\-keep\-tmp\fR