Skip to content

Commit

Permalink
ENV: move to new paths. (Homebrew#507)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MikeMcQuaid committed Jul 15, 2016
1 parent de366f7 commit a02be9e
Show file tree
Hide file tree
Showing 98 changed files with 15 additions and 17 deletions.
1 change: 0 additions & 1 deletion Library/ENV/3.2.6

This file was deleted.

1 change: 0 additions & 1 deletion Library/ENV/4.2

This file was deleted.

2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh"
git() {
if [[ -z "$GIT_EXECUTABLE" ]]
then
GIT_EXECUTABLE="$("$HOMEBREW_LIBRARY/ENV/scm/git" --homebrew=print-path)"
GIT_EXECUTABLE="$("$HOMEBREW_LIBRARY/Homebrew/scm/git" --homebrew=print-path)"
fi
"$GIT_EXECUTABLE" "$@"
}
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# Where we store most of Homebrew, taps, and various metadata
HOMEBREW_LIBRARY = Pathname.new(ENV["HOMEBREW_LIBRARY"])

# Where wrapper scripts for Git, Subversion, and various build tools are stored
HOMEBREW_ENV_PATH = HOMEBREW_LIBRARY/"ENV"
# Where shim scripts for various build and SCM tools are stored
HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY/"Homebrew/shims"

# Where we store lock files
HOMEBREW_LOCK_DIR = HOMEBREW_LIBRARY/"Locks"
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/mac/extend/ENV/std.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def setup_build_environment(formula = nil)
end

def homebrew_extra_pkg_config_paths
["#{HOMEBREW_ENV_PATH}/pkgconfig/#{MacOS.version}"]
["#{HOMEBREW_LIBRARY_PATH}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"]
end

# Sets architecture-specific flags for every environment variable
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/extend/os/mac/extend/ENV/super.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ module Superenv
def self.bin
return unless DevelopmentTools.installed?

bin = HOMEBREW_ENV_PATH.subdirs.reject { |d| d.basename.to_s > MacOS::Xcode.version }.max
bin.realpath unless bin.nil?
(HOMEBREW_SHIMS_PATH/"super").realpath
end

def effective_sysroot
Expand All @@ -26,7 +25,8 @@ def homebrew_extra_paths

# @private
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
end
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions Library/ENV/scm/git → Library/Homebrew/shims/scm/git
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ safe_exec() {
}

SCM_FILE="${0##*/}"
SCM_DIR="$(quiet_safe_cd "${0%/*}/" && pwd -P)"
SCM_REAL="$(realpath "$0")"
SCM_DIR="$(quiet_safe_cd "${SCM_REAL%/*}/" && pwd -P)"

if [[ "$1" = --homebrew=* ]]
then
Expand All @@ -84,7 +84,7 @@ case "$(lowercase "$SCM_FILE")" in
;;
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" "$@"

IFS=$'\n'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion Library/Homebrew/test/lib/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Paths pointing into the Homebrew code base that persist across test runs
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(":")

# Paths redirected to a temporary directory and wiped at the end of the test run
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/utils/git.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
module Utils
def self.git_available?
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

def self.git_path
return unless git_available?
@git_path ||= Utils.popen_read(
HOMEBREW_ENV_PATH/"scm/git", "--homebrew=print-path"
HOMEBREW_SHIMS_PATH/"scm/git", "--homebrew=print-path"
).chuzzle
end

def self.git_version
return unless git_available?
@git_version ||= Utils.popen_read(
HOMEBREW_ENV_PATH/"scm/git", "--version"
HOMEBREW_SHIMS_PATH/"scm/git", "--version"
).chomp[/git version (\d+(?:\.\d+)*)/, 1]
end

Expand Down
2 changes: 1 addition & 1 deletion Library/brew.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def require?(path)
end

# Add SCM wrappers.
ENV["PATH"] += "#{File::PATH_SEPARATOR}#{HOMEBREW_ENV_PATH}/scm"
ENV["PATH"] += "#{File::PATH_SEPARATOR}#{HOMEBREW_SHIMS_PATH}/scm"

if cmd
internal_cmd = require? HOMEBREW_LIBRARY_PATH.join("cmd", cmd)
Expand Down
2 changes: 1 addition & 1 deletion Library/brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ brew() {
}

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.
Expand Down

0 comments on commit a02be9e

Please sign in to comment.