vendor: add aospremote and cafremote functions
Change-Id: I21318786dde838a51a2672c1af7cfd32ee8c1c8b
diff --git a/build/envsetup.sh b/build/envsetup.sh
index 707029e..784d595 100644
--- a/build/envsetup.sh
+++ b/build/envsetup.sh
@@ -103,3 +103,51 @@
$T/vendor/omni/build/tools/repopick.py $@
}
+function aospremote()
+{
+ if ! git rev-parse --git-dir &> /dev/null
+ then
+ echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
+ return 1
+ fi
+ git remote rm aosp 2> /dev/null
+ local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
+ # Google moved the repo location in Oreo
+ if [ $PROJECT = "build/make" ]
+ then
+ PROJECT="build"
+ fi
+ if (echo $PROJECT | grep -qv "^device")
+ then
+ local PFX="platform/"
+ fi
+ git remote add aosp https://android.googlesource.com/$PFX$PROJECT
+ echo "Remote 'aosp' created"
+}
+
+function cafremote()
+{
+ if ! git rev-parse --git-dir &> /dev/null
+ then
+ echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
+ return 1
+ fi
+ git remote rm caf 2> /dev/null
+ local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##")
+ # Google moved the repo location in Oreo
+ if [ $PROJECT = "build/make" ]
+ then
+ PROJECT="build"
+ fi
+ if [[ $PROJECT =~ "qcom/opensource" ]];
+ then
+ PROJECT=$(echo $PROJECT | sed -e "s#qcom\/opensource#qcom-opensource#")
+ fi
+ if (echo $PROJECT | grep -qv "^device")
+ then
+ local PFX="platform/"
+ fi
+ git remote add caf https://source.codeaurora.org/quic/la/$PFX$PROJECT
+ echo "Remote 'caf' created"
+}
+