From 7fab2586f673ccae6a458984f5eda8137f456447 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 8 Apr 2013 21:46:40 -0700 Subject: [PATCH] LU-1032 build: Add Lustre DKMS spec file 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 Signed-off-by: Bruno Faccini Change-Id: I870f362b8948d5cd28a8dccd98b565e38ad2da7c Reviewed-on: http://review.whamcloud.com/6019 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Brian J. Murrell --- .gitignore | 1 + config/lustre-build.m4 | 1 + lustre-dkms.spec.in | 74 ++++++++++++++++++ lustre/scripts/Makefile.am | 2 +- lustre/scripts/dkms.mkconf | 190 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 267 insertions(+), 1 deletion(-) create mode 100644 lustre-dkms.spec.in create mode 100755 lustre/scripts/dkms.mkconf diff --git a/.gitignore b/.gitignore index d43a74f..7016003 100644 --- a/.gitignore +++ b/.gitignore @@ -68,6 +68,7 @@ TAGS /config.h.in /INSTALL /lustre.spec +/lustre-dkms.spec /lustre*.tar.gz /mkinstalldirs /Module.markers diff --git a/config/lustre-build.m4 b/config/lustre-build.m4 index d5d9220..30f9c5c 100644 --- a/config/lustre-build.m4 +++ b/config/lustre-build.m4 @@ -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 index 0000000..e2dbde4 --- /dev/null +++ b/lustre-dkms.spec.in @@ -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 - 2.3.63-1 +- First DKMS packages. diff --git a/lustre/scripts/Makefile.am b/lustre/scripts/Makefile.am index 9269050..7aa30d0 100644 --- a/lustre/scripts/Makefile.am +++ b/lustre/scripts/Makefile.am @@ -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 index 0000000..4795d16 --- /dev/null +++ b/lustre/scripts/dkms.mkconf @@ -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 -v -c -f " + exit 1 +fi + +cat >${filename} <