Skip to content

Commit

Permalink
Skip SPL build in zimport.sh when applicable
Browse files Browse the repository at this point in the history
The Clone and Build steps for the SPL are not appropriate
for versions of ZFS with a merged SPL.

For a given ZFS tag being tested, if a corresponding SPL tag
is not found, do not attempt to build it nor refer to it
in the arguments to ./configure when building ZFS.
  • Loading branch information
ofaaland committed Aug 17, 2017
1 parent 47247df commit c4e4456
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions scripts/zimport.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ fail() {

#
# Set several helper variables which are derived from a source tag.
# SPL_DIR is only created with older versions where the SPL was
# in a separate repo, for which SPL_TAG exists.
#
# SPL_TAG - The tag zfs-x.y.z is translated to spl-x.y.z.
# SPL_DIR - The spl directory name.
Expand Down Expand Up @@ -391,18 +393,26 @@ for TAG in $SRC_TAGS; do
mkdir -p "$SRC_DIR_SPL"
fi

# For newer versions there is no corresponding SPL tag.
# In that case, report not found but do not fail.
# XXX the quotes below, introduced by cleanup, are wrong.
git archive --format=tar --prefix="$SPL_TAG/ $SPL_TAG" \
-o "$SRC_DIR_SPL/$SPL_TAG.tar" &>/dev/nul || \
-o "$SRC_DIR_SPL/$SPL_TAG.tar" &>/dev/null || \
rm "$SRC_DIR_SPL/$SPL_TAG.tar"
if [ -s "$SRC_DIR_SPL/$SPL_TAG.tar" ]; then
tar -xf "$SRC_DIR_SPL/$SPL_TAG.tar" -C "$SRC_DIR_SPL"
rm "$SRC_DIR_SPL/$SPL_TAG.tar"
echo -n -e "${COLOR_GREEN}Local${COLOR_RESET}\t\t"
else
status="${COLOR_GREEN}Remote"
mkdir -p "$SPL_DIR" || fail 1
curl -sL "$SPL_URL" | tar -xz -C "$SPL_DIR" \
--strip-components=1 || fail 2
echo -n -e "${COLOR_GREEN}Remote${COLOR_RESET}\t\t"
curl -sL "$SPL_URL" 2>/dev/null | tar -xz -C "$SPL_DIR" \
--strip-components=1 &>/dev/null
if [ $? -ne 0 ]; then
status="${COLOR_YELLOW}Not_Found"
rm -fr $SPL_DIR
fi
echo -n -e "${status}${COLOR_RESET}\t\t"
fi
fi
done
Expand Down Expand Up @@ -449,9 +459,11 @@ printf "%-16s" "Build SPL"
for TAG in $SRC_TAGS; do
src_set_vars "$TAG"

if [ -f "$SPL_DIR/module/spl/spl.ko" ]; then
if [ ! -d "$SPL_DIR" ]; then
skip_nonewline
elif [ "$SPL_TAG" = "installed" ]; then
elif [ -f "$SPL_DIR/module/spl/spl.ko" ]; then
skip_nonewline
elif [ "$SPL_TAG" = "installed" ]; then
skip_nonewline
else
cd "$SPL_DIR"
Expand All @@ -470,17 +482,21 @@ printf "\n"
printf "%-16s" "Build ZFS"
for TAG in $SRC_TAGS; do
src_set_vars "$TAG"
with_spl=""

if [ -f "$ZFS_DIR/module/zfs/zfs.ko" ]; then
skip_nonewline
elif [ "$ZFS_TAG" = "installed" ]; then
skip_nonewline
else
cd "$ZFS_DIR"
if [ -d $SPL_DIR ]; then
with_spl="--with-spl=$SPL_DIR"
fi
make distclean &>/dev/null
./autogen.sh >>"$CONFIG_LOG" 2>&1 || fail 1
# shellcheck disable=SC2086
./configure --with-spl="$SPL_DIR" $CONFIG_OPTIONS \
./configure ${with_spl} $CONFIG_OPTIONS \
>>"$CONFIG_LOG" 2>&1 || fail 2
# shellcheck disable=SC2086
make $MAKE_OPTIONS >>"$MAKE_LOG" 2>&1 || fail 3
Expand Down

0 comments on commit c4e4456

Please sign in to comment.