diff options
Diffstat (limited to 'envsetup.sh')
-rw-r--r-- | envsetup.sh | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/envsetup.sh b/envsetup.sh index 2386e1c..8b36bba 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -101,6 +101,8 @@ function setpaths() fi if [ -n $ANDROID_PRE_BUILD_PATHS ] ; then export PATH=${PATH/$ANDROID_PRE_BUILD_PATHS/} + # strip trailing ':', if any + export PATH=${PATH/%:/} fi # and in with the new @@ -126,12 +128,12 @@ function setpaths() export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT) export OUT=$ANDROID_PRODUCT_OUT + unset ANDROID_HOST_OUT + export ANDROID_HOST_OUT=$(get_abs_build_var HOST_OUT) + # needed for building linux on MacOS # TODO: fix the path #export HOST_EXTRACFLAGS="-I "$T/system/kernel_headers/host_include - - # needed for OProfile to post-process collected samples - export OPROFILE_EVENTS_DIR=$prebuiltdir/oprofile } function printconfig() @@ -777,7 +779,11 @@ function gdbclient() local PID local PROG="$3" if [ "$PROG" ] ; then - PID=`pid $3` + if [[ "$PROG" =~ ^[0-9]+$ ]] ; then + PID="$3" + else + PID=`pid $3` + fi adb forward "tcp$PORT" "tcp$PORT" adb shell gdbserver $PORT --attach $PID & sleep 2 @@ -806,55 +812,55 @@ case `uname -s` in Darwin) function sgrep() { - find -E . -type f -iregex '.*\.(c|h|cpp|S|java|xml|sh|mk)' -print0 | xargs -0 grep --color -n "$@" + find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cpp|S|java|xml|sh|mk)' -print0 | xargs -0 grep --color -n "$@" } ;; *) function sgrep() { - find . -type f -iregex '.*\.\(c\|h\|cpp\|S\|java\|xml\|sh\|mk\)' -print0 | xargs -0 grep --color -n "$@" + find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cpp\|S\|java\|xml\|sh\|mk\)' -print0 | xargs -0 grep --color -n "$@" } ;; esac function jgrep() { - find . -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@" + find . -name .repo -prune -o -name .git -prune -o -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@" } function cgrep() { - find . -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 grep --color -n "$@" + find . -name .repo -prune -o -name .git -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 grep --color -n "$@" } function resgrep() { - for dir in `find . -name res -type d`; do find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"; done; + for dir in `find . -name .repo -prune -o -name .git -prune -o -name res -type d`; do find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"; done; } case `uname -s` in Darwin) function mgrep() { - find -E . -type f -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -print0 | xargs -0 grep --color -n "$@" + find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -print0 | xargs -0 grep --color -n "$@" } function treegrep() { - find -E . -type f -iregex '.*\.(c|h|cpp|S|java|xml)' -print0 | xargs -0 grep --color -n -i "$@" + find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cpp|S|java|xml)' -print0 | xargs -0 grep --color -n -i "$@" } ;; *) function mgrep() { - find . -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -type f -print0 | xargs -0 grep --color -n "$@" + find . -name .repo -prune -o -name .git -prune -o -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -type f -print0 | xargs -0 grep --color -n "$@" } function treegrep() { - find . -regextype posix-egrep -iregex '.*\.(c|h|cpp|S|java|xml)' -type f -print0 | xargs -0 grep --color -n -i "$@" + find . -name .repo -prune -o -name .git -prune -o -regextype posix-egrep -iregex '.*\.(c|h|cpp|S|java|xml)' -type f -print0 | xargs -0 grep --color -n -i "$@" } ;; @@ -1058,7 +1064,7 @@ function godir () { echo "" fi local lines - lines=($(grep "$1" $T/filelist | sed -e 's/\/[^/]*$//' | sort | uniq)) + lines=($(grep "$1" $T/filelist | sed -e 's/\/[^/]*$//' | sort | uniq)) if [[ ${#lines[@]} = 0 ]]; then echo "Not found" return @@ -1071,7 +1077,7 @@ function godir () { local line for line in ${lines[@]}; do printf "%6s %s\n" "[$index]" $line - index=$(($index + 1)) + index=$(($index + 1)) done echo echo -n "Select one: " |