diff options
| author | Max Howell | 2012-09-23 21:06:09 -0400 |
|---|---|---|
| committer | Max Howell | 2012-09-23 21:26:50 -0400 |
| commit | bcf0d6f2450cdea84a32f9a844307804f542fc21 (patch) | |
| tree | 1591c01a7fbfd6e69c6c2370bdc3ebf54db73028 /Library | |
| parent | a0df6180b7c99f7cb78493bd1c103012e3e328b1 (diff) | |
| download | brew-bcf0d6f2450cdea84a32f9a844307804f542fc21.tar.bz2 | |
superenv: Remove HOMEBREW_PREFIX/bin from PATH
We add the bins from all deps instead. Rationale: formula find and use eg. GNU-coreutils versions of things and then break. Only allow formula to use tools that they depend on and expect.
I want to go further and only add include paths etc. for dependencies, I have done some work on this, but I fear it may be impossible. If an include path is eg. /usr/local/lib/foo/include, is it possible to know if this path is bad? Not always AFAICT.
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Homebrew/build.rb | 1 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/sh.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/superenv.rb | 5 |
3 files changed, 8 insertions, 2 deletions
diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index d3892819b..80ad6f159 100755 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -97,6 +97,7 @@ def install f if superenv? ENV.deps = keg_only_deps.map(&:to_s) + ENV.all_deps = f.recursive_deps.map(&:to_s) ENV.x11 = f.recursive_requirements.detect{|rq| rq.class == X11Dependency } ENV.setup_build_environment f.recursive_requirements.each { |rq| rq.modify_build_environment } diff --git a/Library/Homebrew/cmd/sh.rb b/Library/Homebrew/cmd/sh.rb index eca214e34..956cc4ecd 100644 --- a/Library/Homebrew/cmd/sh.rb +++ b/Library/Homebrew/cmd/sh.rb @@ -8,6 +8,10 @@ module Homebrew extend self ENV.deps = Formula.installed.select{|f| f.keg_only? and f.opt_prefix.directory? }.map(&:name) end ENV.setup_build_environment + if superenv? + # superenv stopped adding brew's bin but generally user's will want it + ENV['PATH'] = ENV['PATH'].split(':').insert(1, "#{HOMEBREW_PREFIX}/bin").join(':') + end ENV['PS1'] = 'brew \[\033[1;32m\]\w\[\033[0m\]$ ' ENV['VERBOSE'] = '1' ENV['HOMEBREW_LOG'] = '1' diff --git a/Library/Homebrew/superenv.rb b/Library/Homebrew/superenv.rb index cefacdae3..7024affc6 100644 --- a/Library/Homebrew/superenv.rb +++ b/Library/Homebrew/superenv.rb @@ -23,6 +23,7 @@ end class << ENV attr :deps, true + attr :all_deps, true # above is just keg-only-deps attr :x11, true alias_method :x11?, :x11 @@ -104,8 +105,7 @@ class << ENV paths << "#{MacSystem.xcode43_developer_dir}/usr/bin" paths << "#{MacSystem.xcode43_developer_dir}/Toolchains/XcodeDefault.xctoolchain/usr/bin" end - paths += deps.map{|dep| "#{HOMEBREW_PREFIX}/opt/#{dep}/bin" } - paths << HOMEBREW_PREFIX/:bin + paths += all_deps.map{|dep| "#{HOMEBREW_PREFIX}/opt/#{dep}/bin" } paths << "#{MacSystem.x11_prefix}/bin" if x11? paths += %w{/usr/bin /bin /usr/sbin /sbin} paths.to_path_s @@ -256,6 +256,7 @@ if not superenv? ENV.prepend 'PATH', "#{HOMEBREW_PREFIX}/bin", ':' unless ORIGINAL_PATHS.include? HOMEBREW_PREFIX/'bin' else ENV.deps = [] + ENV.all_deps = [] end |
