build/Rules.in \
build/gen_filelist.sh \
config.h.in \
- undef.h
+ undef.h \
+ lustre-dkms_pre-build.sh \
+ lustre-dkms_post-build.sh
rpm-local:
@(if test -z "$(RPMBUILD)"; then \
%build
cat << EOF > dkms.conf
# Embryonic lustre-dkms dkms.conf to allow for on-target accurate and full
-# version re-create during first dkms add stage.
+# version re-create during first run of Lustre DKMS module build step.
PACKAGE_NAME=%{module}
PACKAGE_VERSION=%{version}
-POST_ADD="lustre-dkms_post-add.sh \$module \$module_version \$kernelver \
+PACKAGE_CONFIG="/etc/sysconfig/lustre"
+PRE_BUILD="lustre-dkms_pre-build.sh \$module \$module_version \$kernelver \
+ \$kernel_source_dir \$arch \$source_tree \$dkms_tree"
+POST_BUILD="lustre-dkms_post-build.sh \$module \$module_version \$kernelver \
\$kernel_source_dir \$arch \$source_tree \$dkms_tree"
-# at least one DEST_MODULE_LOCATION[] element, along with an install
-# path made of either "extra" or "updates" subdir, are required during
-# dkms.conf validity check of "dkms add" step.
-DEST_MODULE_LOCATION[${#DEST_MODULE_LOCATION[@]}]="/extra/lnet/"
EOF
-
-cat << EOF > lustre-dkms_post-add.sh
-#!/bin/bash
-# \$1 : \$module
-# \$2 : \$module_version
-# \$3 : \$kernelver
-# \$4 : \$kernel_source_dir
-# \$5 : \$arch
-# \$6 : \$source_tree
-# \$7 : \$dkms_tree
-
-if [ \$1 = "lustre-client" ] ; then
- SERVER="--disable-server"
-else
- SPL_VERSION=\$(dkms status -m spl -k \$3/\$5 | awk -F', ' '{print \$2; exit 0}' | sed 's/: added\$//')
- ZFS_VERSION=\$(dkms status -m zfs -k \$3/\$5 | awk -F', ' '{print \$2; exit 0}' | sed 's/: added\$//')
-
- SERVER="--enable-server --disable-ldiskfs --with-linux=\$4 --with-linux-obj=\$4 \\
- --with-spl=\$6/spl-\${SPL_VERSION} \\
- --with-spl-obj=\$7/spl/\${SPL_VERSION}/\$3/\$5 \\
- --with-zfs=\$6/zfs-\${ZFS_VERSION} \\
- --with-zfs-obj=\$7/zfs/\${ZFS_VERSION}/\$3/\$5"
-fi
-
-rpm -qa | grep krb5-devel >/dev/null
-if [ \$? == 0 ] ; then
- GSS="--enable-gss"
-else
- GSS="--disable-gss"
-fi
-
-# run a configure pass to clean "--enable-dist" only effect and also to
-# ensure local/on-target environment to be taken into account
-./configure --enable-modules --disable-iokit --disable-snmp --disable-doc \\
- --disable-utils --disable-tests --disable-maintainer-mode \\
- \$GSS \$SERVER \\
- --disable-manpages --disable-dlc
-# re-create dkms.conf based on this
-lustre/scripts/dkms.mkconf -n \$1 -v \$2 -f ./dkms.conf
+%if %{with servers}
+cat << EOF >> dkms.conf
+BUILD_DEPENDS[0]="zfs"
+EOF
+%endif
+cat << EOF >> dkms.conf
+AUTOINSTALL="yes"
+REMAKE_INITRD="no"
+MAKE[0]="make"
+# just have to set STRIP[0], it will become the new default.
+STRIP[0]="\$(
+ [[ -r \${PACKAGE_CONFIG} ]] \\
+ && source \${PACKAGE_CONFIG} \\
+ && shopt -q -s extglob \\
+ && [[ \${LUSTRE_DKMS_DISABLE_STRIP,,} == @(y|yes) ]] \\
+ && echo -n no
+)"
+
+# at least one module's set of BUILT_MODULE_NAME[]/BUILT_MODULE_LOCATION[]
+# elements, along with an install path made of either "extra" or "updates"
+# subdir in its DEST_MODULE_LOCATION[] element, are required to fake during
+# dkms.conf validity checks of "dkms [add,build]" steps.
+# Final/full correct BUILT_MODULE_NAME[]/BUILT_MODULE_LOCATION[]/
+# DEST_MODULE_LOCATION[] sets of values for all modules will be fixed during
+# on-target post-configure run of dkms.mkconf as part of build step.
+# it must be for a module shared by both lustre[-client]-dkms packages.
+BUILT_MODULE_NAME[\${#BUILT_MODULE_NAME[@]}]="lustre"
+BUILT_MODULE_LOCATION[\${#BUILT_MODULE_LOCATION[@]}]="lustre/llite/"
+DEST_MODULE_LOCATION[\${#DEST_MODULE_LOCATION[@]}]="/extra/lustre/"
EOF
-
-chmod 755 lustre-dkms_post-add.sh
sed -i 's/BUILDID[[:print:]]*/BUILDID = %{buildid}/' META
sed -i 's/PRISTINE[[:print:]]*/PRISTINE = 1/' META
exit 0
%changelog
+* Sat Jan 23 2016 Bruno Faccini <bruno.faccini@intel.com>
+ - detect and handle cases where [spl,zfs]-dkms packages are not built
+ - also handle on-target configure issues
* Wed Oct 7 2015 Bruno Faccini <bruno.faccini@intel.com>
- adapted for Lustre Client DKMS creation
- allow for on-target reconfig to prevent static deps requires
--- /dev/null
+#!/bin/bash
+# $1 : $module
+# $2 : $module_version
+# $3 : $kernelver
+# $4 : $kernel_source_dir
+# $5 : $arch
+# $6 : $source_tree
+# $7 : $dkms_tree
+#
+# This script ensure that ALL Lustre kernel modules that have been built
+# during DKMS build step of lustre[-client]-dkms module will be moved in
+# DKMS vault/repository, and this before the build directory content will be
+# trashed.
+# This is required because dkms.conf file is only sourced at the very
+# beginning of the DKMS build step when its content has to be on-target
+# customized during pre_build script. This can lead to incomplete list
+# of built Lustre kernel modules then to be saved for next DKMS install step.
+
+# Use this place to also save config.log that has been generated during
+# pre_build.
+# $7/$1/$2/$3/$5/log repository should have already been created to save
+# make.log and $kernel_config
+mkdir -p "$7/$1/$2/$3/$5/log"
+mv -f "$7/$1/$2/build/config.log" "$7/$1/$2/$3/$5/log/config.log" 2>/dev/null
+
+# read last dkms.conf version that has just been customized during pre_build
+source $6/$1-$2/dkms.conf
+
+# Make sure all the modules built successfully
+for ((count=0; count < ${#BUILT_MODULE_NAME[@]}; count++)); do
+ # Lustre supported kernels are >= 2.5, so don't need to check for old .o
+ # module suffix
+ [[ -e ${BUILT_MODULE_LOCATION[$count]}${BUILT_MODULE_NAME[$count]}.ko ]] && continue
+ echo "Build of ${BUILT_MODULE_NAME[$count]}.ko failed for: $3 ($5)" \
+ "Consult logs in $7/$1/$2/$3/$5/log/ for more information."
+done
+
+# Strip modules ?
+for ((count=0; count < ${#BUILT_MODULE_NAME[@]}; count++)); do
+ [[ ${STRIP[$count]} = '' ]] && STRIP[$count]=${STRIP[0]:-yes}
+ [[ ${STRIP[$count]} != no ]] && strip -g "$7/$1/$2/build/${BUILT_MODULE_LOCATION[$count]}${BUILT_MODULE_NAME[$count]}.ko"
+
+ # Save a copy of the new module in save area that should have been created in previous build steps
+ mkdir -p "$7/$1/$2/$3/$5/module" >/dev/null
+ # if DEST_MODULE_NAME[] is different than BUILD_MODULE_NAME[], need to use it as the module name in save area
+ # this is not presently the case for none of the Lustre kernel modules.
+ cp -f "$7/$1/$2/build/${BUILT_MODULE_LOCATION[$count]}${BUILT_MODULE_NAME[$count]}.ko" \
+ "$7/$1/$2/$3/$5/module/${BUILT_MODULE_NAME[$count]}.ko" >/dev/null
+done
+
--- /dev/null
+#!/bin/bash
+# $1 : $module
+# $2 : $module_version
+# $3 : $kernelver
+# $4 : $kernel_source_dir
+# $5 : $arch
+# $6 : $source_tree
+# $7 : $dkms_tree
+
+if [ $1 = "lustre-client" ] ; then
+ SERVER="--disable-server"
+ KERNEL_STUFF=""
+else
+ SPL_VERSION=$(dkms status -m spl -k $3 -a $5 | awk -F', ' '{print $2; exit 0}' | grep -v ': added$')
+ if [ -z $SPL_VERSION ] ; then
+ echo "spl-dkms package must already be installed and built under DKMS control"
+ exit 1
+ fi
+ ZFS_VERSION=$(dkms status -m zfs -k $3 -a $5 | awk -F', ' '{print $2; exit 0}' | grep -v ': added$')
+ if [ -z $ZFS_VERSION ] ; then
+ echo "zfs-dkms package must already be installed and built under DKMS control"
+ exit 1
+ fi
+
+ SERVER="--enable-server --disable-ldiskfs --with-linux=$4 --with-linux-obj=$4 \
+ --with-spl=$6/spl-${SPL_VERSION} \
+ --with-spl-obj=$7/spl/${SPL_VERSION}/$3/$5 \
+ --with-zfs=$6/zfs-${ZFS_VERSION} \
+ --with-zfs-obj=$7/zfs/${ZFS_VERSION}/$3/$5"
+
+ KERNEL_STUFF="--with-linux=$4 --with-linux-obj=$4"
+fi
+
+PACKAGE_CONFIG="/etc/sysconfig/lustre"
+DKMS_CONFIG_OPTS=$(
+ [[ -r ${PACKAGE_CONFIG} ]] \
+ && source ${PACKAGE_CONFIG} \
+ && shopt -q -s extglob \
+ && \
+ {
+ if [[ ${LUSTRE_DKMS_DISABLE_CDEBUG,,} == @(y|yes) ]]
+ then
+ echo --disable-libcfs-cdebug
+ fi
+ if [[ ${LUSTRE_DKMS_DISABLE_TRACE,,} == @(y|yes) ]]
+ then
+ echo --disable-libcfs-trace
+ fi
+ if [[ ${LUSTRE_DKMS_DISABLE_ASSERT,,} == @(y|yes) ]]
+ then
+ echo --disable-libcfs-assert
+ fi
+ }
+ )
+
+rpm -qa | grep krb5-devel >/dev/null
+if [ $? == 0 ] ; then
+ GSS="--enable-gss"
+else
+ GSS="--disable-gss"
+fi
+
+# run a configure pass to clean "--enable-dist" only effect and also to
+# ensure local/on-target environment to be taken into account for
+# dkms.mkconf script customizations and before next build/MAKE step
+./configure --prefix=/usr --enable-modules --disable-iokit --disable-snmp \
+ --disable-doc --disable-utils --disable-tests --disable-maintainer-mode \
+ $KERNEL_STUFF $GSS $SERVER $DKMS_CONFIG_OPTS \
+ --disable-manpages --disable-dlc
+
+if [ $? != 0 ] ; then
+ echo "configure error, check $7/$1/$2/build/config.log"
+ exit 1
+fi
+
+# now re-create dkms.conf based on configure result, to set accurate Lustre
+# modules names that will be built and their future install locations, for
+# next DKMS module install step
+lustre/scripts/dkms.mkconf -n $1 -v $2 -f $6/$1-$2/dkms.conf
PROG=$0
-pkgcfg=/etc/sysconfig/lustre
-
-while getopts "n:v:c:f:" opt; do
+while getopts "n:v:f:" opt; do
case $opt in
n) pkgname=$OPTARG ;;
v) pkgver=$OPTARG ;;
- c) pkgcfg=$OPTARG ;;
f) filename=$OPTARG ;;
esac
done
if [ -z "${pkgname}" -o -z "${pkgver}" -o -z "${filename}" ]; then
- echo "Usage: $PROG -n <pkgname> -v <pkgver> -c <pkgcfg> -f <filename>"
+ echo "Usage: $PROG -n <pkgname> -v <pkgver> -f <filename>"
exit 1
fi
rpm -qa | grep krb5-devel >/dev/null
if [ $? == 0 ] ; then
- GSS="--enable-gss"
+ GSS="yes"
else
- GSS="--disable-gss"
+ GSS="no"
fi
cat >${filename} <<EOF
PACKAGE_NAME="${pkgname}"
PACKAGE_VERSION="${pkgver}"
-PACKAGE_CONFIG="${pkgcfg}"
-EOF
-if [ $pkgname = "lustre" ] ; then
- cat >>${filename} <<EOF
-SPL_VERSION=\$(dkms status -m spl -k \${kernelver}/\${arch} | awk -F', ' '{print \$2; exit 0}' | sed 's/: added\$//')
-ZFS_VERSION=\$(dkms status -m zfs -k \${kernelver}/\${arch} | awk -F', ' '{print \$2; exit 0}' | sed 's/: added\$//')
-EOF
-fi
-cat >>${filename} <<EOF
-# allow to re-evaluate krb5-devel presence during dkms re-adds and to re-create dkms.conf
-# accordingly!
-POST_ADD="lustre-dkms_post-add.sh \$module \$module_version \$kernelver \$kernel_source_dir \
+PACKAGE_CONFIG="/etc/sysconfig/lustre"
+# re-evaluate/create dkms.conf on-target based on local build-time products/dependencies
+# (like krb5-devel presence) and also upon configure results/errors before dkms builds
+PRE_BUILD="lustre-dkms_pre-build.sh \$module \$module_version \$kernelver \$kernel_source_dir \
+ \$arch \$source_tree \$dkms_tree"
+# to ensure all just built Lustre kernel modules will be saved for further install
+POST_BUILD="lustre-dkms_post-build.sh \$module \$module_version \$kernelver \$kernel_source_dir \
\$arch \$source_tree \$dkms_tree"
-PRE_BUILD="configure
- --prefix=/usr
- --with-linux=\${kernel_source_dir}
- --with-linux-obj=\${kernel_source_dir}
- --enable-modules
-EOF
-if [ $pkgname = "lustre-client" ] ; then
- cat >>${filename} <<EOF
- --disable-server
-EOF
-else
- cat >>${filename} <<EOF
- --enable-server
- --with-spl=\${source_tree}/spl-\${SPL_VERSION}
- --with-spl-obj=\${dkms_tree}/spl/\${SPL_VERSION}/\${kernelver}/\${arch}
- --with-zfs=\${source_tree}/zfs-\${ZFS_VERSION}
- --with-zfs-obj=\${dkms_tree}/zfs/\${ZFS_VERSION}/\${kernelver}/\${arch}
- --disable-ldiskfs
-EOF
-fi
-cat >>${filename} <<EOF
- --disable-iokit
- --disable-snmp
- --disable-doc
- --disable-utils
- $GSS
- --disable-tests
- --disable-maintainer-mode
- --disable-manpages
- --disable-dlc
- \$(
- [[ -r \${PACKAGE_CONFIG} ]] \\
- && source \${PACKAGE_CONFIG} \\
- && shopt -q -s extglob \\
- && \\
- {
- if [[ \${LUSTRE_DKMS_DISABLE_CDEBUG,,} == @(y|yes) ]]
- then
- echo --disable-libcfs-cdebug
- fi
- if [[ \${LUSTRE_DKMS_DISABLE_TRACE,,} == @(y|yes) ]]
- then
- echo --disable-libcfs-trace
- fi
- if [[ \${LUSTRE_DKMS_DISABLE_ASSERT,,} == @(y|yes) ]]
- then
- echo --disable-libcfs-assert
- fi
- }
- )
-"
EOF
if [ $pkgname = "lustre" ] ; then
cat >>${filename} <<EOF
BUILT_MODULE_LOCATION[\${#BUILT_MODULE_LOCATION[@]}]="lustre/llite/"
DEST_MODULE_LOCATION[\${#DEST_MODULE_LOCATION[@]}]="/@KMP_MODDIR@/lustre/"
EOF
-if [ $GSS = "--enable-gss" ] ; then
+if [ $GSS = "yes" ] ; then
cat >>${filename} <<EOF
BUILT_MODULE_NAME[\${#BUILT_MODULE_NAME[@]}]="ptlrpc_gss"
BUILT_MODULE_LOCATION[\${#BUILT_MODULE_LOCATION[@]}]="lustre/ptlrpc/gss/"