From: Nathaniel Clark Date: Tue, 25 Jul 2017 21:34:30 +0000 (-0400) Subject: LU-9745 dkms: Fix included dkms.conf file X-Git-Tag: 2.10.52~3 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=c99e8035ea543860f6db5e9919ff0045b56d1835 LU-9745 dkms: Fix included dkms.conf file When lustre-dkms is installed with other dkms packages, the PRE/POST scripts don't seem to function correctly. This includes the correct dkms.conf by default without having to recreate and reread it during build. Signed-off-by: Nathaniel Clark Change-Id: Ic6f25480db40d784dfcb3b650f7c869716b903ee Reviewed-on: https://review.whamcloud.com/28210 Tested-by: Jenkins Tested-by: Brian J. Murrell Tested-by: Maloo Reviewed-by: Minh Diep Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- diff --git a/config/lustre-build.m4 b/config/lustre-build.m4 index 6cb3300..747a987 100644 --- a/config/lustre-build.m4 +++ b/config/lustre-build.m4 @@ -395,8 +395,6 @@ AC_DEFUN([LB_CONFIG_FILES], [ lustre-iokit/ior-survey/Makefile lustre-iokit/stats-collect/Makefile ) - AC_CONFIG_FILES([lustre/scripts/dkms.mkconf], - [chmod +x lustre/scripts/dkms.mkconf]) ]) # diff --git a/lustre-dkms.spec.in b/lustre-dkms.spec.in index 09cfac1..7b0c115 100644 --- a/lustre-dkms.spec.in +++ b/lustre-dkms.spec.in @@ -9,11 +9,14 @@ %if %{_vendor}=="redhat" || %{_vendor}=="fedora" %global requires_kmod_name kmod-%{module} -%else #for Suse + %define mkconf_options +%else #for Suse / Ubuntu %global requires_kmod_name %{module}-kmp + %define mkconf_options "-k updates" %endif %define buildid 1 +%define mkconf lustre/scripts/dkms.mkconf Name: %{module}-dkms @@ -59,47 +62,7 @@ This package contains the dkms Lustre kernel modules. %setup -q -n @PACKAGE@-%{version} %build -cat << EOF > dkms.conf -# Embryonic lustre-dkms dkms.conf to allow for on-target accurate and full -# version re-create during first run of Lustre DKMS module build step. -PACKAGE_NAME=%{module} -PACKAGE_VERSION=%{version} -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" -EOF -%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 +%{mkconf} -n %{module} -v %{version} -f dkms.conf %{mkconf_options} %install if [ "$RPM_BUILD_ROOT" != "/" ]; then diff --git a/lustre-dkms_post-build.sh b/lustre-dkms_post-build.sh index bfff1a5..6ed20c7 100755 --- a/lustre-dkms_post-build.sh +++ b/lustre-dkms_post-build.sh @@ -21,30 +21,7 @@ # $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 - +cp -f "$7/$1/$2/build/config.log" "$7/$1/$2/$3/$5/log/config.log" 2>/dev/null +cp -f "$7/$1/$2/build/config.h" \ + "$7/$1/$2/build/Module.symvers" \ + "$7/$1/$2/$3/$5/" 2> /dev/null diff --git a/lustre-dkms_pre-build.sh b/lustre-dkms_pre-build.sh index c7b5a1c..f793238 100755 --- a/lustre-dkms_pre-build.sh +++ b/lustre-dkms_pre-build.sh @@ -72,8 +72,3 @@ 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 diff --git a/lustre/scripts/.gitignore b/lustre/scripts/.gitignore index e99d55f..a7fb05d 100644 --- a/lustre/scripts/.gitignore +++ b/lustre/scripts/.gitignore @@ -1,4 +1,3 @@ -/dkms.mkconf /lustre.spec /Makefile.in /version_tag.pl diff --git a/lustre/scripts/dkms.mkconf.in b/lustre/scripts/dkms.mkconf old mode 100644 new mode 100755 similarity index 67% rename from lustre/scripts/dkms.mkconf.in rename to lustre/scripts/dkms.mkconf index b7b3853..8ceeb33 --- a/lustre/scripts/dkms.mkconf.in +++ b/lustre/scripts/dkms.mkconf @@ -2,26 +2,22 @@ PROG=$0 -while getopts "n:v:f:" opt; do +kmoddir=extra + +while getopts "n:v:f:k:" opt; do case $opt in n) pkgname=$OPTARG ;; v) pkgver=$OPTARG ;; f) filename=$OPTARG ;; + k) kmoddir=$OPTARG ;; esac done if [ -z "${pkgname}" -o -z "${pkgver}" -o -z "${filename}" ]; then - echo "Usage: $PROG -n -v -f " + echo "Usage: $PROG -n -v [-k ] -f " exit 1 fi -rpm -qa | grep krb5-devel >/dev/null -if [ $? == 0 ] ; then - GSS="yes" -else - GSS="no" -fi - cat >${filename} <>${filename} <>${filename} <