Merge pull request #10763 from Homebrew/revert-10595-ruby-shims
Revert "shims/mac/super: add ruby shims to set SDKROOT"
This commit is contained in:
commit
ee52b19179
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@ -276,7 +276,7 @@ jobs:
|
|||||||
- name: Install brew tests dependencies
|
- name: Install brew tests dependencies
|
||||||
run: |
|
run: |
|
||||||
brew install subversion
|
brew install subversion
|
||||||
brew sh -c "svn --homebrew=print-path"
|
Library/Homebrew/shims/scm/svn --homebrew=print-path
|
||||||
which svn
|
which svn
|
||||||
which svnadmin
|
which svnadmin
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
ruby
|
|
@ -1 +0,0 @@
|
|||||||
ruby
|
|
@ -1,12 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# System Ruby's mkmf on Mojave (10.14) and later require SDKROOT set to work correctly.
|
|
||||||
|
|
||||||
source "$HOMEBREW_LIBRARY/Homebrew/shims/utils.sh"
|
|
||||||
|
|
||||||
try_exec_non_system "$SHIM_FILE" "$@"
|
|
||||||
|
|
||||||
if [[ -z "$SDKROOT" && -n "$HOMEBREW_SDKROOT" ]]; then
|
|
||||||
export SDKROOT=$HOMEBREW_SDKROOT
|
|
||||||
fi
|
|
||||||
|
|
||||||
safe_exec "/usr/bin/$SHIM_FILE" "$@"
|
|
@ -3,15 +3,87 @@
|
|||||||
# This script because we support $HOMEBREW_GIT, $HOMEBREW_SVN, etc., Xcode-only and
|
# This script because we support $HOMEBREW_GIT, $HOMEBREW_SVN, etc., Xcode-only and
|
||||||
# no Xcode/CLT configurations. Order is careful to be what the user would want.
|
# no Xcode/CLT configurations. Order is careful to be what the user would want.
|
||||||
|
|
||||||
if [ -z "$HOMEBREW_LIBRARY" ]
|
set +o posix
|
||||||
|
|
||||||
|
quiet_safe_cd() {
|
||||||
|
cd "$1" >/dev/null || { echo "Error: failed to cd to $1" >&2; exit 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
absdir() {
|
||||||
|
quiet_safe_cd "${1%/*}/" && pwd -P
|
||||||
|
}
|
||||||
|
|
||||||
|
dirbasepath() {
|
||||||
|
local dir="$1"
|
||||||
|
local base="${2##*/}"
|
||||||
|
echo "$dir/$base"
|
||||||
|
}
|
||||||
|
|
||||||
|
realpath() {
|
||||||
|
local path="$1"
|
||||||
|
local dir
|
||||||
|
local dest
|
||||||
|
|
||||||
|
dir="$(absdir "$path")"
|
||||||
|
path="$(dirbasepath "$dir" "$path")"
|
||||||
|
|
||||||
|
while [[ -L "$path" ]]
|
||||||
|
do
|
||||||
|
dest="$(readlink "$path")"
|
||||||
|
if [[ "$dest" = "/"* ]]
|
||||||
|
then
|
||||||
|
path="$dest"
|
||||||
|
else
|
||||||
|
path="$dir/$dest"
|
||||||
|
fi
|
||||||
|
dir="$(absdir "$path")"
|
||||||
|
path="$(dirbasepath "$dir" "$path")"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$path"
|
||||||
|
}
|
||||||
|
|
||||||
|
executable() {
|
||||||
|
local file="$1"
|
||||||
|
[[ -f "$file" && -x "$file" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
lowercase() {
|
||||||
|
echo "$1" | tr "[:upper:]" "[:lower:]"
|
||||||
|
}
|
||||||
|
|
||||||
|
safe_exec() {
|
||||||
|
local arg0="$1"
|
||||||
|
if ! executable "$arg0"
|
||||||
|
then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
# prevent fork-bombs
|
||||||
|
if [[ "$(lowercase "$arg0")" = "$SCM_FILE" || "$(realpath "$arg0")" = "$SCM_REAL" ]]
|
||||||
|
then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [[ "$HOMEBREW" = "print-path" ]]
|
||||||
|
then
|
||||||
|
local dir="$(quiet_safe_cd "${arg0%/*}/" && pwd)"
|
||||||
|
local path="$(dirbasepath "$dir" "$arg0")"
|
||||||
|
echo "$path"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
exec "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
SCM_FILE="${0##*/}"
|
||||||
|
SCM_REAL="$(realpath "$0")"
|
||||||
|
SCM_DIR="$(quiet_safe_cd "${SCM_REAL%/*}/" && pwd -P)"
|
||||||
|
|
||||||
|
if [[ "$1" = --homebrew=* ]]
|
||||||
then
|
then
|
||||||
echo "${0##*/}: This shim is internal and must be run via `brew`." >&2
|
HOMEBREW="${1:11}"
|
||||||
exit 1
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source "$HOMEBREW_LIBRARY/Homebrew/shims/utils.sh"
|
case "$(lowercase "$SCM_FILE")" in
|
||||||
|
|
||||||
case "$(lowercase "$SHIM_FILE")" in
|
|
||||||
git)
|
git)
|
||||||
if [[ -n "$HOMEBREW_GIT" && "$HOMEBREW_GIT" != git ]]
|
if [[ -n "$HOMEBREW_GIT" && "$HOMEBREW_GIT" != git ]]
|
||||||
then
|
then
|
||||||
@ -26,10 +98,21 @@ case "$(lowercase "$SHIM_FILE")" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
brew_prefix_version="$HOMEBREW_PREFIX/bin/$SHIM_FILE"
|
brew_prefix_version="$(quiet_safe_cd "$SCM_DIR/../../../../../bin" 2>/dev/null && pwd -P)/$SCM_FILE"
|
||||||
safe_exec "$brew_prefix_version" "$@"
|
safe_exec "$brew_prefix_version" "$@"
|
||||||
|
|
||||||
try_exec_non_system "$SHIM_FILE" "$@"
|
brew_repo_version="$(quiet_safe_cd "$SCM_DIR/../../../../bin" && pwd -P)/$SCM_FILE"
|
||||||
|
safe_exec "$brew_repo_version" "$@"
|
||||||
|
|
||||||
|
IFS=$'\n'
|
||||||
|
for path in $(type -aP "$SCM_FILE")
|
||||||
|
do
|
||||||
|
if [[ "$path" != "/usr/bin/$SCM_FILE" ]]
|
||||||
|
then
|
||||||
|
safe_exec "$path" "$@"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset IFS
|
||||||
|
|
||||||
if executable "/usr/bin/xcode-select"
|
if executable "/usr/bin/xcode-select"
|
||||||
then
|
then
|
||||||
@ -46,19 +129,19 @@ then
|
|||||||
fi
|
fi
|
||||||
if [[ -z "$popup_stub" && "$xcode_path" != "/" ]]
|
if [[ -z "$popup_stub" && "$xcode_path" != "/" ]]
|
||||||
then
|
then
|
||||||
path="$(/usr/bin/xcrun -find "$SHIM_FILE" 2>/dev/null)"
|
path="$(/usr/bin/xcrun -find "$SCM_FILE" 2>/dev/null)"
|
||||||
safe_exec "$path" "$@"
|
safe_exec "$path" "$@"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
path="/Applications/Xcode.app/Contents/Developer/usr/bin/$SHIM_FILE"
|
path="/Applications/Xcode.app/Contents/Developer/usr/bin/$SCM_FILE"
|
||||||
safe_exec "$path" "$@"
|
safe_exec "$path" "$@"
|
||||||
|
|
||||||
if [[ -z "$popup_stub" && "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101500" ]]
|
if [[ -z "$popup_stub" && "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101500" ]]
|
||||||
then
|
then
|
||||||
path="/usr/bin/$SHIM_FILE"
|
path="/usr/bin/$SCM_FILE"
|
||||||
safe_exec "$path" "$@"
|
safe_exec "$path" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "You must: brew install $SHIM_FILE" >&2
|
echo "You must: brew install $SCM_FILE" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -1,94 +0,0 @@
|
|||||||
set +o posix
|
|
||||||
|
|
||||||
quiet_safe_cd() {
|
|
||||||
cd "$1" >/dev/null || { echo "Error: failed to cd to $1" >&2; exit 1; }
|
|
||||||
}
|
|
||||||
|
|
||||||
absdir() {
|
|
||||||
quiet_safe_cd "${1%/*}/" && pwd -P
|
|
||||||
}
|
|
||||||
|
|
||||||
dirbasepath() {
|
|
||||||
local dir="$1"
|
|
||||||
local base="${2##*/}"
|
|
||||||
echo "$dir/$base"
|
|
||||||
}
|
|
||||||
|
|
||||||
realpath() {
|
|
||||||
local path="$1"
|
|
||||||
local dir
|
|
||||||
local dest
|
|
||||||
|
|
||||||
dir="$(absdir "$path")"
|
|
||||||
path="$(dirbasepath "$dir" "$path")"
|
|
||||||
|
|
||||||
while [[ -L "$path" ]]
|
|
||||||
do
|
|
||||||
dest="$(readlink "$path")"
|
|
||||||
if [[ "$dest" = "/"* ]]
|
|
||||||
then
|
|
||||||
path="$dest"
|
|
||||||
else
|
|
||||||
path="$dir/$dest"
|
|
||||||
fi
|
|
||||||
dir="$(absdir "$path")"
|
|
||||||
path="$(dirbasepath "$dir" "$path")"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "$path"
|
|
||||||
}
|
|
||||||
|
|
||||||
executable() {
|
|
||||||
local file="$1"
|
|
||||||
[[ -f "$file" && -x "$file" ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
lowercase() {
|
|
||||||
echo "$1" | tr "[:upper:]" "[:lower:]"
|
|
||||||
}
|
|
||||||
|
|
||||||
safe_exec() {
|
|
||||||
local arg0="$1"
|
|
||||||
if ! executable "$arg0"
|
|
||||||
then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
# prevent fork-bombs
|
|
||||||
if [[ "$(lowercase "$arg0")" = "$SHIM_FILE" || "$(realpath "$arg0")" = "$SHIM_REAL" ]]
|
|
||||||
then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if [[ "$HOMEBREW" = "print-path" ]]
|
|
||||||
then
|
|
||||||
local dir="$(quiet_safe_cd "${arg0%/*}/" && pwd)"
|
|
||||||
local path="$(dirbasepath "$dir" "$arg0")"
|
|
||||||
echo "$path"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
exec "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
try_exec_non_system() {
|
|
||||||
local file="$1"
|
|
||||||
shift
|
|
||||||
|
|
||||||
IFS=$'\n'
|
|
||||||
for path in $(type -aP "$file")
|
|
||||||
do
|
|
||||||
if [[ "$path" != "/usr/bin/$file" ]]
|
|
||||||
then
|
|
||||||
safe_exec "$path" "$@"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
unset IFS
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SHIM_FILE="${0##*/}"
|
|
||||||
SHIM_REAL="$(realpath "$0")"
|
|
||||||
|
|
||||||
if [[ "$1" = --homebrew=* ]]
|
|
||||||
then
|
|
||||||
HOMEBREW="${1:11}"
|
|
||||||
shift
|
|
||||||
fi
|
|
Loading…
x
Reference in New Issue
Block a user