@@ -101,8 +101,6 @@ o:tegra/optee-src/nv-optee:nv-tegra.nvidia.com/tegra/optee-src/nv-optee.git:
101101o:tegra/v4l2-src/v4l2_libs:nv-tegra.nvidia.com/tegra/v4l2-src/v4l2_libs.git:
102102"
103103
104- # exit on error on sync
105- EOE=0
106104# after processing SOURCE_INFO
107105NSOURCES=0
108106declare -a SOURCE_INFO_PROCESSED
@@ -120,7 +118,6 @@ function Usages {
120118 echo " Use: $1 [options]"
121119 echo " Available general options are,"
122120 echo " -h : help"
123- echo " -e : exit on sync error"
124121 echo " -d [DIR] : root of source is DIR"
125122 echo " -t [TAG] : Git tag that will be used to sync all the sources"
126123 echo " "
@@ -186,13 +183,11 @@ function DownloadAndSync {
186183 local REPO_URL=" $3 "
187184 local TAG=" $4 "
188185 local OPT=" $5 "
189- local RET=0
190186
191187 if [ -d " ${LDK_SOURCE_DIR} " ]; then
192188 echo " Directory for $WHAT , ${LDK_SOURCE_DIR} , already exists!"
193189 pushd " ${LDK_SOURCE_DIR} " > /dev/null
194- git status 2>&1 > /dev/null
195- if [ $? -ne 0 ]; then
190+ if ! git status 2>&1 > /dev/null; then
196191 echo " But the directory is not a git repository -- clean it up first"
197192 echo " "
198193 popd > /dev/null
@@ -203,10 +198,8 @@ function DownloadAndSync {
203198 else
204199 echo " Downloading default $WHAT source..."
205200
206- git clone " $REPO_URL " -n ${LDK_SOURCE_DIR} 2>&1 > /dev/null
207- if [ $? -ne 0 ]; then
208- echo " $2 source sync failed!"
209- echo " "
201+ if ! git clone -n " $REPO_URL " ${LDK_SOURCE_DIR} 2>&1 > /dev/null; then
202+ echo " $2 source sync failed"
210203 return 1
211204 fi
212205
@@ -222,31 +215,27 @@ function DownloadAndSync {
222215 fi
223216
224217 if [[ -n " $TAG " ]]; then
225- pushd ${LDK_SOURCE_DIR} > /dev/null
226- git tag -l 2> /dev/null | grep -q -P " ^$TAG \$ "
227- if [ $? -eq 0 ]; then
218+ if [ -n $( git -C $LDK_SOURCE_DIR tag -l " ^$TAG \$ " ) ]; then
228219 echo " Syncing up with tag $TAG ..."
229220 if git -C $LDK_SOURCE_DIR checkout -b mybranch_$( date +%Y-%m-%d-%s) $TAG ; then
230221 echo " $2 source sync'ed to tag $TAG successfully!"
231222 else
232223 echo " $2 could not sync to tag $TAG !"
224+ echo
233225 return 3
234226 fi
235227 else
236228 echo " Couldn't find tag $TAG "
237229 echo " $2 source sync to tag $TAG failed!"
230+ echo
238231 return 4
239232 fi
240- popd > /dev/null
241233 fi
242- echo " "
243- echo " "
244-
245- return " $RET "
234+ echo
246235}
247236
248237# prepare processing ....
249- GETOPT=" :ehd :t:"
238+ GETOPT=" :hd :t:"
250239
251240OIFS=" $IFS "
252241IFS=$( echo -en " \n\b" )
@@ -273,9 +262,6 @@ while getopts "$GETOPT" opt; do
273262 ;;
274263 esac
275264 ;;
276- e)
277- EOE=1
278- ;;
279265 h)
280266 Usages " $SCRIPT_NAME "
281267 exit 1
@@ -341,12 +327,12 @@ for ((i=0; i < NSOURCES; i++)); do
341327 DNLOAD=$( echo " ${SOURCE_INFO_PROCESSED[i]} " | cut -f 5 -d ' :' )
342328
343329 if [ $DALL -eq 1 -o " x${DNLOAD} " == " xy" ]; then
344- if DownloadAndSync " $WHAT " " ${LDK_DIR} /${WHAT} " " git ://${REPO} " " ${TAG} " " ${OPT} " ; then
330+ if DownloadAndSync " $WHAT " " ${LDK_DIR} /${WHAT} " " https ://${REPO} " " ${TAG} " " ${OPT} " ; then
345331 true
346332 else
347333 if [[ $? == 1 ]]; then
348- echo " Trying https protocol"
349- DownloadAndSync " $WHAT " " ${LDK_DIR} /${WHAT} " " https ://${REPO} " " ${TAG} " " ${OPT} "
334+ echo " Trying git protocol"
335+ DownloadAndSync " $WHAT " " ${LDK_DIR} /${WHAT} " " git ://${REPO} " " ${TAG} " " ${OPT} "
350336 fi
351337 fi
352338 fi
0 commit comments