Whamcloud - gitweb
LU-1032 build: Add Lustre DKMS spec file 19/6019/5
authorBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 9 Apr 2013 04:46:40 +0000 (21:46 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 10 Feb 2014 15:42:10 +0000 (15:42 +0000)
Add a lustre-dkms.spec file which can be used to distribute dkms
style Lustre modules.  The spec file is originally based on the
generic dkms template and the default behavior is as follows:

* Disable ldiskfs osd support.  The ldiskfs packages currently
  cannot be built reliably against arbitrary kernels and are
  therefore disabled by default.

* Enable zfs osd support.  ZFS dkms packages are hosted at
  http://archive.zfsonlinux.org/{epel,fedora}/{release}/ and
  are compatible once LU-3117 is merged in to the Lustre source.

* Some of the default Lustre build options can be changed by
  setting parameted in the /etc/sysconfig/lustre config file.
  Going forward the options can be extended as needed.  The
  currently supported options are:

    * LUSTRE_DKMS_DISABLE_CDEBUG=y|N
    * LUSTRE_DKMS_DISABLE_TRACE=y|N
    * LUSTRE_DKMS_DISABLE_ASSERT=y|N
    * LUSTRE_DKMS_DISABLE_STRIP=y|N

* A build target was not added for the lustre-dkms.spec file.
  To create lustre dkms packages you must manually invoke rpmbuild.

    ./configure --enable-dist
    make dist
    rpmbuild -bs lustre-dkms.spec lustre-x.y.z.tar.gz
    rpmbuild --rebuild lustre-dkms-x.y.z-r.dist.src.rpm

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: I870f362b8948d5cd28a8dccd98b565e38ad2da7c
Reviewed-on: http://review.whamcloud.com/6019
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Brian J. Murrell <brian.murrell@intel.com>
.gitignore
config/lustre-build.m4
lustre-dkms.spec.in [new file with mode: 0644]
lustre/scripts/Makefile.am
lustre/scripts/dkms.mkconf [new file with mode: 0755]

index d43a74f..7016003 100644 (file)
@@ -68,6 +68,7 @@ TAGS
 /config.h.in
 /INSTALL
 /lustre.spec
+/lustre-dkms.spec
 /lustre*.tar.gz
 /mkinstalldirs
 /Module.markers
index d5d9220..30f9c5c 100644 (file)
@@ -564,6 +564,7 @@ AC_DEFUN([LB_CONFIG_FILES],
                config/Makefile
                [Rules:build/Rules.in]
                AC_PACKAGE_TARNAME[.spec]
+               AC_PACKAGE_TARNAME[-dkms.spec]
                contrib/Makefile
                contrib/lbuild/Makefile
                contrib/scripts/Makefile
diff --git a/lustre-dkms.spec.in b/lustre-dkms.spec.in
new file mode 100644 (file)
index 0000000..e2dbde4
--- /dev/null
@@ -0,0 +1,74 @@
+%define module  @PACKAGE@
+%define buildid 1
+%define mkconf  lustre/scripts/dkms.mkconf
+
+Name:           %{module}-dkms
+
+Version:        @VERSION@
+Release:        %{buildid}%{?dist}
+Summary:        Kernel module(s) (dkms)
+
+Group:          System Environment/Kernel
+License:        GPLv2+
+URL:            http://lustre.opensfs.org/
+Source0:        %{module}-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch:      noarch
+
+Requires:       dkms >= 2.2.0.2
+Requires:       spl-dkms >= 0.6.1
+Requires:       zfs-dkms >= 0.6.1
+Requires:       gcc, make, perl
+Requires:       kernel-devel
+Provides:       %{module}-kmod = %{version}
+Provides:       %{module}-modules = %{version}
+
+%description
+This package contains the dkms Lustre kernel modules.
+
+%prep
+%setup -q -n %{module}-%{version}
+
+%build
+%{mkconf} -n %{module} -v %{version} -f dkms.conf
+sed -i 's/BUILDID[[:print:]]*/BUILDID = %{buildid}/' META
+sed -i 's/PRISTINE[[:print:]]*/PRISTINE = 1/' META
+cp META ldiskfs/META
+
+%install
+if [ "$RPM_BUILD_ROOT" != "/" ]; then
+    rm -rf $RPM_BUILD_ROOT
+fi
+mkdir -p $RPM_BUILD_ROOT/usr/src/
+cp -rfp ${RPM_BUILD_DIR}/%{module}-%{version} $RPM_BUILD_ROOT/usr/src/
+
+%clean
+if [ "$RPM_BUILD_ROOT" != "/" ]; then
+    rm -rf $RPM_BUILD_ROOT
+fi
+
+%files
+%defattr(-,root,root)
+/usr/src/%{module}-%{version}
+
+%post
+for POSTINST in /usr/lib/dkms/common.postinst; do
+    if [ -f $POSTINST ]; then
+        $POSTINST %{module} %{version}
+        exit $?
+    fi
+    echo "WARNING: $POSTINST does not exist."
+done
+echo -e "ERROR: DKMS version is too old and %{module} was not"
+echo -e "built with legacy DKMS support."
+echo -e "You must either rebuild %{module} with legacy postinst"
+echo -e "support or upgrade DKMS to a more current version."
+exit 1
+
+%preun
+dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade
+exit 0
+
+%changelog
+* Fri Apr  8 2013 Brian Behlendorf <behlendorf1@llnl.gov> - 2.3.63-1
+- First DKMS packages.
index 9269050..7aa30d0 100644 (file)
@@ -54,7 +54,7 @@ EXTRA_DIST = license-status version_tag.pl version_tag-git.pl \
             version_tag-none.pl lc_common \
             $(addsuffix .in,$(genscripts)) lc_mon $(sbinscripts) \
             $(bin_SCRIPTS) lustre lnet lhbadm \
-            haconfig ldev Lustre.ha_v2
+            haconfig ldev Lustre.ha_v2 dkms.mkconf
 
 scriptlibdir = @libexecdir@/@PACKAGE@
 scriptlib_SCRIPTS = haconfig
diff --git a/lustre/scripts/dkms.mkconf b/lustre/scripts/dkms.mkconf
new file mode 100755 (executable)
index 0000000..4795d16
--- /dev/null
@@ -0,0 +1,190 @@
+#!/bin/sh
+
+PROG=$0
+
+pkgcfg=/etc/sysconfig/lustre
+
+while getopts "n:v:c: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>"
+       exit 1
+fi
+
+cat >${filename} <<EOF
+PACKAGE_NAME="${pkgname}"
+PACKAGE_VERSION="${pkgver}"
+PACKAGE_CONFIG="${pkgcfg}"
+SPL_VERSION=\$(dkms status -m spl | awk -F', ' '{print \$2; exit 0}')
+ZFS_VERSION=\$(dkms status -m zfs | awk -F', ' '{print \$2; exit 0}')
+PRE_BUILD="configure
+  --prefix=/usr
+  --with-linux=\${kernel_source_dir}
+  --with-linux-obj=\${kernel_source_dir}
+  --with-spl=\${dkms_tree}/spl/\${SPL_VERSION}/build
+  --with-spl-obj=\${dkms_tree}/spl/\${SPL_VERSION}/\${kernelver}/\${arch}
+  --with-zfs=\${dkms_tree}/zfs/\${ZFS_VERSION}/build
+  --with-zfs-obj=\${dkms_tree}/zfs/\${ZFS_VERSION}/\${kernelver}/\${arch}
+  --without-ldiskfs
+  --without-sysio
+  --without-lustre-iokit
+  --disable-snmp
+  --disable-doc
+  --disable-utils
+  --disable-tests
+  --disable-maintainer-mode
+  \$(
+    [[ -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
+    }
+  )
+"
+BUILD_DEPENDS[0]="zfs"
+AUTOINSTALL="yes"
+REMAKE_INITRD="no"
+MAKE[0]="make"
+STRIP[0]="\$(
+  [[ -r \${PACKAGE_CONFIG} ]] \\
+  && source \${PACKAGE_CONFIG} \\
+  && shopt -q -s extglob \\
+  && [[ \${LUSTRE_DKMS_DISABLE_STRIP,,} == @(y|yes) ]] \\
+  && echo -n no
+)"
+STRIP[1]="\${STRIP[0]}"
+STRIP[2]="\${STRIP[0]}"
+STRIP[3]="\${STRIP[0]}"
+STRIP[4]="\${STRIP[0]}"
+STRIP[5]="\${STRIP[0]}"
+STRIP[6]="\${STRIP[0]}"
+STRIP[7]="\${STRIP[0]}"
+STRIP[8]="\${STRIP[0]}"
+STRIP[9]="\${STRIP[0]}"
+STRIP[10]="\${STRIP[0]}"
+STRIP[11]="\${STRIP[0]}"
+STRIP[12]="\${STRIP[0]}"
+STRIP[13]="\${STRIP[0]}"
+STRIP[14]="\${STRIP[0]}"
+STRIP[15]="\${STRIP[0]}"
+STRIP[16]="\${STRIP[0]}"
+STRIP[17]="\${STRIP[0]}"
+STRIP[18]="\${STRIP[0]}"
+STRIP[19]="\${STRIP[0]}"
+STRIP[20]="\${STRIP[0]}"
+STRIP[21]="\${STRIP[0]}"
+STRIP[22]="\${STRIP[0]}"
+STRIP[23]="\${STRIP[0]}"
+STRIP[24]="\${STRIP[0]}"
+STRIP[25]="\${STRIP[0]}"
+STRIP[26]="\${STRIP[0]}"
+STRIP[27]="\${STRIP[0]}"
+STRIP[28]="\${STRIP[0]}"
+BUILT_MODULE_NAME[0]="lnet_selftest"
+BUILT_MODULE_LOCATION[0]="lnet/selftest/"
+DEST_MODULE_LOCATION[0]="/extra/lnet/"
+BUILT_MODULE_NAME[1]="lnet"
+BUILT_MODULE_LOCATION[1]="lnet/lnet/"
+DEST_MODULE_LOCATION[1]="/extra/lnet/"
+BUILT_MODULE_NAME[2]="ksocklnd"
+BUILT_MODULE_LOCATION[2]="lnet/klnds/socklnd/"
+DEST_MODULE_LOCATION[2]="/extra/lnet/"
+BUILT_MODULE_NAME[3]="ko2iblnd"
+BUILT_MODULE_LOCATION[3]="lnet/klnds/o2iblnd/"
+DEST_MODULE_LOCATION[3]="/extra/lnet/"
+BUILT_MODULE_NAME[4]="libcfs"
+BUILT_MODULE_LOCATION[4]="libcfs/libcfs/"
+DEST_MODULE_LOCATION[4]="/extra/lustre/"
+BUILT_MODULE_NAME[5]="ptlrpc"
+BUILT_MODULE_LOCATION[5]="lustre/ptlrpc/"
+DEST_MODULE_LOCATION[5]="/extra/lustre/"
+BUILT_MODULE_NAME[6]="lvfs"
+BUILT_MODULE_LOCATION[6]="lustre/lvfs/"
+DEST_MODULE_LOCATION[6]="/extra/lustre/"
+BUILT_MODULE_NAME[7]="lov"
+BUILT_MODULE_LOCATION[7]="lustre/lov/"
+DEST_MODULE_LOCATION[7]="/extra/lustre/"
+BUILT_MODULE_NAME[8]="osd_zfs"
+BUILT_MODULE_LOCATION[8]="lustre/osd-zfs/"
+DEST_MODULE_LOCATION[8]="/extra/lustre/"
+BUILT_MODULE_NAME[9]="fld"
+BUILT_MODULE_LOCATION[9]="lustre/fld/"
+DEST_MODULE_LOCATION[9]="/extra/lustre/"
+BUILT_MODULE_NAME[10]="obdecho"
+BUILT_MODULE_LOCATION[10]="lustre/obdecho/"
+DEST_MODULE_LOCATION[10]="/extra/lustre/"
+BUILT_MODULE_NAME[11]="mgs"
+BUILT_MODULE_LOCATION[11]="lustre/mgs/"
+DEST_MODULE_LOCATION[11]="/extra/lustre/"
+BUILT_MODULE_NAME[12]="osc"
+BUILT_MODULE_LOCATION[12]="lustre/osc/"
+DEST_MODULE_LOCATION[12]="/extra/lustre/"
+BUILT_MODULE_NAME[13]="lquota"
+BUILT_MODULE_LOCATION[13]="lustre/quota/"
+DEST_MODULE_LOCATION[13]="/extra/lustre/"
+BUILT_MODULE_NAME[14]="mgc"
+BUILT_MODULE_LOCATION[14]="lustre/mgc/"
+DEST_MODULE_LOCATION[14]="/extra/lustre/"
+BUILT_MODULE_NAME[15]="mdt"
+BUILT_MODULE_LOCATION[15]="lustre/mdt/"
+DEST_MODULE_LOCATION[15]="/extra/lustre/"
+BUILT_MODULE_NAME[16]="osp"
+BUILT_MODULE_LOCATION[16]="lustre/osp/"
+DEST_MODULE_LOCATION[16]="/extra/lustre/"
+BUILT_MODULE_NAME[17]="mdd"
+BUILT_MODULE_LOCATION[17]="lustre/mdd/"
+DEST_MODULE_LOCATION[17]="/extra/lustre/"
+BUILT_MODULE_NAME[18]="lustre"
+BUILT_MODULE_LOCATION[18]="lustre/llite/"
+DEST_MODULE_LOCATION[18]="/extra/lustre/"
+BUILT_MODULE_NAME[19]="llite_lloop"
+BUILT_MODULE_LOCATION[19]="lustre/llite/"
+DEST_MODULE_LOCATION[19]="/extra/lustre/"
+BUILT_MODULE_NAME[20]="fid"
+BUILT_MODULE_LOCATION[20]="lustre/fid/"
+DEST_MODULE_LOCATION[20]="/extra/lustre/"
+BUILT_MODULE_NAME[21]="mdc"
+BUILT_MODULE_LOCATION[21]="lustre/mdc/"
+DEST_MODULE_LOCATION[21]="/extra/lustre/"
+BUILT_MODULE_NAME[22]="obdclass"
+BUILT_MODULE_LOCATION[22]="lustre/obdclass/"
+DEST_MODULE_LOCATION[22]="/extra/lustre/"
+BUILT_MODULE_NAME[23]="llog_test"
+BUILT_MODULE_LOCATION[23]="lustre/obdclass/"
+DEST_MODULE_LOCATION[23]="/extra/lustre/"
+BUILT_MODULE_NAME[24]="lod"
+BUILT_MODULE_LOCATION[24]="lustre/lod/"
+DEST_MODULE_LOCATION[24]="/extra/lustre/"
+BUILT_MODULE_NAME[25]="lmv"
+BUILT_MODULE_LOCATION[25]="lustre/lmv/"
+DEST_MODULE_LOCATION[25]="/extra/lustre/"
+BUILT_MODULE_NAME[26]="ofd"
+BUILT_MODULE_LOCATION[26]="lustre/ofd/"
+DEST_MODULE_LOCATION[26]="/extra/lustre/"
+BUILT_MODULE_NAME[27]="ost"
+BUILT_MODULE_LOCATION[27]="lustre/ost/"
+DEST_MODULE_LOCATION[27]="/extra/lustre/"
+BUILT_MODULE_NAME[28]="lfsck"
+BUILT_MODULE_LOCATION[28]="lustre/lfsck/"
+DEST_MODULE_LOCATION[28]="/extra/lustre/"
+EOF