]> xenbits.xensource.com Git - people/gdunlap/raisin.git/.git/commitdiff
Port git-checkout to be a function in the common lib out/librarify/rfc-v1
authorGeorge Dunlap <george.dunlap@eu.citrix.com>
Wed, 1 Apr 2015 19:09:48 +0000 (20:09 +0100)
committerGeorge Dunlap <george.dunlap@eu.citrix.com>
Wed, 1 Apr 2015 20:03:35 +0000 (21:03 +0100)
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
components/grub
components/libvirt
components/xen
git-checkout.sh [deleted file]
lib/git-checkout.sh [new file with mode: 0755]
raise

index 6471540f088604f538fda749cc2aa71e29a5f5a1..29a80f5fca2f27969bfd1b62ce7d88423731f029 100644 (file)
@@ -29,7 +29,7 @@ function grub_build() {
     cd "$BASEDIR"
     rm -f memdisk.tar
     tar cf memdisk.tar -C data grub.cfg
-    ./git-checkout.sh $GRUB_UPSTREAM_URL $GRUB_UPSTREAM_REVISION grub-dir
+    git-checkout $GRUB_UPSTREAM_URL $GRUB_UPSTREAM_REVISION grub-dir
     cd grub-dir
     ./autogen.sh
     ## GRUB32
index c8306d52e59bb3706173898365da99a0ccd03eee..e93f9cbad964ca34c5ce69c89714a7f4526dcdf6 100644 (file)
@@ -26,7 +26,7 @@ function libvirt_build() {
     libvirt_install_dependencies
 
     cd "$BASEDIR"
-    ./git-checkout.sh $LIBVIRT_UPSTREAM_URL $LIBVIRT_UPSTREAM_REVISION libvirt-dir
+    git-checkout $LIBVIRT_UPSTREAM_URL $LIBVIRT_UPSTREAM_REVISION libvirt-dir
     cd libvirt-dir
     CFLAGS="-I$INST_DIR/$PREFIX/include" \
     LDFLAGS="-L$INST_DIR/$PREFIX/lib -Wl,-rpath-link=$INST_DIR/$PREFIX/lib" \
index bfe9980d910693f8fee21c276bb89105a5dff26e..d2697a78be87768d3400e14a511acf4d1ffbc61f 100644 (file)
@@ -23,7 +23,7 @@ function xen_build() {
     xen_install_dependencies
 
     cd "$BASEDIR"
-    ./git-checkout.sh $XEN_UPSTREAM_URL $XEN_UPSTREAM_REVISION xen-dir
+    git-checkout $XEN_UPSTREAM_URL $XEN_UPSTREAM_REVISION xen-dir
     cd xen-dir
     ./configure --prefix=$PREFIX
     $MAKE
diff --git a/git-checkout.sh b/git-checkout.sh
deleted file mode 100755 (executable)
index 20ae31f..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-if test $# -lt 3; then
-       echo "Usage: $0 <tree> <tag> <dir>"
-       exit 1
-fi
-
-TREE=$1
-TAG=$2
-DIR=$3
-
-set -e
-
-if test \! -d $DIR-remote; then
-       rm -rf $DIR-remote $DIR-remote.tmp
-       mkdir -p $DIR-remote.tmp; rmdir $DIR-remote.tmp
-       $GIT clone $TREE $DIR-remote.tmp
-       if test "$TAG" ; then
-               cd $DIR-remote.tmp
-               $GIT branch -D dummy >/dev/null 2>&1 ||:
-               $GIT checkout -b dummy $TAG
-               cd ..
-       fi
-       mv $DIR-remote.tmp $DIR-remote
-fi
-rm -f $DIR
-ln -sf $DIR-remote $DIR
diff --git a/lib/git-checkout.sh b/lib/git-checkout.sh
new file mode 100755 (executable)
index 0000000..f555abd
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+function git-checkout() {
+    if test $# -lt 3; then
+       echo "Usage: $0 <tree> <tag> <dir>"
+       exit 1
+    fi
+
+    TREE=$1
+    TAG=$2
+    DIR=$3
+
+    set -e
+
+    if test \! -d $DIR-remote; then
+       rm -rf $DIR-remote $DIR-remote.tmp
+       mkdir -p $DIR-remote.tmp; rmdir $DIR-remote.tmp
+       $GIT clone $TREE $DIR-remote.tmp
+       if test "$TAG" ; then
+           cd $DIR-remote.tmp
+           $GIT branch -D dummy >/dev/null 2>&1 ||:
+           $GIT checkout -b dummy $TAG
+           cd ..
+       fi
+       mv $DIR-remote.tmp $DIR-remote
+    fi
+    rm -f $DIR
+    ln -sf $DIR-remote $DIR
+}
diff --git a/raise b/raise
index 27c51d9ec850509b8f349a9b78a51b2f6f99cd27..57bda95cc41ca2b0e7603fac0e558767787ebe4d 100755 (executable)
--- a/raise
+++ b/raise
@@ -12,6 +12,7 @@ fi
 . ${RAISIN_PATH}/core.sh
 . ${RAISIN_PATH}/common-functions.sh
 . ${RAISIN_PATH}/build.sh
+. ${RAISIN_PATH}/git-checkout.sh
 
 # And do your own thing rather than running commands
 # I suggest defining a "main" function of your own and running it like this.