Use "\cd" to disable alias temporarily.

http://code.google.com/p/android/issues/detail?id=41372

Change-Id: I78e468cb5d57e51774d2e42376ef1f4b52096d33
This commit is contained in:
Ying Wang 2012-12-13 10:52:07 -08:00
parent 5ece4724d1
commit 9cd1764814
1 changed files with 14 additions and 23 deletions

View File

@ -31,7 +31,7 @@ function get_abs_build_var()
echo "Couldn't locate the top of the tree. Try setting TOP." >&2
return
fi
(cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
(\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
make --no-print-directory -C "$T" -f build/core/config.mk dumpvar-abs-$1)
}
@ -584,16 +584,13 @@ function gettop
# faked up with symlink names.
PWD= /bin/pwd
else
# We redirect cd to /dev/null in case it's aliased to
# a command that prints something as a side-effect
# (like pushd)
local HERE=$PWD
T=
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
cd .. > /dev/null
\cd ..
T=`PWD= /bin/pwd`
done
cd $HERE > /dev/null
\cd $HERE
if [ -f "$T/$TOPFILE" ]; then
echo $T
fi
@ -614,21 +611,18 @@ function m()
function findmakefile()
{
TOPFILE=build/core/envsetup.mk
# We redirect cd to /dev/null in case it's aliased to
# a command that prints something as a side-effect
# (like pushd)
local HERE=$PWD
T=
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
T=`PWD= /bin/pwd`
if [ -f "$T/Android.mk" ]; then
echo $T/Android.mk
cd $HERE > /dev/null
\cd $HERE
return
fi
cd .. > /dev/null
\cd ..
done
cd $HERE > /dev/null
\cd $HERE
}
function mm()
@ -670,7 +664,7 @@ function mmm()
fi
DIR=`echo $DIR | sed -e 's/:.*//' -e 's:/$::'`
if [ -f $DIR/Android.mk ]; then
TO_CHOP=`(cd -P -- $T && pwd -P) | wc -c | tr -d ' '`
TO_CHOP=`(\cd -P -- $T && pwd -P) | wc -c | tr -d ' '`
TO_CHOP=`expr $TO_CHOP + 1`
START=`PWD= /bin/pwd`
MFILE=`echo $START | cut -c${TO_CHOP}-`
@ -705,7 +699,7 @@ function croot()
{
T=$(gettop)
if [ "$T" ]; then
cd $(gettop)
\cd $(gettop)
else
echo "Couldn't locate the top of the tree. Try setting TOP."
fi
@ -714,20 +708,17 @@ function croot()
function cproj()
{
TOPFILE=build/core/envsetup.mk
# We redirect cd to /dev/null in case it's aliased to
# a command that prints something as a side-effect
# (like pushd)
local HERE=$PWD
T=
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
T=$PWD
if [ -f "$T/Android.mk" ]; then
cd $T
\cd $T
return
fi
cd .. > /dev/null
\cd ..
done
cd $HERE > /dev/null
\cd $HERE
echo "can't find Android.mk"
}
@ -1067,7 +1058,7 @@ function smoketest()
return
fi
(cd "$T" && mmm tests/SmokeTest) &&
(\cd "$T" && mmm tests/SmokeTest) &&
adb uninstall com.android.smoketest > /dev/null &&
adb uninstall com.android.smoketest.tests > /dev/null &&
adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTestApp.apk &&
@ -1094,7 +1085,7 @@ function godir () {
T=$(gettop)
if [[ ! -f $T/filelist ]]; then
echo -n "Creating index..."
(cd $T; find . -wholename ./out -prune -o -wholename ./.repo -prune -o -type f > filelist)
(\cd $T; find . -wholename ./out -prune -o -wholename ./.repo -prune -o -type f > filelist)
echo " Done"
echo ""
fi
@ -1127,7 +1118,7 @@ function godir () {
else
pathname=${lines[0]}
fi
cd $T/$pathname
\cd $T/$pathname
}
# Force JAVA_HOME to point to java 1.6 if it isn't already set