From: thierry Date: Fri, 21 May 2010 21:00:41 +0000 (+0000) Subject: git+svn fetcher script X-Git-Tag: foo~149 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=d0c3e5869671dc024f810c7ed3719c768907997f;p=infrastructure.git git+svn fetcher script --- diff --git a/scripts/vbuild-nightly.sh b/scripts/vbuild-nightly.sh index aabceb9..36b1fe6 100755 --- a/scripts/vbuild-nightly.sh +++ b/scripts/vbuild-nightly.sh @@ -1,22 +1,37 @@ #!/bin/bash REVISION=$(echo '$Revision: 1053 $' | sed -e 's,\$,,g' -e 's,^\w*:\s,,' ) COMMAND=$(basename $0) -SVNPATH="http://svn.planet-lab.org/svn/build/trunk" +BUILD_SCM_URL="http://svn.planet-lab.org/svn/build/trunk" +USE_GIT="" -# scan args for any -s option, and SVNPATH in this case -function scan_svnpath () { +# scan args for any -s option, and set BUILD_SCM_URL in this case +function scan_build_scm_url () { while [[ -n "$@" ]] ; do if [ "$1" == "-s" ] ; then - SVNPATH="$2" + BUILD_SCM_URL="$2" fi shift done + + # is this a git url ? + echo $BUILD_SCM_URL | grep -q git && USE_GIT="true" + + if [ -n "$USE_GIT" ] ; then + GITREPO=$(echo $BUILD_SCM_URL | cut -d@ -f1) + GITTAG=$(echo $BUILD_SCM_URL | cut -s -d@ -f2) + GITTAG=${GITTAG:-master} + fi } -scan_svnpath "$@" +scan_build_scm_url "$@" tmp=/tmp/$COMMAND-$$ -svn cat $SVNPATH/$COMMAND > $tmp +if [ -n "$USE_GIT" ] ; then + git archive --remote=$GITREPO $GITTAG $COMMAND | tar -C /tmp -xf - + mv /tmp/$COMMAND $tmp +else + svn cat $BUILD_SCM_URL/$COMMAND > $tmp +fi chmod +x $tmp $tmp "$@" rm $tmp