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.
This commit is contained in:
parent
a0df6180b7
commit
bcf0d6f245
@ -97,6 +97,7 @@ def install f
|
|||||||
|
|
||||||
if superenv?
|
if superenv?
|
||||||
ENV.deps = keg_only_deps.map(&:to_s)
|
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.x11 = f.recursive_requirements.detect{|rq| rq.class == X11Dependency }
|
||||||
ENV.setup_build_environment
|
ENV.setup_build_environment
|
||||||
f.recursive_requirements.each { |rq| rq.modify_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)
|
ENV.deps = Formula.installed.select{|f| f.keg_only? and f.opt_prefix.directory? }.map(&:name)
|
||||||
end
|
end
|
||||||
ENV.setup_build_environment
|
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['PS1'] = 'brew \[\033[1;32m\]\w\[\033[0m\]$ '
|
||||||
ENV['VERBOSE'] = '1'
|
ENV['VERBOSE'] = '1'
|
||||||
ENV['HOMEBREW_LOG'] = '1'
|
ENV['HOMEBREW_LOG'] = '1'
|
||||||
|
|||||||
@ -23,6 +23,7 @@ end
|
|||||||
|
|
||||||
class << ENV
|
class << ENV
|
||||||
attr :deps, true
|
attr :deps, true
|
||||||
|
attr :all_deps, true # above is just keg-only-deps
|
||||||
attr :x11, true
|
attr :x11, true
|
||||||
alias_method :x11?, :x11
|
alias_method :x11?, :x11
|
||||||
|
|
||||||
@ -104,8 +105,7 @@ class << ENV
|
|||||||
paths << "#{MacSystem.xcode43_developer_dir}/usr/bin"
|
paths << "#{MacSystem.xcode43_developer_dir}/usr/bin"
|
||||||
paths << "#{MacSystem.xcode43_developer_dir}/Toolchains/XcodeDefault.xctoolchain/usr/bin"
|
paths << "#{MacSystem.xcode43_developer_dir}/Toolchains/XcodeDefault.xctoolchain/usr/bin"
|
||||||
end
|
end
|
||||||
paths += deps.map{|dep| "#{HOMEBREW_PREFIX}/opt/#{dep}/bin" }
|
paths += all_deps.map{|dep| "#{HOMEBREW_PREFIX}/opt/#{dep}/bin" }
|
||||||
paths << HOMEBREW_PREFIX/:bin
|
|
||||||
paths << "#{MacSystem.x11_prefix}/bin" if x11?
|
paths << "#{MacSystem.x11_prefix}/bin" if x11?
|
||||||
paths += %w{/usr/bin /bin /usr/sbin /sbin}
|
paths += %w{/usr/bin /bin /usr/sbin /sbin}
|
||||||
paths.to_path_s
|
paths.to_path_s
|
||||||
@ -256,6 +256,7 @@ if not superenv?
|
|||||||
ENV.prepend 'PATH', "#{HOMEBREW_PREFIX}/bin", ':' unless ORIGINAL_PATHS.include? HOMEBREW_PREFIX/'bin'
|
ENV.prepend 'PATH', "#{HOMEBREW_PREFIX}/bin", ':' unless ORIGINAL_PATHS.include? HOMEBREW_PREFIX/'bin'
|
||||||
else
|
else
|
||||||
ENV.deps = []
|
ENV.deps = []
|
||||||
|
ENV.all_deps = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user