Whamcloud - gitweb
LU-8797 lbuild: Fail build if zfs or spl git checkout fails 63/23563/2
authorNathaniel Clark <nathaniel.l.clark@intel.com>
Thu, 3 Nov 2016 14:56:15 +0000 (10:56 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 3 Jun 2017 03:57:46 +0000 (03:57 +0000)
This forces lbuild to fail if zfs or spl checkout fails, for instance
if the tag isn't present.  This turns a subtle "wrong zfs version
checked out" into a more obvious error.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Change-Id: I43b424a755c41cb32a7a07fa848c582bdf279e62
Reviewed-on: https://review.whamcloud.com/23563
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
contrib/lbuild/lbuild

index 3562c9c..395265e 100755 (executable)
@@ -1009,14 +1009,16 @@ build_spl_zfs() {
 
         # need to fetch the repo in order to build it.
         # default to github but allow override
-        git clone ${SPLZFSGITREPO:-"https://github.com/zfsonlinux"}/$pkg.git $pkg 2>&1
+       git clone -n ${SPLZFSGITREPO:-"https://github.com/zfsonlinux"}/$pkg.git $pkg 2>&1
 
-        pushd $pkg || return 255
-        if [ -n "$SPLZFSTAG" ]; then
-            git checkout $SPLZFSTAG
-        else
-            git checkout -b lbuild $pkg-$SPLZFSVER
-        fi
+       pushd $pkg || return 255
+       local tag
+       if [ -n "$SPLZFSTAG" ]; then
+           tag=$SPLZFSTAG
+       else
+           tag=$pkg-$SPLZFSVER
+       fi
+       git checkout -b lbuild $tag || fatal 1 "Failed to checkout \"$tag\" for $pkg.git"
 
         # This differentiates between older zfs versions
         if [ -f $pkg-modules.spec.in ]; then