am 9eedd3ab: Merge "Use "\cd" to disable alias temporarily."

* commit '9eedd3abed1d38ac5639a1f47ee80a7dbd0fb207':
  Use "\cd" to disable alias temporarily.
This commit is contained in:
Ying Wang 2012-12-13 15:51:30 -08:00 committed by Android Git Automerger
commit 0adc185a8c

View file

@ -31,7 +31,7 @@ function get_abs_build_var()
echo "Couldn't locate the top of the tree. Try setting TOP." >&2 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
return return
fi 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) 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. # faked up with symlink names.
PWD= /bin/pwd PWD= /bin/pwd
else 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 local HERE=$PWD
T= T=
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
cd .. > /dev/null \cd ..
T=`PWD= /bin/pwd` T=`PWD= /bin/pwd`
done done
cd $HERE > /dev/null \cd $HERE
if [ -f "$T/$TOPFILE" ]; then if [ -f "$T/$TOPFILE" ]; then
echo $T echo $T
fi fi
@ -614,21 +611,18 @@ function m()
function findmakefile() function findmakefile()
{ {
TOPFILE=build/core/envsetup.mk 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 local HERE=$PWD
T= T=
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
T=`PWD= /bin/pwd` T=`PWD= /bin/pwd`
if [ -f "$T/Android.mk" ]; then if [ -f "$T/Android.mk" ]; then
echo $T/Android.mk echo $T/Android.mk
cd $HERE > /dev/null \cd $HERE
return return
fi fi
cd .. > /dev/null \cd ..
done done
cd $HERE > /dev/null \cd $HERE
} }
function mm() function mm()
@ -670,7 +664,7 @@ function mmm()
fi fi
DIR=`echo $DIR | sed -e 's/:.*//' -e 's:/$::'` DIR=`echo $DIR | sed -e 's/:.*//' -e 's:/$::'`
if [ -f $DIR/Android.mk ]; then 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` TO_CHOP=`expr $TO_CHOP + 1`
START=`PWD= /bin/pwd` START=`PWD= /bin/pwd`
MFILE=`echo $START | cut -c${TO_CHOP}-` MFILE=`echo $START | cut -c${TO_CHOP}-`
@ -705,7 +699,7 @@ function croot()
{ {
T=$(gettop) T=$(gettop)
if [ "$T" ]; then if [ "$T" ]; then
cd $(gettop) \cd $(gettop)
else else
echo "Couldn't locate the top of the tree. Try setting TOP." echo "Couldn't locate the top of the tree. Try setting TOP."
fi fi
@ -714,20 +708,17 @@ function croot()
function cproj() function cproj()
{ {
TOPFILE=build/core/envsetup.mk 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 local HERE=$PWD
T= T=
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
T=$PWD T=$PWD
if [ -f "$T/Android.mk" ]; then if [ -f "$T/Android.mk" ]; then
cd $T \cd $T
return return
fi fi
cd .. > /dev/null \cd ..
done done
cd $HERE > /dev/null \cd $HERE
echo "can't find Android.mk" echo "can't find Android.mk"
} }
@ -1067,7 +1058,7 @@ function smoketest()
return return
fi fi
(cd "$T" && mmm tests/SmokeTest) && (\cd "$T" && mmm tests/SmokeTest) &&
adb uninstall com.android.smoketest > /dev/null && adb uninstall com.android.smoketest > /dev/null &&
adb uninstall com.android.smoketest.tests > /dev/null && adb uninstall com.android.smoketest.tests > /dev/null &&
adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTestApp.apk && adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTestApp.apk &&
@ -1094,7 +1085,7 @@ function godir () {
T=$(gettop) T=$(gettop)
if [[ ! -f $T/filelist ]]; then if [[ ! -f $T/filelist ]]; then
echo -n "Creating index..." 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 " Done"
echo "" echo ""
fi fi
@ -1127,7 +1118,7 @@ function godir () {
else else
pathname=${lines[0]} pathname=${lines[0]}
fi fi
cd $T/$pathname \cd $T/$pathname
} }
# Force JAVA_HOME to point to java 1.6 if it isn't already set # Force JAVA_HOME to point to java 1.6 if it isn't already set