Merge pull request #2940 from kevinburke/move-brew-prefix

Speed up brew --prefix
This commit is contained in:
Mike McQuaid 2017-07-25 16:12:25 +01:00 committed by GitHub
commit 53038a14b3

View File

@ -1,3 +1,24 @@
# Force UTF-8 to avoid encoding issues for users with broken locale settings.
if [[ "$(locale charmap 2>/dev/null)" != "UTF-8" ]]
then
export LC_ALL="en_US.UTF-8"
fi
# Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local
# for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY.
if [[ -d "$HOMEBREW_REPOSITORY/Cellar" ]]
then
HOMEBREW_CELLAR="$HOMEBREW_REPOSITORY/Cellar"
else
HOMEBREW_CELLAR="$HOMEBREW_PREFIX/Cellar"
fi
case "$*" in
--prefix) echo "$HOMEBREW_PREFIX"; exit 0 ;;
--cellar) echo "$HOMEBREW_CELLAR"; exit 0 ;;
--repository|--repo) echo "$HOMEBREW_REPOSITORY"; exit 0 ;;
esac
HOMEBREW_VERSION="$(git -C "$HOMEBREW_REPOSITORY" describe --tags --dirty --abbrev=7 2>/dev/null)" HOMEBREW_VERSION="$(git -C "$HOMEBREW_REPOSITORY" describe --tags --dirty --abbrev=7 2>/dev/null)"
HOMEBREW_USER_AGENT_VERSION="$HOMEBREW_VERSION" HOMEBREW_USER_AGENT_VERSION="$HOMEBREW_VERSION"
if [[ -z "$HOMEBREW_VERSION" ]] if [[ -z "$HOMEBREW_VERSION" ]]
@ -42,27 +63,6 @@ git() {
"$HOMEBREW_LIBRARY/Homebrew/shims/scm/git" "$@" "$HOMEBREW_LIBRARY/Homebrew/shims/scm/git" "$@"
} }
# Force UTF-8 to avoid encoding issues for users with broken locale settings.
if [[ "$(locale charmap 2>/dev/null)" != "UTF-8" ]]
then
export LC_ALL="en_US.UTF-8"
fi
# Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local
# for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY.
if [[ -d "$HOMEBREW_REPOSITORY/Cellar" ]]
then
HOMEBREW_CELLAR="$HOMEBREW_REPOSITORY/Cellar"
else
HOMEBREW_CELLAR="$HOMEBREW_PREFIX/Cellar"
fi
case "$*" in
--prefix) echo "$HOMEBREW_PREFIX"; exit 0 ;;
--cellar) echo "$HOMEBREW_CELLAR"; exit 0 ;;
--repository|--repo) echo "$HOMEBREW_REPOSITORY"; exit 0 ;;
esac
if [[ "$HOMEBREW_PREFIX" = "/" || "$HOMEBREW_PREFIX" = "/usr" ]] if [[ "$HOMEBREW_PREFIX" = "/" || "$HOMEBREW_PREFIX" = "/usr" ]]
then then
# it may work, but I only see pain this route and don't want to support it # it may work, but I only see pain this route and don't want to support it