From 14f5cf9c3d1d81997ec4fd8eacc05a721c8faa82 Mon Sep 17 00:00:00 2001 From: Nathaniel Clark Date: Thu, 3 Nov 2016 10:56:15 -0400 Subject: [PATCH] LU-8797 lbuild: Fail build if zfs or spl git checkout fails 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 Change-Id: I43b424a755c41cb32a7a07fa848c582bdf279e62 Reviewed-on: https://review.whamcloud.com/23563 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- contrib/lbuild/lbuild | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/contrib/lbuild/lbuild b/contrib/lbuild/lbuild index 3562c9c..395265e 100755 --- a/contrib/lbuild/lbuild +++ b/contrib/lbuild/lbuild @@ -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 -- 1.8.3.1