aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMax Howell2009-09-07 01:06:08 +0100
committerMax Howell2009-09-10 19:23:03 +0100
commit0a31190fdca5fd8619263e66212d74d4c2f56a74 (patch)
tree85838fd18e3f8056e2c19e099d0211deebee08a7 /bin
parent111a75d2621531dfaf0af3918e58516feabbe633 (diff)
downloadbrew-0a31190fdca5fd8619263e66212d74d4c2f56a74.tar.bz2
Dependency resolution
Specify dependencies in your formula's deps function. You can return an Array, String or Hash, eg: def deps { :optional => 'libogg', :required => %w[flac sdl], :recommended => 'cmake' } end Note currently the Hash is flattened and qualifications are ignored. If you only return an Array or String, the qualification is assumed to be :required. Other packaging systems have problems when it comes to packages requiring a specific version of a package, or some patches that may not work well with other software. With Homebrew we have some options: 1. If the formula is vanilla but an older version we can cherry-pick the old version and install it in the Cellar in parallel, but just not symlink it into /usr/local while forcing the formula that depends on it to link to that one and not any other versions of it. 2. If the dependency requires patches then we shouldn't install this for use by any other tools, (I guess this needs to be decided on a per-situation basis). It can be installed into the parent formula's prefix, and not symlinked into /usr/local. In this case the dependency's Formula derivation should be saved in the parent formula's file (check git or flac for an example of this). Both the above can be done currently with hacks, so I'll flesh out a proper way sometime this week.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/brew31
1 files changed, 16 insertions, 15 deletions
diff --git a/bin/brew b/bin/brew
index ba7080290..6ce18a4ac 100755
--- a/bin/brew
+++ b/bin/brew
@@ -95,20 +95,24 @@ begin
raise "We cannot find a c compiler, have you installed the latest Xcode?"
end
- require 'beer_events'
-
- watch_out_for_spill do
- ARGV.formulae.each do |f|
- if f.installed? and not ARGV.force?
- message = "Formula already installed: #{f.prefix}"
- if ARGV.formulae.count > 1
- opoo message
- else
- puts message # if only one is being installed a warning looks severe
- end
- next
+ fae = ARGV.formulae.reject do |f|
+ if f.installed? and not ARGV.force?
+ message = "Formula already installed: #{f.prefix}"
+ if ARGV.formulae.count > 1
+ opoo message
+ else
+ puts message # if only one is being installed a warning looks severe
end
+ true
+ end
+ end
+
+ fae=expand_deps ARGV.formulae
+ require 'beer_events'
+
+ watch_out_for_spill do
+ fae.each do |f|
# we need to ensure a pristine ENV for each process or the formula
# will start with the ENV from the previous build
pid=fork
@@ -162,9 +166,6 @@ begin
when 'unlink'
ARGV.kegs.each {|keg| puts "#{keg.unlink} links removed for #{keg}"}
- when 'unlink'
- ARGV.kegs.each {|keg| puts "#{keg.unlink} links removed for #{keg}"}
-
when 'rm', 'uninstall', 'remove'
ARGV.kegs.each do |keg|
puts "Uninstalling #{keg}..."