ENV: move to new paths. (#507)

Move some stuff formerly in `Library/ENV` around:
- Move `Library/ENV/$XCODE_VERSION` to `Library/Homebrew/env/super` as they are
  all superenv wrappers and all symlinks to the same version. We never needed
  the "separate shims for separate versions" functionality and it just adds
  confusion.
- Move `Library/ENV/pkgconfig` to `Library/Homebrew/env/pkgconfig` to get more
  things under `Library/Homebrew`
- Move `Library/ENV/scm` to `Library/scm` as these wrappers are not actually
  used by or related to superenv (or stdenv) in any way.
This commit is contained in:
Mike McQuaid 2016-07-15 19:03:45 +01:00 committed by GitHub
parent de366f71b9
commit a02be9eea2
98 changed files with 15 additions and 17 deletions

View File

@ -1 +0,0 @@
4.3

View File

@ -1 +0,0 @@
4.3

View File

@ -14,7 +14,7 @@ source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh"
git() { git() {
if [[ -z "$GIT_EXECUTABLE" ]] if [[ -z "$GIT_EXECUTABLE" ]]
then then
GIT_EXECUTABLE="$("$HOMEBREW_LIBRARY/ENV/scm/git" --homebrew=print-path)" GIT_EXECUTABLE="$("$HOMEBREW_LIBRARY/Homebrew/scm/git" --homebrew=print-path)"
fi fi
"$GIT_EXECUTABLE" "$@" "$GIT_EXECUTABLE" "$@"
} }

View File

@ -14,8 +14,8 @@ HOMEBREW_REPOSITORY = Pathname.new(ENV["HOMEBREW_REPOSITORY"])
# Where we store most of Homebrew, taps, and various metadata # Where we store most of Homebrew, taps, and various metadata
HOMEBREW_LIBRARY = Pathname.new(ENV["HOMEBREW_LIBRARY"]) HOMEBREW_LIBRARY = Pathname.new(ENV["HOMEBREW_LIBRARY"])
# Where wrapper scripts for Git, Subversion, and various build tools are stored # Where shim scripts for various build and SCM tools are stored
HOMEBREW_ENV_PATH = HOMEBREW_LIBRARY/"ENV" HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY/"Homebrew/shims"
# Where we store lock files # Where we store lock files
HOMEBREW_LOCK_DIR = HOMEBREW_LIBRARY/"Locks" HOMEBREW_LOCK_DIR = HOMEBREW_LIBRARY/"Locks"

View File

@ -31,7 +31,7 @@ module Stdenv
end end
def homebrew_extra_pkg_config_paths def homebrew_extra_pkg_config_paths
["#{HOMEBREW_ENV_PATH}/pkgconfig/#{MacOS.version}"] ["#{HOMEBREW_LIBRARY_PATH}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"]
end end
# Sets architecture-specific flags for every environment variable # Sets architecture-specific flags for every environment variable

View File

@ -3,8 +3,7 @@ module Superenv
def self.bin def self.bin
return unless DevelopmentTools.installed? return unless DevelopmentTools.installed?
bin = HOMEBREW_ENV_PATH.subdirs.reject { |d| d.basename.to_s > MacOS::Xcode.version }.max (HOMEBREW_SHIMS_PATH/"super").realpath
bin.realpath unless bin.nil?
end end
def effective_sysroot def effective_sysroot
@ -26,7 +25,8 @@ module Superenv
# @private # @private
def homebrew_extra_pkg_config_paths def homebrew_extra_pkg_config_paths
paths = ["#{HOMEBREW_ENV_PATH}/pkgconfig/#{MacOS.version}"] paths = \
["#{HOMEBREW_LIBRARY_PATH}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"]
paths << "#{MacOS::X11.lib}/pkgconfig" << "#{MacOS::X11.share}/pkgconfig" if x11? paths << "#{MacOS::X11.lib}/pkgconfig" << "#{MacOS::X11.share}/pkgconfig" if x11?
paths paths
end end

View File

@ -65,8 +65,8 @@ safe_exec() {
} }
SCM_FILE="${0##*/}" SCM_FILE="${0##*/}"
SCM_DIR="$(quiet_safe_cd "${0%/*}/" && pwd -P)"
SCM_REAL="$(realpath "$0")" SCM_REAL="$(realpath "$0")"
SCM_DIR="$(quiet_safe_cd "${SCM_REAL%/*}/" && pwd -P)"
if [[ "$1" = --homebrew=* ]] if [[ "$1" = --homebrew=* ]]
then then
@ -84,7 +84,7 @@ case "$(lowercase "$SCM_FILE")" in
;; ;;
esac esac
brew_version="$(quiet_safe_cd "$SCM_DIR/../../../bin" && pwd -P)/$SCM_FILE" brew_version="$(quiet_safe_cd "$SCM_DIR/../../../../bin" && pwd -P)/$SCM_FILE"
safe_exec "$brew_version" "$@" safe_exec "$brew_version" "$@"
IFS=$'\n' IFS=$'\n'

View File

@ -12,7 +12,7 @@ TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") { |k|
# Paths pointing into the Homebrew code base that persist across test runs # Paths pointing into the Homebrew code base that persist across test runs
HOMEBREW_LIBRARY_PATH = Pathname.new(File.expand_path("../../..", __FILE__)) HOMEBREW_LIBRARY_PATH = Pathname.new(File.expand_path("../../..", __FILE__))
HOMEBREW_ENV_PATH = HOMEBREW_LIBRARY_PATH.parent+"ENV" HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY_PATH.parent+"Homebrew/shims"
HOMEBREW_LOAD_PATH = [File.expand_path("..", __FILE__), HOMEBREW_LIBRARY_PATH].join(":") HOMEBREW_LOAD_PATH = [File.expand_path("..", __FILE__), HOMEBREW_LIBRARY_PATH].join(":")
# Paths redirected to a temporary directory and wiped at the end of the test run # Paths redirected to a temporary directory and wiped at the end of the test run

View File

@ -1,20 +1,20 @@
module Utils module Utils
def self.git_available? def self.git_available?
return @git if instance_variable_defined?(:@git) return @git if instance_variable_defined?(:@git)
@git = quiet_system HOMEBREW_ENV_PATH/"scm/git", "--version" @git = quiet_system HOMEBREW_SHIMS_PATH/"scm/git", "--version"
end end
def self.git_path def self.git_path
return unless git_available? return unless git_available?
@git_path ||= Utils.popen_read( @git_path ||= Utils.popen_read(
HOMEBREW_ENV_PATH/"scm/git", "--homebrew=print-path" HOMEBREW_SHIMS_PATH/"scm/git", "--homebrew=print-path"
).chuzzle ).chuzzle
end end
def self.git_version def self.git_version
return unless git_available? return unless git_available?
@git_version ||= Utils.popen_read( @git_version ||= Utils.popen_read(
HOMEBREW_ENV_PATH/"scm/git", "--version" HOMEBREW_SHIMS_PATH/"scm/git", "--version"
).chomp[/git version (\d+(?:\.\d+)*)/, 1] ).chomp[/git version (\d+(?:\.\d+)*)/, 1]
end end

View File

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

View File

@ -29,7 +29,7 @@ brew() {
} }
git() { git() {
"$HOMEBREW_LIBRARY/ENV/scm/git" "$@" "$HOMEBREW_LIBRARY/Homebrew/shims/scm/git" "$@"
} }
# Force UTF-8 to avoid encoding issues for users with broken locale settings. # Force UTF-8 to avoid encoding issues for users with broken locale settings.