Skip to content
Snippets Groups Projects
Commit bcf0d6f2 authored by Max Howell's avatar Max Howell
Browse files

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.
parent a0df6180
No related branches found
No related tags found
No related merge requests found
......@@ -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 }
......
......@@ -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'
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment