From ce7b32cec835bb658df75a0c691db9a97921163c Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Sun, 20 Mar 2016 01:44:36 +0800 Subject: 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. --- Library/Homebrew/config.rb | 1 + Library/Homebrew/extend/ENV/std.rb | 2 +- Library/Homebrew/extend/ENV/super.rb | 4 ++-- Library/Homebrew/test/lib/config.rb | 1 + Library/Homebrew/test/testing_env.rb | 2 +- Library/brew.rb | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/config.rb b/Library/Homebrew/config.rb index 6da8c481e..4a6ad2f2c 100644 --- a/Library/Homebrew/config.rb +++ b/Library/Homebrew/config.rb @@ -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 diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index 8bfc5ce57..b3b91dc47 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -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 diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index c2401602f..e4eb86cdf 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -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 diff --git a/Library/Homebrew/test/lib/config.rb b/Library/Homebrew/test/lib/config.rb index cf9578544..f6e601d52 100644 --- a/Library/Homebrew/test/lib/config.rb +++ b/Library/Homebrew/test/lib/config.rb @@ -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" diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb index d0c1d500d..8b76dee2c 100644 --- a/Library/Homebrew/test/testing_env.rb +++ b/Library/Homebrew/test/testing_env.rb @@ -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 diff --git a/Library/brew.rb b/Library/brew.rb index 8675ab881..cf89cb86d 100644 --- a/Library/brew.rb +++ b/Library/brew.rb @@ -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) -- cgit v1.2.3