add HOMEBREW_ENV_PATH internal variable

`Library/ENV` like `Library/Homebrew` is part of Homebrew basecode. It
should be able to be accessed during the `brew tests`.

By adding HOMEBREW_ENV_PATH variable, we allow test suit to locate these
codes.
This commit is contained in:
Xu Cheng 2016-03-20 01:44:36 +08:00
parent 28b4923dad
commit ce7b32cec8
6 changed files with 7 additions and 5 deletions

View File

@ -39,6 +39,7 @@ HOMEBREW_PREFIX = Pathname.new(ENV["HOMEBREW_PREFIX"])
HOMEBREW_REPOSITORY = Pathname.new(ENV["HOMEBREW_REPOSITORY"])
HOMEBREW_LIBRARY = Pathname.new(ENV["HOMEBREW_LIBRARY"])
HOMEBREW_ENV_PATH = HOMEBREW_LIBRARY/"ENV"
HOMEBREW_CONTRIB = HOMEBREW_REPOSITORY/"Library/Contributions"
# Where we store built products

View File

@ -77,7 +77,7 @@ module Stdenv
paths = []
paths << "#{HOMEBREW_PREFIX}/lib/pkgconfig"
paths << "#{HOMEBREW_PREFIX}/share/pkgconfig"
paths << "#{HOMEBREW_LIBRARY}/ENV/pkgconfig/#{MacOS.version}"
paths << "#{HOMEBREW_ENV_PATH}/pkgconfig/#{MacOS.version}"
paths << "/usr/lib/pkgconfig"
paths.select { |d| File.directory? d }.join(File::PATH_SEPARATOR)
end

View File

@ -28,7 +28,7 @@ module Superenv
def self.bin
return unless MacOS.has_apple_developer_tools?
bin = (HOMEBREW_REPOSITORY/"Library/ENV").subdirs.reject { |d| d.basename.to_s > MacOS::Xcode.version }.max
bin = HOMEBREW_ENV_PATH.subdirs.reject { |d| d.basename.to_s > MacOS::Xcode.version }.max
bin.realpath unless bin.nil?
end
@ -150,7 +150,7 @@ module Superenv
end
def determine_pkg_config_libdir
paths = %W[/usr/lib/pkgconfig #{HOMEBREW_LIBRARY}/ENV/pkgconfig/#{MacOS.version}]
paths = %W[/usr/lib/pkgconfig #{HOMEBREW_ENV_PATH}/pkgconfig/#{MacOS.version}]
paths << "#{MacOS::X11.lib}/pkgconfig" << "#{MacOS::X11.share}/pkgconfig" if x11?
paths.to_path_s
end

View File

@ -14,6 +14,7 @@ HOMEBREW_PREFIX = Pathname.new(TEST_TMPDIR).join("prefix")
HOMEBREW_REPOSITORY = HOMEBREW_PREFIX
HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY+"Library"
HOMEBREW_LIBRARY_PATH = Pathname.new(File.expand_path("../../..", __FILE__))
HOMEBREW_ENV_PATH = HOMEBREW_LIBRARY_PATH.parent+"ENV"
HOMEBREW_LOAD_PATH = [File.expand_path("..", __FILE__), HOMEBREW_LIBRARY_PATH].join(":")
HOMEBREW_CACHE = HOMEBREW_PREFIX.parent+"cache"
HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent+"formula_cache"

View File

@ -6,7 +6,7 @@ require "global"
require "formulary"
# Test environment setup
%w[ENV Formula].each { |d| HOMEBREW_LIBRARY.join(d).mkpath }
HOMEBREW_LIBRARY.join("Formula").mkpath
%w[cache formula_cache cellar logs].each { |d| HOMEBREW_PREFIX.parent.join(d).mkpath }
# Test fixtures and files can be found relative to this path

View File

@ -50,7 +50,7 @@ begin
end
# Add SCM wrappers.
ENV["PATH"] += "#{File::PATH_SEPARATOR}#{HOMEBREW_LIBRARY}/ENV/scm"
ENV["PATH"] += "#{File::PATH_SEPARATOR}#{HOMEBREW_ENV_PATH}/scm"
if cmd
internal_cmd = require? HOMEBREW_LIBRARY_PATH.join("cmd", cmd)