From b5249432267a6086df2c39fa1c5c26c14db7d513 Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Mon, 16 Dec 2013 16:37:59 -0800 Subject: install: add --only-dependencies option The traditional approach to installing the dependencies of a formula is the following: brew install `brew deps formula` This approach ignores any options that are specified in the parent formula. This pull request adds a --only-dependencies option to brew install that installs the dependencies of a formula with optional flags, but returns before installing the parent formula. Closes Homebrew/homebrew#25272. Signed-off-by: Jack Nagel --- Library/Contributions/brew_bash_completion.sh | 1 + Library/Contributions/manpages/brew.1.md | 5 ++++- Library/Homebrew/extend/ARGV.rb | 4 ++++ Library/Homebrew/formula_installer.rb | 10 +++++++++- 4 files changed, 18 insertions(+), 2 deletions(-) (limited to 'Library') diff --git a/Library/Contributions/brew_bash_completion.sh b/Library/Contributions/brew_bash_completion.sh index 886c52ce3..b7bd830d7 100644 --- a/Library/Contributions/brew_bash_completion.sh +++ b/Library/Contributions/brew_bash_completion.sh @@ -235,6 +235,7 @@ _brew_install () --HEAD --ignore-dependencies --interactive + --only-dependencies --verbose $(brew options --compact "$prv" 2>/dev/null) " diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md index e64f9b34c..549e80562 100644 --- a/Library/Contributions/manpages/brew.1.md +++ b/Library/Contributions/manpages/brew.1.md @@ -151,7 +151,7 @@ Note that these flags should only appear after a command. * `info` : Print the name and version that will be detected for . - * `install [--debug] [--env=] [--ignore-dependencies] [--fresh] [--cc=] [--build-from-source] [--devel|--HEAD]` : + * `install [--debug] [--env=] [--ignore-dependencies] [--only-dependencies] [--fresh] [--cc=] [--build-from-source] [--devel|--HEAD]` : Install . is usually the name of the formula to install, but it can be specified @@ -170,6 +170,9 @@ Note that these flags should only appear after a command. any kind. If they are not already present, the formula will probably fail to install. + If `--only-dependencies` is passed, install the dependencies with specified + options but do not install the specified formula. + If `--fresh` is passed, the installation process will not re-use any options from previous installs. diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index 5aa90dbb9..c2e1a9c2e 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -102,6 +102,10 @@ module HomebrewArgvExtension include? '--ignore-dependencies' end + def only_deps? + include? '--only-dependencies' + end + def json value 'json' end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index a78fd0d13..8990b3afc 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -15,13 +15,14 @@ class FormulaInstaller include FormulaCellarChecks attr_reader :f - attr_accessor :tab, :options, :ignore_deps + attr_accessor :tab, :options, :ignore_deps, :only_deps attr_accessor :show_summary_heading, :show_header def initialize ff @f = ff @show_header = false @ignore_deps = ARGV.ignore_deps? || ARGV.interactive? + @only_deps = ARGV.only_deps? @options = Options.new @tab = Tab.dummy_tab(ff) @@ -105,6 +106,8 @@ class FormulaInstaller compute_and_install_dependencies unless ignore_deps + return if only_deps + if ARGV.build_bottle? && (arch = ARGV.bottle_arch) && !Hardware::CPU.optimization_flags.include?(arch) raise "Unrecognized architecture for --bottle-arch: #{arch}" end @@ -270,6 +273,7 @@ class FormulaInstaller fi.tab = dep_tab fi.options = dep_options fi.ignore_deps = true + fi.only_deps = false fi.show_header = false oh1 "Installing #{f} dependency: #{Tty.green}#{dep}#{Tty.reset}" outdated_keg.unlink if outdated_keg @@ -282,6 +286,8 @@ class FormulaInstaller end def caveats + return if only_deps + if ARGV.homebrew_developer? and not f.keg_only? audit_bin audit_sbin @@ -299,6 +305,8 @@ class FormulaInstaller end def finish + return if only_deps + ohai 'Finishing up' if ARGV.verbose? install_plist -- cgit v1.2.3