Whamcloud - gitweb
Branch HEAD
authorrcorreia <rcorreia>
Mon, 18 May 2009 18:34:19 +0000 (18:34 +0000)
committerrcorreia <rcorreia>
Mon, 18 May 2009 18:34:19 +0000 (18:34 +0000)
b=17584
i=adilger
i=manoj.joseph

Git support for lustrecvs.
Do git checkout for SPL and ZFS trees on b_hd_kdmu.

build/buildcvs
lustrecvs

index 265a30c..805471b 100644 (file)
@@ -8,8 +8,11 @@ ldiskfstag="HEAD"
 ldiskfstag_head="b1_8_iam"
 lustreiokittag="HEAD"
 libcfstag="b1_x"
-dmutag=""
+dmutag="" # uDMU
+spltag=""
+zfstag=""
 hg_base_url="http://www.wizy.org/mercurial"
+git_base_url="git@git.lustre.org:%s.git"
 
 export LC_COLLATE=C
 
@@ -308,12 +311,21 @@ case "$lustretag" in
 
     # Branches that have been updated to include
     # the libcfs split should be added here
-    HEAD|b_head_capa|b_hd_cfld|b_hd_changelog|b_hd_sptlrpc|HD_SPTLRPC_BASE|b_som|b_hd_kdmu|b_hd_recov|b_hd_transapi)
+    HEAD|b_head_capa|b_hd_cfld|b_hd_changelog|b_hd_sptlrpc|HD_SPTLRPC_BASE|b_som|b_hd_recov|b_hd_transapi)
         lnettag="HEAD"
         ldiskfstag="$ldiskfstag_head"
         libcfstag="HEAD"
         ;;
 
+    b_hd_kdmu)
+        # Identical to HEAD + spl and zfs
+        lnettag="HEAD"
+        ldiskfstag="$ldiskfstag_head"
+        libcfstag="HEAD"
+        spltag="pre-alpha"
+        zfstag="top"
+        ;;
+
     b_head_libcfs)
         lnettag="b_head_libcfs"
         ldiskfstag="$ldiskfstag_head"
@@ -357,5 +369,7 @@ cvs_cmd ldiskfs ldiskfs "$ldiskfstag"
 cvs_cmd lustre-iokit lustre-iokit "$lustreiokittag"
 hg_cmd lustre/zfs-lustre "$hg_base_url" "$dmutag"
 cvs_cmd libcfs libcfs "$libcfstag"
+git_cmd spl spl "$spltag" "$git_base_url"
+git_cmd zfs zfs "$zfstag" "$git_base_url"
 
 [ -a ldiskfs/build ] || ln -sf ../build ldiskfs/build
index 948d4f1..86eb3cb 100755 (executable)
--- a/lustrecvs
+++ b/lustrecvs
@@ -191,6 +191,68 @@ EOF
     fi
 }
 
+git_cmd ()
+{
+    dir="$1"
+    repository="$2"
+    branch="$3"
+    base_url="$4"
+
+    if [ ! "$branch" ]; then
+        return
+    fi
+
+    if ! which git &> /dev/null; then
+    cat <<EOF
+
+Error: git is missing, try 'yum install git', 'apt-get install
+git' or try http://rpmfind.net/linux/rpm2html/search.php?query=git
+EOF
+        error_modules="$dir $error_modules"
+        return
+    fi
+
+    url=`printf "$base_url" "$repository"`
+
+    if [ -n "$pindate" ]; then
+        echo "\nSorry, pindate is not supported with git."
+        error_modules="$dir $error_modules"
+        return
+    fi
+
+    if [ -d "$dir" ]; then
+        echo "$progname: Updating $dir"
+
+        pushd "$dir" > /dev/null
+
+        # Fetch new objects
+        git fetch "$url" "$branch"
+
+        # Create branch if it doesn't exist already (e.g. we switched branches)
+        [ $? -eq 0 ] && $($(git branch -b $branch origin/$branch &> /dev/null) || true)
+
+        # Rebase local commits
+        [ $? -eq 0 ] && git rebase origin/$branch $branch
+
+        rc=$?
+
+        popd > /dev/null
+    else
+        echo "$progname: Checking out $dir"
+        git clone "$url" "$dir"
+        rc=$?
+
+        if [ $rc -eq 0 -a "$branch" != "master" ]; then
+            ( cd "$dir" && git checkout -b $branch origin/$branch )
+            rc=$?
+        fi
+    fi
+
+    if [ $rc -ne 0 ] ; then
+        error_modules="$dir $error_modules"
+    fi
+}
+
 cvs_cmd build lustre-build "$buildtag"
 
 if [ -f build/buildcvs ] ; then