From b5f942764a58c1a04e04de83e94eb59a915ee3cb Mon Sep 17 00:00:00 2001 From: Charlie Sharpsteen Date: Sat, 26 Nov 2011 21:03:46 -0800 Subject: Re-work ARGV filtering to properly handle --HEAD Previously, stripping arguments like `--HEAD` for dependencies failed because that flag affects the installation prefix encoded into formula objects. The previous implementation of `ARGV` filtering tried to contain all changes to a single method call before the `FormulaInstaller` forks. This update spreads things out a bit: - The Homebrew `ARGV` extension adds a new method, `filter_for_dependencies` which strips flags like `--HEAD`, yields to a block, then restores the original contents of ARGV. - The `explicitly_requested?` test, which returns true or false depending on if a formula object is a member of `ARGV.formulae`, is now a method of `Formula` objects. - `FormulaInstaller` objects now execute the installation of dependencies inside an `ARGV.filter_for_dependencies` block if the dependency was `explicitly_requested?`. Fixes Homebrew/homebrew#8668. Closes Homebrew/homebrew#7724. --- Library/Homebrew/cmd/install.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 7142a5fcb..2848986d4 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -84,6 +84,10 @@ module Homebrew extend self unless formulae.empty? perform_preinstall_checks formulae.each do |f| + # Check formula status and skip if necessary---a formula passed on the + # command line may have been installed to satisfy a dependency. + next if f.installed? + begin fi = FormulaInstaller.new(f) fi.install -- cgit v1.2.3