From 480aa69f5a087adc85c0d7204fb6736eb06ed8a8 Mon Sep 17 00:00:00 2001 From: Yongqin Liu Date: Tue, 17 May 2016 13:13:17 +0800 Subject: functions: make apply command support for --local option so that we can apply patches to the local path we specified. By this way we can customize the project path on local side Change-Id: I6138d0d5b9f52a613fc05eac6d7aae278562d302 Signed-off-by: Yongqin Liu --- functions | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/functions b/functions index 61ccfe9..761b4e0 100644 --- a/functions +++ b/functions @@ -10,6 +10,7 @@ apply() { local REPO local DIR local SERVER + local LOCAL_DIR if [ "$1" = "--linaro" ]; then SERVER="git://review.android.git.linaro.org/" shift @@ -21,14 +22,24 @@ apply() { SERVER="https://android.googlesource.com/" fi - if echo "$1" |grep -q '^device/'; then + # Make specifying local path possible + if [ "$1" = "--local" ]; then + shift + LOCAL_DIR="$1" + shift + else + LOCAL_DIR="$1" + fi + + # device and kernel have different path on repo to projects under platform + if echo "$1" |grep -q -e '^device/' -e '^kernel/'; then REPO="$1" else REPO="platform/$1" fi DIR=`echo $2 |cut -d/ -f1 |rev |cut -b1-2 |rev` - cd "$AOSP"/"$1" + cd "$AOSP"/"${LOCAL_DIR}" echo "=== Applying $2 ===" if ! git fetch "$SERVER$REPO" refs/changes/$DIR/"$2"; then echo "Failed to fetch $2, typo in script?" -- cgit v1.2.3