diff options
| author | Xu Cheng | 2015-09-02 20:56:04 +0800 |
|---|---|---|
| committer | Mike McQuaid | 2015-02-09 14:12:19 +0000 |
| commit | 105eaf338257cf3b62d5a22c21c524745ae06d9c (patch) | |
| tree | 48fc9e268c8e6564fc8c8e7129ce70559b55fb27 /Library | |
| parent | 8e12390fc8d9b198dd4b68ca20c0108e5d60e1a5 (diff) | |
| download | brew-105eaf338257cf3b62d5a22c21c524745ae06d9c.tar.bz2 | |
test-bot: only test the runtime dependencies.
Also add support to `brew uses` to ignore build or optional dependencies.
Closes Homebrew/homebrew#36154.
Closes Homebrew/homebrew#36656.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/test-bot.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/uses.rb | 13 | ||||
| -rw-r--r-- | Library/Homebrew/manpages/brew.1.md | 6 |
3 files changed, 17 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb index d7414302a..9a1478764 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 1c029b0f0..abba88cec 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 5a70353a4..34cf8dd6a 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 <formulae> are given, upgrade only the specified brews (but do so even if they are pinned; see `pin`, `unpin`). - * `uses [--installed] [--recursive] [--devel|--HEAD]` <formulae>: + * `uses [--installed] [--recursive] [--skip-build] [--skip-optional] [--devel|--HEAD]` <formulae>: Show the formulae that specify <formulae> as a dependency. When given multiple formula arguments, show the intersection of formulae that use <formulae>. @@ -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 <formulae> 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`. |
