Hi

This patch does two things:

 - If a git repository has been cloned previously, the repository will be
reset rather than trying and failing to clone the repository again.
 - Two new keywords - AB_GIT_TAGORBRANCH and AB_HG_BRANCH have been added
to checkout tags or branches with Git and Mercurial respectively.

Regards
Cameron
Index: develop/cppcheck/preprocess
===================================================================
--- develop/cppcheck/preprocess	(revision 7220)
+++ develop/cppcheck/preprocess	(nonexistent)
@@ -1 +0,0 @@
-git checkout tags/1.85
Index: develop/cppcheck/setvars
===================================================================
--- develop/cppcheck/setvars	(revision 7220)
+++ develop/cppcheck/setvars	(working copy)
@@ -1,5 +1,6 @@
 
 AB_GIT=https://github.com/danmar/cppcheck.git
+AB_GIT_TAGORBRANCH=1.85
 
 AB_PVERSION=1.85
 AB_ROVERSION=1
Index: fetch-program
===================================================================
--- fetch-program	(revision 7220)
+++ fetch-program	(working copy)
@@ -23,8 +23,10 @@
   fi
 fi
 AB_GIT=$(grep ^AB_GIT $AB_HOME/$AB_PACKAGEDIR/setvars 2>/dev/null | cut -d = -f 2-)
+AB_GIT_TAGORBRANCH=$(grep ^AB_GIT_TAGORBRANCH $AB_HOME/$AB_PACKAGEDIR/setvars 2>/dev/null | cut -d = -f 2-)
 AB_URL=$(grep ^AB_URL $AB_HOME/$AB_PACKAGEDIR/setvars 2>/dev/null | cut -d = -f 2-)
 AB_HG=$(grep ^AB_HG $AB_HOME/$AB_PACKAGEDIR/setvars 2>/dev/null | cut -d = -f 2-)
+AB_HG_BRANCH=$(grep ^AB_HG_BRANCH $AB_HOME/$AB_PACKAGEDIR/setvars 2>/dev/null | cut -d = -f 2-)
 AB_NOREMOTE=$(grep ^AB_NOREMOTE $AB_HOME/$AB_PACKAGEDIR/setvars 2>/dev/null | cut -d = -f 2-)
 
 if [ "$AB_CVS_ROOT" != "" ] ; then
@@ -43,7 +45,20 @@
   svn co -q $AB_SVN
 
 elif [ "$AB_GIT" != "" ] ; then
-  git clone $AB_GIT
+   AB_GITTMP=(${AB_GIT//[\'\"]/})
+   AB_GITTMP[1]=`basename ${AB_GITTMP[0]%.git}`
+   if [ -e "${AB_GITTMP[1]}/.git" ] ; then
+    cd ${AB_GITTMP[1]}
+    echo "doing git checkout -- ."
+    git checkout -- .
+    cd ..
+   else
+    if [ ! -z "$AB_GIT_TAGORBRANCH" ] ; then
+      AB_GIT_TAGORBRANCH="-b $AB_GIT_TAGORBRANCH"
+    fi
+    echo "doing git clone $AB_GIT $AB_GIT_TAGORBRANCH"
+    git clone $AB_GIT $AB_GIT_TAGORBRANCH
+   fi
 
 elif [ "$AB_HG" != "" ] ; then
    AB_HGTMP=(${AB_HG//[\'\"]/})
@@ -55,8 +70,11 @@
     hg update -C
     cd ..
    else
-    echo "doing hg clone $AB_HG"
-  hg clone $AB_HG
+    if [ ! -z "$AB_HG_BRANCH" ] ; then
+      AB_HG_BRANCH="-r $AB_HG_BRANCH"
+    fi
+    echo "doing hg clone $AB_HG $AB_HG_BRANCH"
+    hg clone $AB_HG $AB_HG_BRANCH
    fi
 
 elif [ "$AB_URL" != "" ] ; then
@@ -87,7 +105,7 @@
   fi
 
 elif [ "$AB_NOREMOTE" == "yes" ] ; then
-  mkdir $AB_PACKAGE
+  mkdir -p $AB_PACKAGE
 
 else
   if [ "$AB_USEAPT" == "yes" ] && [ -x /usr/bin/apt-get ] ; then
Index: libraries/network/mbedtls/setvars
===================================================================
--- libraries/network/mbedtls/setvars	(revision 7220)
+++ libraries/network/mbedtls/setvars	(working copy)
@@ -1,5 +1,7 @@
 #AB_URL=https://tls.mbed.org/download/mbedtls-2.8.0-apache.tgz
 AB_GIT=https://github.com/ARMmbed/mbedtls.git
+# use master branch, not development
+AB_GIT_TAGORBRANCH=master
 AB_CATEGORY=Library
 AB_PACKAGE=mbedtls
 
@@ -29,8 +31,6 @@
 
 }
 
-# use master branch, not development
-git checkout master
 # extract version number from source code
 MB_TREE=.
 MB_VERSION=$(awk 'match($0, /\yMBEDTLS_VERSION_STRING\y/){print $3}' $MB_TREE/include/mbedtls/version.h)
_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

Reply via email to