diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb index d7414302a8..9a14787643 100644 --- a/Library/Homebrew/cmd/test-bot.rb +++ b/Library/Homebrew/cmd/test-bot.rb @@ -363,7 +363,7 @@ module Homebrew unchanged_dependencies = dependencies - @formulae changed_dependences = dependencies - unchanged_dependencies - dependents = `brew uses #{formula_name}`.split("\n") + dependents = `brew uses --skip-build --skip-optional #{formula_name}`.split("\n") dependents -= @formulae dependents = dependents.map {|d| Formulary.factory(d)} diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index 1c029b0f04..abba88cec5 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -11,15 +11,24 @@ module Homebrew used_formulae = ARGV.formulae formulae = (ARGV.include? "--installed") ? Formula.installed : Formula recursive = ARGV.flag? "--recursive" + ignores = [] + ignores << "build?" if ARGV.flag? "--skip-build" + ignores << "optional?" if ARGV.flag? "--skip-optional" uses = formulae.select do |f| used_formulae.all? do |ff| begin if recursive - f.recursive_dependencies.any? { |dep| dep.to_formula.name == ff.name } || + deps = f.recursive_dependencies.reject do |dep| + ignores.any? { |ignore| dep.send(ignore) } + end + deps.any? { |dep| dep.to_formula.name == ff.name } || f.recursive_requirements.any? { |req| req.name == ff.name } else - f.deps.any? { |dep| dep.to_formula.name == ff.name } || + deps = f.deps.reject do |dep| + ignores.any? { |ignore| dep.send(ignore) } + end + deps.any? { |dep| dep.to_formula.name == ff.name } || f.requirements.any? { |req| req.name == ff.name } end rescue FormulaUnavailableError => e diff --git a/Library/Homebrew/manpages/brew.1.md b/Library/Homebrew/manpages/brew.1.md index 5a70353a4e..34cf8dd6ac 100644 --- a/Library/Homebrew/manpages/brew.1.md +++ b/Library/Homebrew/manpages/brew.1.md @@ -398,7 +398,7 @@ Note that these flags should only appear after a command. If are given, upgrade only the specified brews (but do so even if they are pinned; see `pin`, `unpin`). - * `uses [--installed] [--recursive] [--devel|--HEAD]` : + * `uses [--installed] [--recursive] [--skip-build] [--skip-optional] [--devel|--HEAD]` : Show the formulae that specify as a dependency. When given multiple formula arguments, show the intersection of formulae that use . @@ -407,6 +407,10 @@ Note that these flags should only appear after a command. If `--installed` is passed, only list installed formulae. + By default, `uses` shows all formulae that specify as a dependency. + To skip the `:build` type dependencies, pass `--skip-build`. Similarly, pass + `--skip-optional` to skip `:optional` dependencies. + By default, `uses` shows usages of `formula` by stable builds. To find cases where `formula` is used by development or HEAD build, pass `--devel` or `--HEAD`. diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1 index f9f1d9b2a2..789f37866d 100644 --- a/share/man/man1/brew.1 +++ b/share/man/man1/brew.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "January 2015" "Homebrew" "brew" +.TH "BREW" "1" "February 2015" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The missing package manager for OS X @@ -426,7 +426,7 @@ Options for the \fBinstall\fR command are also valid here\. If \fIformulae\fR are given, upgrade only the specified brews (but do so even if they are pinned; see \fBpin\fR, \fBunpin\fR)\. . .TP -\fBuses [\-\-installed] [\-\-recursive] [\-\-devel|\-\-HEAD]\fR \fIformulae\fR +\fBuses [\-\-installed] [\-\-recursive] [\-\-skip\-build] [\-\-skip\-optional] [\-\-devel|\-\-HEAD]\fR \fIformulae\fR Show the formulae that specify \fIformulae\fR as a dependency\. When given multiple formula arguments, show the intersection of formulae that use \fIformulae\fR\. . .IP @@ -436,6 +436,9 @@ Use \fB\-\-recursive\fR to resolve more than one level of dependencies\. If \fB\-\-installed\fR is passed, only list installed formulae\. . .IP +By default, \fBuses\fR shows all formulae that specify \fIformulae\fR as a dependency\. To skip the \fB:build\fR type dependencies, pass \fB\-\-skip\-build\fR\. Similarly, pass \fB\-\-skip\-optional\fR to skip \fB:optional\fR dependencies\. +. +.IP By default, \fBuses\fR shows usages of \fBformula\fR by stable builds\. To find cases where \fBformula\fR is used by development or HEAD build, pass \fB\-\-devel\fR or \fB\-\-HEAD\fR\. . .TP