Merge pull request #776 from harshavardhana/dep_branch

Fix dependency checking on osx
This commit is contained in:
Harshavardhana 2015-07-27 18:26:39 -07:00
commit 55d22fa8d6
1 changed files with 67 additions and 46 deletions

View File

@ -32,6 +32,27 @@ _init() {
MISSING=""
}
readlink() {
TARGET_FILE=$1
cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE`
# Iterate down a (possible) chain of symlinks
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE=$(env readlink $TARGET_FILE)
cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE`
done
# Compute the canonicalized name by finding the physical path
# for the directory we're in and appending the target file.
PHYS_DIR=`pwd -P`
RESULT=$PHYS_DIR/$TARGET_FILE
echo $RESULT
}
###
#
# Takes two arguments
@ -106,7 +127,7 @@ check_golang_env() {
local new_go_binary_path=${go_binary_path}
if [ -h "${go_binary_path}" ]; then
new_go_binary_path=$(/bin/readlink -f ${go_binary_path})
new_go_binary_path=$(readlink ${go_binary_path})
fi
if [[ !"$(dirname ${new_go_binary_path})" =~ *"${GOROOT%%*(/)}"* ]] ; then