diff options
author | Brian Behlendorf <[email protected]> | 2013-02-08 11:02:08 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-03-18 15:31:54 -0700 |
commit | 493972c8964174d0ec767c4e780bb3add71363fe (patch) | |
tree | db080966f3503484616e7e97ae555f0f52fad028 | |
parent | 4a6d8d2c3e72345463de1db97d7d016c95443679 (diff) |
Refresh RPM packaging
Refresh the existing RPM packaging to conform to the 'Fedora
Packaging Guidelines'. This includes adopting the kmods2
packaging standard which is used fod kmods distributed by
rpmfusion for Fedora/RHEL.
http://fedoraproject.org/wiki/Packaging:Guidelines
http://rpmfusion.org/Packaging/KernelModules/Kmods2
While the spec files have been entirely rewritten from a
user perspective the only major changes are:
* The Fedora packages now have a build dependency on the
rpmfusion repositories. The generic kmod packages also
have a new dependency on kmodtool-1.22 but it is bundled
with the source rpm so no additional packages are needed.
* The kernel binary module packages have been renamed from
spl-modules-* to kmod-spl-* as specificed by kmods2.
* The is now a common kmod-spl-devel-* package in addition
to the per-kernel devel packages. The common package
contains the development headers while the per-kernel
package contains kernel specific build products.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #222
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile.am | 7 | ||||
-rw-r--r-- | config/deb.am | 20 | ||||
-rw-r--r-- | config/rpm.am | 90 | ||||
-rw-r--r-- | config/spl-build.m4 | 34 | ||||
-rw-r--r-- | config/spl-meta.m4 | 3 | ||||
-rw-r--r-- | config/tgz.am | 20 | ||||
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | dkms.conf.in | 23 | ||||
-rw-r--r-- | rpm/Makefile.am | 1 | ||||
-rw-r--r-- | rpm/fedora/.gitignore | 3 | ||||
-rw-r--r-- | rpm/fedora/Makefile.am | 1 | ||||
l--------- | rpm/fedora/spl-dkms.spec.in | 1 | ||||
-rw-r--r-- | rpm/fedora/spl-kmod.spec.in | 138 | ||||
l--------- | rpm/fedora/spl.spec.in | 1 | ||||
-rw-r--r-- | rpm/generic/.gitignore | 3 | ||||
-rw-r--r-- | rpm/generic/Makefile.am | 1 | ||||
-rw-r--r-- | rpm/generic/spl-dkms.spec.in | 68 | ||||
-rw-r--r-- | rpm/generic/spl-kmod.spec.in | 148 | ||||
-rw-r--r-- | rpm/generic/spl.spec.in | 40 | ||||
-rw-r--r-- | scripts/Makefile.am | 2 | ||||
-rwxr-xr-x | scripts/dkms.mkconf | 81 | ||||
-rwxr-xr-x | scripts/dkms.postinst (renamed from dkms.postinst) | 2 | ||||
-rwxr-xr-x | scripts/kmodtool | 552 | ||||
-rw-r--r-- | spl-modules.spec.in | 576 | ||||
-rw-r--r-- | spl.spec.in | 39 |
26 files changed, 1139 insertions, 730 deletions
diff --git a/.gitignore b/.gitignore index 97887eb0e..27069f5c7 100644 --- a/.gitignore +++ b/.gitignore @@ -40,10 +40,7 @@ Makefile.in /libtool /spl_config.h /spl_config.h.in -/spl.spec -/spl-modules.spec /spl.release -/dkms.conf /stamp-h1 /aclocal.m4 /autom4te.cache diff --git a/Makefile.am b/Makefile.am index 0bb3e46f2..3e149cb31 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/config/rpm.am include $(top_srcdir)/config/deb.am include $(top_srcdir)/config/tgz.am -SUBDIRS = include +SUBDIRS = include rpm if CONFIG_USER SUBDIRS += lib cmd scripts endif @@ -17,9 +17,8 @@ nodist_kernel_HEADERS = spl.release spl_config.h module/$(LINUX_SYMBOLS) endif AUTOMAKE_OPTIONS = foreign -EXTRA_DIST = autogen.sh spl.spec.in spl-modules.spec.in META DISCLAIMER +EXTRA_DIST = autogen.sh META DISCLAIMER copy-builtin EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am -EXTRA_DIST += dkms.postinst copy-builtin distclean-local:: -$(RM) -R autom4te*.cache @@ -44,5 +43,5 @@ etags: tags: ctags etags pkg: @DEFAULT_PACKAGE@ -pkg-modules: @DEFAULT_PACKAGE@-modules +pkg-kmod: @DEFAULT_PACKAGE@-kmod pkg-utils: @DEFAULT_PACKAGE@-utils diff --git a/config/deb.am b/config/deb.am index 75e31dfec..5efbd9d36 100644 --- a/config/deb.am +++ b/config/deb.am @@ -28,26 +28,24 @@ deb-local: exit 1; \ fi) -deb-modules: deb-local rpm-modules +deb-kmod: deb-local rpm-kmod if CONFIG_KERNEL - name=${PACKAGE}-modules; \ - version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \ - release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \ - arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \ - pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \ - pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \ - fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \ - $(RM) $$pkg1 $$pkg2 + name=${PACKAGE}; \ + version=${VERSION}-${RELEASE}; \ + arch=`$(RPM) -qp $${name}-kmod-$${version}.src.rpm --qf %{arch} | tail -1`; \ + pkg1=kmod-$${name}*$${version}.$${arch}.rpm; \ + fakeroot $(ALIEN) --scripts --to-deb $$pkg1; \ + $(RM) $$pkg1 endif deb-utils: deb-local rpm-utils if CONFIG_USER name=${PACKAGE}; \ - version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \ + version=${VERSION}-${RELEASE}; \ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \ pkg1=$${name}-$${version}.$${arch}.rpm; \ fakeroot $(ALIEN) --scripts --to-deb $$pkg1; \ $(RM) $$pkg1 endif -deb: deb-modules deb-utils +deb: deb-kmod deb-utils diff --git a/config/rpm.am b/config/rpm.am index 7340b4fce..8b33bb5b6 100644 --- a/config/rpm.am +++ b/config/rpm.am @@ -1,39 +1,40 @@ ############################################################################### -# Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. +# Copyright (C) 2007-2013 Lawrence Livermore National Security, LLC. # Copyright (C) 2007 The Regents of the University of California. # Written by Brian Behlendorf <[email protected]>. ############################################################################### # Build targets for RPM packages. ############################################################################### -srpm-modules: -if CONFIG_KERNEL - $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common -endif +srpm-kmod: + $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-kmod" \ + def='${SRPM_DEFINE_COMMON} ${SRPM_DEFINE_KMOD}' srpm-common + +srpm-dkms: + $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-dkms" \ + def='${SRPM_DEFINE_COMMON} ${SRPM_DEFINE_DKMS}' srpm-common srpm-utils: -if CONFIG_USER - $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common -endif + $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" \ + def='${SRPM_DEFINE_COMMON} ${SRPM_DEFINE_UTIL}' srpm-common -srpm: srpm-modules srpm-utils +srpm: srpm-kmod srpm-dkms srpm-utils +srpms: srpm-kmod srpm-dkms srpm-utils -rpm-dkms: srpm-modules -if CONFIG_KERNEL - $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" dkms-common -endif +rpm-kmod: srpm-kmod + $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-kmod" \ + def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_KMOD}' rpm-common -rpm-modules: srpm-modules -if CONFIG_KERNEL - $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common -endif +rpm-dkms: srpm-dkms + $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-dkms" \ + def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_DKMS}' rpm-common rpm-utils: srpm-utils -if CONFIG_USER - $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common -endif + $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" \ + def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_UTIL}' rpm-common -rpm: rpm-modules rpm-utils rpm-dkms +rpm: rpm-kmod rpm-dkms rpm-utils +rpms: rpm-kmod rpm-dkms rpm-utils rpm-local: @(if test "${HAVE_RPMBUILD}" = "no"; then \ @@ -48,32 +49,14 @@ rpm-local: mkdir -p $(rpmbuild)/RPMS && \ mkdir -p $(rpmbuild)/SRPMS && \ mkdir -p $(rpmbuild)/SPECS && \ - cp $(rpmspec) $(rpmbuild)/SPECS && \ + cp ${RPM_SPEC_DIR}/$(rpmspec) $(rpmbuild)/SPECS && \ mkdir -p $(rpmbuild)/SOURCES && \ + cp scripts/kmodtool $(rpmbuild)/SOURCES && \ cp $(distdir).tar.gz $(rpmbuild)/SOURCES) -dkms-common: - rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \ - rpmspec=$(pkg).spec; \ - rpmdkms=$(pkg)-dkms-$(SPL_META_VERSION)-$(SPL_META_RELEASE).noarch.rpm;\ - rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \ - $(MAKE) $(AM_MAKEFLAGS) \ - rpmbuild="$$rpmbuild" \ - rpmspec="$$rpmspec" \ - rpm-local || exit 1; \ - $(RPMBUILD) \ - --define "_tmppath $$rpmbuild/TMP" \ - --define "_topdir $$rpmbuild" \ - --define "dist %{nil}" \ - --define "_without_kernel 1" \ - --define "_without_kernel_debug 1" \ - --define "_with_kernel_dkms 1" \ - --nodeps --rebuild $$rpmpkg || exit 1; \ - cp $$rpmbuild/RPMS/noarch/$$rpmdkms . || exit 1; \ - $(RM) -R $$rpmbuild - srpm-common: dist - rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \ + @(dist=`$(RPM) --eval %{?dist}`; \ + rpmpkg=$(pkg)-$(VERSION)-$(RELEASE)$$dist*src.rpm; \ rpmspec=$(pkg).spec; \ rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \ $(MAKE) $(AM_MAKEFLAGS) \ @@ -83,14 +66,13 @@ srpm-common: dist $(RPMBUILD) \ --define "_tmppath $$rpmbuild/TMP" \ --define "_topdir $$rpmbuild" \ - --define "build_src_rpm 1" \ - --define "dist %{nil}" \ - --nodeps -bs $$rpmbuild/SPECS/$$rpmspec || exit 1; \ + $(def) -bs $$rpmbuild/SPECS/$$rpmspec || exit 1; \ cp $$rpmbuild/SRPMS/$$rpmpkg . || exit 1; \ - $(RM) -R $$rpmbuild + rm -R $$rpmbuild) rpm-common: - rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \ + @(dist=`$(RPM) --eval %{?dist}`; \ + rpmpkg=$(pkg)-$(VERSION)-$(RELEASE)$$dist*src.rpm; \ rpmspec=$(pkg).spec; \ rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \ $(MAKE) $(AM_MAKEFLAGS) \ @@ -100,14 +82,6 @@ rpm-common: ${RPMBUILD} \ --define "_tmppath $$rpmbuild/TMP" \ --define "_topdir $$rpmbuild" \ - --define "dist %{nil}" \ - --define "require_kdir $(LINUX)" \ - --define "require_kobj $(LINUX_OBJ)" \ - --define "require_kver $(LINUX_VERSION)" \ - --define "$(DEBUG_SPL) 1" \ - --define "$(DEBUG_LOG) 1" \ - --define "$(DEBUG_KMEM) 1" \ - --define "$(DEBUG_KMEM_TRACKING) 1" \ - --nodeps --rebuild $$rpmpkg || exit 1; \ + $(def) --rebuild $$rpmpkg || exit 1; \ cp $$rpmbuild/RPMS/*/* . || exit 1; \ - $(RM) -R $$rpmbuild + rm -R $$rpmbuild) diff --git a/config/spl-build.m4 b/config/spl-build.m4 index 14a7d9740..233eea004 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -232,6 +232,11 @@ dnl # Check for rpm+rpmbuild to build RPM packages. If these tools dnl # are missing it is non-fatal but you will not be able to build dnl # RPM packages and will be warned if you try too. dnl # +dnl # By default the generic spec file will be used because it requires +dnl # minimal dependencies. Distribution specific spec files can be +dnl # placed under the 'rpm/<distribution>' directory and enabled using +dnl # the --with-spec=<distribution> configure option. +dnl # AC_DEFUN([SPL_AC_RPM], [ RPM=rpm RPMBUILD=rpmbuild @@ -256,6 +261,25 @@ AC_DEFUN([SPL_AC_RPM], [ AC_MSG_RESULT([$HAVE_RPMBUILD]) ]) + RPM_DEFINE_COMMON='--define "$(DEBUG_SPL) 1" --define "$(DEBUG_LOG) 1" --define "$(DEBUG_KMEM) 1" --define "$(DEBUG_KMEM_TRACKING) 1"' + RPM_DEFINE_UTIL= + RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)"' + RPM_DEFINE_DKMS= + + SRPM_DEFINE_COMMON='--define "build_src_rpm 1"' + SRPM_DEFINE_UTIL= + SRPM_DEFINE_KMOD= + SRPM_DEFINE_DKMS= + + RPM_SPEC_DIR="rpm/generic" + AC_ARG_WITH([spec], + AS_HELP_STRING([--with-spec=SPEC], + [Spec files 'generic|fedora']), + [RPM_SPEC_DIR="rpm/$withval"]) + + AC_MSG_CHECKING([whether spec files are available]) + AC_MSG_RESULT([yes ($RPM_SPEC_DIR/*.spec.in)]) + AC_SUBST(HAVE_RPM) AC_SUBST(RPM) AC_SUBST(RPM_VERSION) @@ -263,6 +287,16 @@ AC_DEFUN([SPL_AC_RPM], [ AC_SUBST(HAVE_RPMBUILD) AC_SUBST(RPMBUILD) AC_SUBST(RPMBUILD_VERSION) + + AC_SUBST(RPM_SPEC_DIR) + AC_SUBST(RPM_DEFINE_UTIL) + AC_SUBST(RPM_DEFINE_KMOD) + AC_SUBST(RPM_DEFINE_DKMS) + AC_SUBST(RPM_DEFINE_COMMON) + AC_SUBST(SRPM_DEFINE_UTIL) + AC_SUBST(SRPM_DEFINE_KMOD) + AC_SUBST(SRPM_DEFINE_DKMS) + AC_SUBST(SRPM_DEFINE_COMMON) ]) dnl # diff --git a/config/spl-meta.m4 b/config/spl-meta.m4 index b76cc8dc6..af8be801a 100644 --- a/config/spl-meta.m4 +++ b/config/spl-meta.m4 @@ -35,6 +35,9 @@ AC_DEFUN([SPL_AC_META], [ [Define the project release.] ) AC_SUBST([SPL_META_RELEASE]) + + RELEASE="$SPL_META_RELEASE" + AC_SUBST([RELEASE]) fi if test -n "$SPL_META_NAME" -a -n "$SPL_META_VERSION"; then diff --git a/config/tgz.am b/config/tgz.am index 1aaf4dde2..765be43b9 100644 --- a/config/tgz.am +++ b/config/tgz.am @@ -21,26 +21,24 @@ tgz-local: exit 1; \ fi) -tgz-modules: tgz-local rpm-modules +tgz-kmod: tgz-local rpm-kmod if CONFIG_KERNEL - name=${PACKAGE}-modules; \ - version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \ - release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \ - arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \ - pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \ - pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \ - fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \ - $(RM) $$pkg1 $$pkg2 + name=${PACKAGE}; \ + version=${VERSION}-${RELEASE}; \ + arch=`$(RPM) -qp $${name}-kmod-$${version}.src.rpm --qf %{arch} | tail -1`; \ + pkg1=kmod-$${name}*$${version}.$${arch}.rpm; \ + fakeroot $(ALIEN) --scripts --to-tgz $$pkg1; \ + $(RM) $$pkg1 endif tgz-utils: tgz-local rpm-utils if CONFIG_USER name=${PACKAGE}; \ - version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \ + version=${VERSION}-${RELEASE}; \ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \ pkg1=$${name}-$${version}.$${arch}.rpm; \ fakeroot $(ALIEN) --scripts --to-tgz $$pkg1; \ $(RM) $$pkg1 endif -tgz: tgz-modules tgz-utils +tgz: tgz-kmod tgz-utils diff --git a/configure.ac b/configure.ac index c71bc1f53..d5951ac3a 100644 --- a/configure.ac +++ b/configure.ac @@ -64,10 +64,16 @@ AC_CONFIG_FILES([ include/util/Makefile include/vm/Makefile scripts/Makefile - spl.spec - spl-modules.spec + rpm/Makefile + rpm/fedora/Makefile + rpm/fedora/spl.spec + rpm/fedora/spl-kmod.spec + rpm/fedora/spl-dkms.spec + rpm/generic/Makefile + rpm/generic/spl.spec + rpm/generic/spl-kmod.spec + rpm/generic/spl-dkms.spec spl.release - dkms.conf ]) AC_OUTPUT diff --git a/dkms.conf.in b/dkms.conf.in deleted file mode 100644 index 64f1f916f..000000000 --- a/dkms.conf.in +++ /dev/null @@ -1,23 +0,0 @@ -AUTOINSTALL="yes" -PACKAGE_NAME="@PACKAGE@" -PACKAGE_VERSION="@VERSION@" -PRE_BUILD="configure - --prefix=/usr - --with-config=kernel - --with-linux=$(case `lsb_release -is` in - (Debian) echo ${kernel_source_dir/%build/source} ;; - (*) echo ${kernel_source_dir} ;; - esac) - --with-linux-obj=${kernel_source_dir} -" -POST_INSTALL="dkms.postinst -a ${arch} -k ${kernelver} -t ${dkms_tree} - -n ${PACKAGE_NAME} -v ${PACKAGE_VERSION} -" -REMAKE_INITRD="no" -MAKE[0]="make" -BUILT_MODULE_NAME[0]="spl" -BUILT_MODULE_LOCATION[0]="module/spl/" -DEST_MODULE_LOCATION[0]="/extra/spl/spl" -BUILT_MODULE_NAME[1]="splat" -BUILT_MODULE_LOCATION[1]="module/splat/" -DEST_MODULE_LOCATION[1]="/extra/splat/splat" diff --git a/rpm/Makefile.am b/rpm/Makefile.am new file mode 100644 index 000000000..e41cdda2e --- /dev/null +++ b/rpm/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = fedora generic diff --git a/rpm/fedora/.gitignore b/rpm/fedora/.gitignore new file mode 100644 index 000000000..67129ff14 --- /dev/null +++ b/rpm/fedora/.gitignore @@ -0,0 +1,3 @@ +/spl-dkms.spec +/spl-kmod.spec +/spl.spec diff --git a/rpm/fedora/Makefile.am b/rpm/fedora/Makefile.am new file mode 100644 index 000000000..da6c4abe2 --- /dev/null +++ b/rpm/fedora/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = spl.spec.in spl-kmod.spec.in spl-dkms.spec.in diff --git a/rpm/fedora/spl-dkms.spec.in b/rpm/fedora/spl-dkms.spec.in new file mode 120000 index 000000000..900f524aa --- /dev/null +++ b/rpm/fedora/spl-dkms.spec.in @@ -0,0 +1 @@ +../generic/spl-dkms.spec.in
\ No newline at end of file diff --git a/rpm/fedora/spl-kmod.spec.in b/rpm/fedora/spl-kmod.spec.in new file mode 100644 index 000000000..30121591c --- /dev/null +++ b/rpm/fedora/spl-kmod.spec.in @@ -0,0 +1,138 @@ +%define module @PACKAGE@ +%define repo rpmfusion + +%define buildforkernels newest +#define buildforkernels current +#define buildforkernels akmod + +%bcond_with debug +%bcond_with debug_log +%bcond_with debug_kmem +%bcond_with debug_kmem_tracking +%bcond_with atomic_spinlocks + + +Name: %{module}-kmod + +Version: @VERSION@ +Release: @RELEASE@%{?dist} +Summary: Kernel module(s) + +Group: System Environment/Kernel +License: GPLv2+ +URL: http://zfsonlinux.org/ +Source0: %{module}-%{version}.tar.gz +Source10: kmodtool + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +ExclusiveArch: i586 i686 x86_64 + +# Likely compiles but is not supported. +ExcludeArch: ppc ppc64 + +# The developments headers will conflict with the dkms packages. +Conflicts: %{module}-dkms + +BuildRequires: %{_bindir}/kmodtool + +%if 0%{?fedora} >= 17 +%define prefix /usr +%endif + +%{!?kernels:BuildRequires: buildsys-build-rpmfusion-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu} } + +# Kmodtool does its magic here. A patched version of kmodtool is shipped +# with the source rpm until kmod development packages are supported upstream. +# https://bugzilla.rpmfusion.org/show_bug.cgi?id=2714 +%{expand:%(sh %{SOURCE10} --target %{_target_cpu} --repo %{repo} --kmodname %{name} --devel %{?prefix:--prefix "%{?prefix}"} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) } + + +%description +This package contains the kernel modules required to emulate +several interfaces provided by the Solaris kernel. + +%prep +# Error out if there was something wrong with kmodtool. +%{?kmodtool_check} + +# Print kmodtool output for debugging purposes: +sh %{SOURCE10} --target %{_target_cpu} --repo %{repo} --kmodname %{name} --devel %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null + +%if %{with debug} + %define debug --enable-debug +%else + %define debug --disable-debug +%endif + +%if %{with debug_log} + %define debug_log --enable-debug-log +%else + %define debug_log --disable-debug-log +%endif + +%if %{with debug_kmem} + %define debug_kmem --enable-debug-kmem +%else + %define debug_kmem --disable-debug-kmem +%endif + +%if %{with debug_kmem_tracking} + %define debug_kmem_tracking --enable-debug-kmem-tracking +%else + %define debug_kmem_tracking --disable-debug-kmem-tracking +%endif + +%if %{with atomic_spinlocks} + %define atomic_spinlocks --enable-atomic-spinlocks +%else + %define atomic_spinlocks --disable-atomic-spinlocks +%endif + +# Leverage VPATH from configure to avoid making multiple copies. +%define _configure ../%{module}-%{version}/configure + +%setup -q -c -T -a 0 + +for kernel_version in %{?kernel_versions}; do + %{__mkdir} _kmod_build_${kernel_version%%___*} +done + +%build +for kernel_version in %{?kernel_versions}; do + pushd _kmod_build_${kernel_version%%___*} + %configure \ + --with-config=kernel \ + --with-linux="${kernel_version##*___}" \ + --with-linux-obj="${kernel_version##*___}" \ + %{debug} \ + %{debug_log} \ + %{debug_kmem} \ + %{debug_kmem_tracking} \ + %{atomic_spinlocks} + make %{?_smp_mflags} + popd +done + + +%install +rm -rf ${RPM_BUILD_ROOT} + +# Relies on the kernel 'modules_install' make target. +for kernel_version in %{?kernel_versions}; do + pushd _kmod_build_${kernel_version%%___*} + make install \ + DESTDIR=${RPM_BUILD_ROOT} \ + %{?prefix:INSTALL_MOD_PATH=%{?prefix}} \ + INSTALL_MOD_DIR=%{kmodinstdir_postfix} + popd +done +chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*/* +%{?akmod_install} + + +%clean +rm -rf $RPM_BUILD_ROOT + +%changelog +* Tue Mar 12 2013 Brian Behlendorf <[email protected]> - 0.6.0-1 +- Initial kmods2 packaging. diff --git a/rpm/fedora/spl.spec.in b/rpm/fedora/spl.spec.in new file mode 120000 index 000000000..d3276f013 --- /dev/null +++ b/rpm/fedora/spl.spec.in @@ -0,0 +1 @@ +../generic/spl.spec.in
\ No newline at end of file diff --git a/rpm/generic/.gitignore b/rpm/generic/.gitignore new file mode 100644 index 000000000..67129ff14 --- /dev/null +++ b/rpm/generic/.gitignore @@ -0,0 +1,3 @@ +/spl-dkms.spec +/spl-kmod.spec +/spl.spec diff --git a/rpm/generic/Makefile.am b/rpm/generic/Makefile.am new file mode 100644 index 000000000..da6c4abe2 --- /dev/null +++ b/rpm/generic/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = spl.spec.in spl-kmod.spec.in spl-dkms.spec.in diff --git a/rpm/generic/spl-dkms.spec.in b/rpm/generic/spl-dkms.spec.in new file mode 100644 index 000000000..d395bf07a --- /dev/null +++ b/rpm/generic/spl-dkms.spec.in @@ -0,0 +1,68 @@ +%define module @PACKAGE@ +%define mkconf scripts/dkms.mkconf + +Name: %{module}-dkms + +Version: @VERSION@ +Release: @RELEASE@%{?dist} +Summary: Kernel module(s) (dkms) + +Group: System Environment/Kernel +License: GPLv2+ +URL: http://zfsonlinux.org/ +Source0: %{module}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch + +Requires: dkms >= 2.2.0.2 +Provides: %{module}-kmod = %{version} +Conflicts: %{module}-kmod + +%description +This package contains the dkms kernel modules required to emulate +several interfaces provided by the Solaris kernel. + +%prep +%setup -q -n %{module}-%{version} + +%build +%{mkconf} -n %{module} -v %{version} -f dkms.conf + +%install +if [ "$RPM_BUILD_ROOT" != "/" ]; then + rm -rf $RPM_BUILD_ROOT +fi +mkdir -p $RPM_BUILD_ROOT/usr/src/ +cp -rf ${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 +* Tue Mar 12 2013 Brian Behlendorf <[email protected]> - 0.6.0-1 +- Initial dkms packaging. + diff --git a/rpm/generic/spl-kmod.spec.in b/rpm/generic/spl-kmod.spec.in new file mode 100644 index 000000000..dc23548a0 --- /dev/null +++ b/rpm/generic/spl-kmod.spec.in @@ -0,0 +1,148 @@ +%define module @PACKAGE@ + +%bcond_with debug +%bcond_with debug_log +%bcond_with debug_kmem +%bcond_with debug_kmem_tracking +%bcond_with atomic_spinlocks + + +Name: %{module}-kmod + +Version: @VERSION@ +Release: @RELEASE@%{?dist} +Summary: Kernel module(s) + +Group: System Environment/Kernel +License: GPLv2+ +URL: http://zfsonlinux.org/ +Source0: %{module}-%{version}.tar.gz +Source10: kmodtool +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +# The developments headers will conflict with the dkms packages. +Conflicts: %{module}-dkms + +# Source packages minimally require a kernel-devel dependency. +%{?rhel:BuildRequires: kernel-devel} +%{?fedora:BuildRequires: kernel-devel} +%{?suse_version:BuildRequires: kernel-source} + +# Binary packages build against all installed kernels by default. +%if !%{defined kernels} && !%{defined build_src_rpm} + %if 0%{?rhel}%{?fedora}%{?suse_version} + %define kernels %(ls -1 /usr/src/kernels) + %else + %define kernels %(ls -1 /lib/modules) + %endif +%endif + +%if 0%{?fedora} >= 17 +%define prefix /usr +%endif + +# Kmodtool does its magic here. A patched version of kmodtool is shipped +# because the latest versions may not be available for your distribution. +# https://bugzilla.rpmfusion.org/show_bug.cgi?id=2714 +%{expand:%(bash %{SOURCE10} --target %{_target_cpu} --kmodname %{name} --devel %{?prefix:--prefix "%{?prefix}"} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) } + + +%description +This package contains the kernel modules required to emulate +several interfaces provided by the Solaris kernel. + +%prep +# Error out if there was something wrong with kmodtool. +%{?kmodtool_check} + +# Print kmodtool output for debugging purposes: +bash %{SOURCE10} --target %{_target_cpu} --kmodname %{name} --devel %{?prefix:--prefix "%{?prefix}"} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null + +%if %{with debug} + %define debug --enable-debug +%else + %define debug --disable-debug +%endif + +%if %{with debug_log} + %define debug_log --enable-debug-log +%else + %define debug_log --disable-debug-log +%endif + +%if %{with debug_kmem} + %define debug_kmem --enable-debug-kmem +%else + %define debug_kmem --disable-debug-kmem +%endif + +%if %{with debug_kmem_tracking} + %define debug_kmem_tracking --enable-debug-kmem-tracking +%else + %define debug_kmem_tracking --disable-debug-kmem-tracking +%endif + +%if %{with atomic_spinlocks} + %define atomic_spinlocks --enable-atomic-spinlocks +%else + %define atomic_spinlocks --disable-atomic-spinlocks +%endif + +# Leverage VPATH from configure to avoid making multiple copies. +%define _configure ../%{module}-%{version}/configure + +%setup -q -c -T -a 0 + +for kernel_version in %{?kernel_versions}; do + %{__mkdir} _kmod_build_${kernel_version%%___*} +done + +%build +for kernel_version in %{?kernel_versions}; do + cd _kmod_build_${kernel_version%%___*} + %configure \ + --with-config=kernel \ +%if 0%{?rhel}%{?fedora} + --with-linux="${kernel_version##*___}" \ + --with-linux-obj="${kernel_version##*___}" \ +%else + --with-linux=\ + %(if [ -e /lib/modules/${kernel_version%%___*}/source ]; then \ + echo "/lib/modules/${kernel_version%%___*}/source" \ + else \ + echo "/lib/modules/${kernel_version%%___*}/build" \ + fi) \ + --with-linux-obj="/lib/modules/${kernel_version%%___*}/build" \ +%endif + %{debug} \ + %{debug_log} \ + %{debug_kmem} \ + %{debug_kmem_tracking} \ + %{atomic_spinlocks} + make %{?_smp_mflags} + cd .. +done + + +%install +rm -rf ${RPM_BUILD_ROOT} + +# Relies on the kernel 'modules_install' make target. +for kernel_version in %{?kernel_versions}; do + cd _kmod_build_${kernel_version%%___*} + make install \ + DESTDIR=${RPM_BUILD_ROOT} \ + %{?prefix:INSTALL_MOD_PATH=%{?prefix}} \ + INSTALL_MOD_DIR=%{kmodinstdir_postfix} + cd .. +done +chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*/* +%{?akmod_install} + + +%clean +rm -rf $RPM_BUILD_ROOT + +%changelog +* Tue Mar 12 2013 Brian Behlendorf <[email protected]> - 0.6.0-1 +- Initial kmods2 packaging. diff --git a/rpm/generic/spl.spec.in b/rpm/generic/spl.spec.in new file mode 100644 index 000000000..4b8cf0756 --- /dev/null +++ b/rpm/generic/spl.spec.in @@ -0,0 +1,40 @@ +Name: @PACKAGE@ +Version: @VERSION@ +Release: @RELEASE@%{?dist} +Summary: Commands to control the kernel modules + +Group: System Environment/Kernel +License: GPLv2+ +URL: http://zfsonlinux.org/ +Source0: %{name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +ExclusiveArch: i386 i686 x86_64 + +# May build but untested on ppc/ppc64 +ExcludeArch: ppc ppc64 + +Requires: %{name}-kmod >= %{version} +Provides: %{name}-kmod-common = %{version} + +%description +This package contains the commands to verify the SPL +kernel modules are functioning properly. + +%prep +%setup -q + +%build +%configure --with-config=user +make %{?_smp_mflags} + +%install +%{__rm} -rf $RPM_BUILD_ROOT +make install DESTDIR=%{?buildroot} + +%files +%doc AUTHORS COPYING DISCLAIMER +%{_sbindir}/* + +%changelog +* Tue Mar 12 2013 Brian Behlendorf <[email protected]> - 0.6.0-1 +- Refreshed RPM packaging. diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 33700ee44..4c0d7ba40 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,4 +1,4 @@ -EXTRA_DIST = check.sh +EXTRA_DIST = check.sh dkms.mkconf dkms.postinst kmodtool check: $(top_srcdir)/scripts/check.sh diff --git a/scripts/dkms.mkconf b/scripts/dkms.mkconf new file mode 100755 index 000000000..3bfe2be7b --- /dev/null +++ b/scripts/dkms.mkconf @@ -0,0 +1,81 @@ +#!/bin/sh + +PROG=$0 + +pkgcfg=/etc/sysconfig/spl + +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}" +PRE_BUILD="configure + --prefix=/usr + --with-config=kernel + \$( + [[ -r \${PACKAGE_CONFIG} ]] \\ + && source \${PACKAGE_CONFIG} \\ + && shopt -q -s extglob \\ + && \\ + { + if [[ \${SPL_DKMS_ENABLE_DEBUG,,} == @(y|yes) ]] + then + echo --enable-debug + fi + if [[ \${SPL_DKMS_ENABLE_DEBUG_LOG,,} == @(y|yes) ]] + then + echo --enable-debug-log + fi + if [[ \${SPL_DKMS_ENABLE_DEBUG_KMEM,,} == @(y|yes) ]] + then + echo --enable-debug-kmem + fi + if [[ \${SPL_DKMS_ENABLE_DEBUG_KMEM_TRACKING,,} == @(y|yes) ]] + then + echo --enable-debug-kmem-tracking + fi + if [[ \${SPL_DKMS_ENABLE_ATOMIC_SPINLOCKS,,} == @(y|yes) ]] + then + echo --enable-atomic-spinlocks + fi + } + ) +" +POST_INSTALL="scripts/dkms.postinst + -n \${PACKAGE_NAME} + -v \${PACKAGE_VERSION} + -a \${arch} + -k \${kernelver} + -t \${dkms_tree} +" +AUTOINSTALL="yes" +REMAKE_INITRD="no" +MAKE[0]="make" +STRIP[0]="\$( + [[ -r \${PACKAGE_CONFIG} ]] \\ + && source \${PACKAGE_CONFIG} \\ + && shopt -q -s extglob \\ + && [[ \${SPL_DKMS_DISABLE_STRIP,,} == @(y|yes) ]] \\ + && echo -n no +)" +STRIP[1]="\${STRIP[0]}" +BUILT_MODULE_NAME[0]="spl" +BUILT_MODULE_LOCATION[0]="module/spl/" +DEST_MODULE_LOCATION[0]="/extra/spl/spl" +BUILT_MODULE_NAME[1]="splat" +BUILT_MODULE_LOCATION[1]="module/splat/" +DEST_MODULE_LOCATION[1]="/extra/splat/splat" +EOF diff --git a/dkms.postinst b/scripts/dkms.postinst index cecf58e79..a23bbdabb 100755 --- a/dkms.postinst +++ b/scripts/dkms.postinst @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh PROG=$0 diff --git a/scripts/kmodtool b/scripts/kmodtool new file mode 100755 index 000000000..2170c4a90 --- /dev/null +++ b/scripts/kmodtool @@ -0,0 +1,552 @@ +#!/bin/bash + +# kmodtool - Helper script for building kernel module RPMs +# Copyright (c) 2003-2012 Ville Skyttä <[email protected]>, +# Thorsten Leemhuis <[email protected]> +# Nicolas Chauvet <[email protected]> +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +shopt -s extglob + +myprog="kmodtool-${repo}" +myver="0.12.1" + +kmodname= +build_kernels="current" +kernels_known_variants= +kernel_versions= +kernel_versions_to_build_for= +prefix= +filterfile= +target= + +error_out() +{ + local errorlevel=${1} + shift + echo "Error: $@" >&2 + # the next line is not multi-line safe -- not needed *yet* + echo "%global kmodtool_check echo \"kmodtool error: $@\"; exit ${errorlevel};" + exit ${errorlevel} +} + +print_rpmtemplate_header() +{ + echo + echo '%global kmodinstdir_prefix '${prefix}/lib/modules/ + echo '%global kmodinstdir_postfix '/extra/${kmodname}/ + echo '%global kernel_versions '${kernel_versions} + echo +} + +print_akmodtemplate () +{ + echo + cat <<EOF + +%global akmod_install mkdir -p \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/; \\\ +rpmbuild --define "_sourcedir %{_sourcedir}" \\\ +--define "_srcrpmdir \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/" \\\ +-bs --nodeps %{_specdir}/%{name}.spec ; \\\ +ln -s \$(ls \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/) \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/${kmodname}-kmod.latest + +%package -n akmod-${kmodname} +Summary: Akmod package for ${kmodname} kernel module(s) +Group: System Environment/Kernel +Requires: kmodtool +Requires: akmods +%{?AkmodsBuildRequires:Requires: %{AkmodsBuildRequires}} +# same requires and provides as a kmods package would have +Requires: ${kmodname}-kmod-common >= %{?epoch:%{epoch}:}%{version} +Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} +EOF + + if [[ ${obsolete_name} ]]; then + echo "Provides: akmod-${obsolete_name} = ${obsolete_version}" + echo "Obsoletes: akmod-${obsolete_name} < ${obsolete_version}" + fi + + cat <<EOF + +%description -n akmod-${kmodname} +This package provides the akmod package for the ${kmodname} kernel modules. + +%posttrans -n akmod-${kmodname} +nohup ${prefix}/sbin/akmods --from-akmod-posttrans --akmod ${kmodname} &> /dev/null & + +%files -n akmod-${kmodname} +%defattr(-,root,root,-) +%{_usrsrc}/akmods/* + +EOF +} + +print_akmodmeta () +{ + cat <<EOF +%package -n kmod-${kmodname} +Summary: Metapackage which tracks in ${kmodname} kernel module for newest kernel${dashvariant} +Group: System Environment/Kernel + +Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} +Provides: kmod-${kmodname}-xen = %{?epoch:%{epoch}:}%{version}-%{release} +Provides: kmod-${kmodname}-smp = %{?epoch:%{epoch}:}%{version}-%{release} +Provides: kmod-${kmodname}-PAE = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: akmod-${kmodname} = %{?epoch:%{epoch}:}%{version}-%{release} +EOF + + if [[ ${obsolete_name} ]]; then + echo "Provides: kmod-${obsolete_name} = ${obsolete_version}" + echo "Obsoletes: kmod-${obsolete_name} < ${obsolete_version}" + fi +cat <<EOF + +%description -n kmod-${kmodname}${dashvariant} +This is a meta-package without payload which sole purpose is to require the +${kmodname} kernel module(s) for the newest kernel${dashvariant}, +to make sure you get it together with a new kernel. + +%files -n kmod-${kmodname}${dashvariant} +%defattr(644,root,root,755) +EOF +} + +print_rpmtemplate_per_kmodpkg () +{ + if [[ "${1}" == "--custom" ]]; then + shift + local customkernel=true + elif [[ "${1}" == "--redhat" ]]; then + # this is needed for akmods + shift + local redhatkernel=true + fi + + local kernel_uname_r=${1} + local kernel_variant="${2:+-${2}}" + + # first part + cat <<EOF +%package -n kmod-${kmodname}-${kernel_uname_r} +Summary: ${kmodname} kernel module(s) for ${kernel_uname_r} +Group: System Environment/Kernel +Provides: kernel-modules-for-kernel = ${kernel_uname_r} +Provides: kmod-${kmodname}-uname-r = ${kernel_uname_r} +Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: ${kmodname}-kmod-common >= %{?epoch:%{epoch}:}%{version} +Requires(post): ${prefix}/sbin/depmod +Requires(postun): ${prefix}/sbin/depmod +%{?KmodsRequires:Requires: %{KmodsRequires}-uname-r = ${kernel_uname_r}} +%{?KmodsBuildRequires:BuildRequires: %{KmodsBuildRequires}-uname-r = ${kernel_uname_r}} +%{?KmodsBuildRequires:BuildRequires: %{KmodsBuildRequires}} +EOF + + if [[ ${obsolete_name} ]]; then + echo "Provides: kmod-${obsolete_name}-${kernel_uname_r} = ${obsolete_version}" + echo "Obsoletes: kmod-${obsolete_name}-${kernel_uname_r} < ${obsolete_version}" + fi + + # second part + if [[ ! "${customkernel}" ]]; then + cat <<EOF +Requires: kernel-uname-r = ${kernel_uname_r} +BuildRequires: kernel-devel-uname-r = ${kernel_uname_r} +%post -n kmod-${kmodname}-${kernel_uname_r} +${prefix}/sbin/depmod -aeF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} > /dev/null || : +%postun -n kmod-${kmodname}-${kernel_uname_r} +${prefix}/sbin/depmod -aF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} &> /dev/null || : + +EOF + else + cat <<EOF +%post -n kmod-${kmodname}-${kernel_uname_r} +[[ "$(uname -r)" == "${kernel_uname_r}" ]] && ${prefix}/sbin/depmod -a > /dev/null || : +%postun -n kmod-${kmodname}-${kernel_uname_r} +[[ "$(uname -r)" == "${kernel_uname_r}" ]] && ${prefix}/sbin/depmod -a > /dev/null || : + +EOF + fi + + # third part + cat <<EOF +%description -n kmod-${kmodname}-${kernel_uname_r} +This package provides the ${kmodname} kernel modules built for the Linux +kernel ${kernel_uname_r} for the %{_target_cpu} family of processors. +%files -n kmod-${kmodname}-${kernel_uname_r} +%defattr(644,root,root,755) +%dir $prefix/lib/modules/${kernel_uname_r}/extra +${prefix}/lib/modules/${kernel_uname_r}/extra/${kmodname}/ + + +EOF +} + +print_rpmtemplate_kmoddevelpkg () +{ + cat <<EOF +%package -n kmod-${kmodname}-devel +Summary: ${kmodname} kernel module(s) devel common +Group: System Environment/Kernel +Provides: ${kmodname}-devel-kmod-common = %{?epoch:%{epoch}:}%{version}-%{release} + +%description -n kmod-${kmodname}-devel +This package provides the common header files to build kernel modules +which depend on the ${kmodname} kernel module. +%files -n kmod-${kmodname}-devel +%defattr(644,root,root,755) +%{_usrsrc}/${kmodname}-%{version} +EOF + + for kernel in ${1}; do + local kernel_uname_r=${kernel} + echo "%exclude %{_usrsrc}/${kmodname}-%{version}/${kernel_uname_r}" + done + + echo + echo +} + +print_rpmtemplate_per_kmoddevelpkg () +{ + if [[ "${1}" == "--custom" ]]; then + shift + local customkernel=true + elif [[ "${1}" == "--redhat" ]]; then + # this is needed for akmods + shift + local redhatkernel=true + fi + + local kernel_uname_r=${1} + local kernel_variant="${2:+-${2}}" + + cat <<EOF +%package -n kmod-${kmodname}-devel-${kernel_uname_r} +Summary: ${kmodname} kernel module(s) devel for ${kernel_uname_r} +Group: System Environment/Kernel +Requires: ${kmodname}-devel-kmod-common = %{?epoch:%{epoch}:}%{version}-%{release} +Provides: kmod-${kmodname}-devel-uname-r = ${kernel_uname_r} +EOF + + # second part + if [[ ! "${customkernel}" ]]; then + cat <<EOF +Requires: kernel-uname-r = ${kernel_uname_r} +BuildRequires: kernel-devel-uname-r = ${kernel_uname_r} +EOF + fi + + cat <<EOF +%description -n kmod-${kmodname}-devel-${kernel_uname_r} +This package provides objects and symbols required to build kernel modules +which depend on the ${kmodname} kernel modules built for the Linux +kernel ${kernel_uname_r} for the %{_target_cpu} family of processors. +%files -n kmod-${kmodname}-devel-${kernel_uname_r} +%defattr(644,root,root,755) +%{_usrsrc}/${kmodname}-%{version}/${kernel_uname_r} + + +EOF +} + +print_rpmtemplate_kmodmetapkg () +{ + local kernel_uname_r=${1} + local kernel_variant="${2:+-${2}}" + + cat <<EOF +%package -n kmod-${kmodname}${kernel_variant} +Summary: Metapackage which tracks in ${kmodname} kernel module for newest kernel${kernel_variant} +Group: System Environment/Kernel + +Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: kmod-${kmodname}-${kernel_uname_r} >= %{?epoch:%{epoch}:}%{version}-%{release} +EOF + + if [[ ${obsolete_name} ]]; then + echo "Provides: kmod-${obsolete_name}${kernel_variant} = ${obsolete_version}" + echo "Obsoletes: kmod-${obsolete_name}${kernel_variant} < ${obsolete_version}" + fi + + cat <<EOF + +%description -n kmod-${kmodname}${kernel_variant} +This is a meta-package without payload which sole purpose is to require the +${kmodname} kernel module(s) for the newest kernel${kernel_variant}. +to make sure you get it together with a new kernel. + +%files -n kmod-${kmodname}${kernel_variant} +%defattr(644,root,root,755) + + +EOF +} + +print_customrpmtemplate () +{ + for kernel in ${1} + do + if [[ -e "/usr/src/kernels/${kernel}" ]] ; then + # this looks like a Fedora/RH kernel -- print a normal template (which includes the proper BR) and be happy :) + kernel_versions="${kernel_versions}${kernel}___%{_usrsrc}/kernels/${kernel} " + + # parse kernel versions string and print template + local kernel_verrelarch=${kernel%%${kernels_known_variants}} + print_rpmtemplate_per_kmodpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}} + + # create development package + if [[ "${devel}" ]]; then + print_rpmtemplate_per_kmoddevelpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}} + fi + elif [[ -e ${prefix}/lib/modules/"${kernel}"/build/Makefile ]] ; then + # likely a user-build-kernel with available buildfiles + # fixme: we should check if uname from Makefile is the same as ${kernel} + + kernel_versions="${kernel_versions}${kernel}___${prefix}/lib/modules/${kernel}/build/ " + print_rpmtemplate_per_kmodpkg --custom "${kernel}" + + # create development package + if [[ "${devel}" ]]; then + print_rpmtemplate_per_kmoddevelpkg --custom "${kernel}" + fi + else + error_out 2 "Don't know how to handle ${kernel} -- ${prefix}/lib/modules/${kernel}/build/Makefile not found" + fi + done + + # create common development package + if [[ "${devel}" ]]; then + print_rpmtemplate_kmoddevelpkg "${1}" + fi + + # well, it's no header anymore, but who cares ;-) + print_rpmtemplate_header +} + + +print_rpmtemplate () +{ + # create kernel_versions var + for kernel_version in ${kernel_versions_to_build_for} + do + kernel_versions="${kernel_versions}${kernel_version}___%{_usrsrc}/kernels/${kernel_version} " + done + + # and print it and some other required stuff as macro + print_rpmtemplate_header + + # now print the packages itselfs + for kernel in ${kernel_versions_to_build_for} ; do + + local kernel_verrelarch=${kernel%%${kernels_known_variants}} + + # create metapackage + print_rpmtemplate_kmodmetapkg ${kernel} ${kernel##${kernel_verrelarch}} + + # create package + print_rpmtemplate_per_kmodpkg ${kernel} ${kernel##${kernel_verrelarch}} + + # create development package + if [[ "${devel}" ]]; then + print_rpmtemplate_per_kmoddevelpkg ${kernel} ${kernel##${kernel_verrelarch}} + fi + done + + # create common development package + if [[ "${devel}" ]]; then + print_rpmtemplate_kmoddevelpkg "${1}" + fi +} + +myprog_help () +{ + echo "Usage: $(basename ${0}) [OPTIONS]" + echo $'\n'"Creates a template to be used during kmod building" + echo $'\n'"Available options:" + # FIXME echo " --datadir <dir> -- look for our shared files in <dir>" + echo " --filterfile <file> -- filter the results with grep --file <file>" + echo " --for-kernels <list> -- created templates only for these kernels" + echo " --kmodname <file> -- name of the kmod (required)" + echo " --devel -- make kmod-devel package" + echo " --noakmod -- no akmod package" + echo " --repo <name> -- use buildsys-build-<name>-kerneldevpkgs" + echo " --target <arch> -- target-arch (required)" +} + +while [ "${1}" ] ; do + case "${1}" in + --filterfile) + shift + if [[ ! "${1}" ]] ; then + error_out 2 "Please provide path to a filter-file together with --filterfile" >&2 + elif [[ ! -e "${1}" ]]; then + error_out 2 "Filterfile ${1} not found" >&2 + fi + filterfile="${1}" + shift + ;; + --kmodname) + shift + if [[ ! "${1}" ]] ; then + error_out 2 "Please provide the name of the kmod together with --kmodname" >&2 + fi + # strip pending -kmod + kmodname="${1%%-kmod}" + shift + ;; + --devel) + shift + devel="true" + ;; + --prefix) + shift + if [[ ! "${1}" ]] ; then + error_out 2 "Please provide a prefix with --prefix" >&2 + fi + prefix="${1}" + shift + ;; + --repo) + shift + if [[ ! "${1}" ]] ; then + error_out 2 "Please provide the name of the repo together with --repo" >&2 + fi + repo=${1} + shift + ;; + --for-kernels) + shift + if [[ ! "${1}" ]] ; then + error_out 2 "Please provide the name of the kmod together with --kmodname" >&2 + fi + for_kernels="${1}" + shift + ;; + --noakmod) + shift + noakmod="true" + ;; + --obsolete-name) + shift + if [[ ! "${1}" ]] ; then + error_out 2 "Please provide the name of the kmod to obsolte together with --obsolete-name" >&2 + fi + obsolete_name="${1}" + shift + ;; + --obsolete-version) + shift + if [[ ! "${1}" ]] ; then + error_out 2 "Please provide the version of the kmod to obsolte together with --obsolete-version" >&2 + fi + obsolete_version="${1}" + shift + ;; + --target) + shift + target="${1}" + shift + ;; + --akmod) + shift + build_kernels="akmod" + ;; + --newest) + shift + build_kernels="newest" + ;; + --current) + shift + build_kernels="current" + ;; + --help) + myprog_help + exit 0 + ;; + --version) + echo "${myprog} ${myver}" + exit 0 + ;; + *) + echo "Error: Unknown option '${1}'." >&2 + usage >&2 + exit 2 + ;; + esac +done + +if [[ -e ./kmodtool-kernel-variants ]]; then + kernels_known_variants="$(cat ./kmodtool-kernel-variants)" +elif [[ -e /usr/share/kmodtool/kernel-variants ]] ; then + kernels_known_variants="$(cat /usr/share/kmodtool/kernel-variants)" +else + kernels_known_variants="@(smp?(-debug)|PAE?(-debug)|debug|kdump|xen|kirkwood|highbank|imx|omap|tegra)" +fi + +# general sanity checks +if [[ ! "${target}" ]]; then + error_out 2 "please pass target arch with --target" +elif [[ ! "${kmodname}" ]]; then + error_out 2 "please pass kmodname with --kmodname" +elif [[ ! "${kernels_known_variants}" ]] ; then + error_out 2 "could not determine known variants" +elif ( [[ "${obsolete_name}" ]] && [[ ! "${obsolete_version}" ]] ) || ( [[ ! "${obsolete_name}" ]] && [[ "${obsolete_version}" ]] ) ; then + error_out 2 "you need to provide both --obsolete-name and --obsolete-version" +fi + +# go +if [[ "${for_kernels}" ]]; then + # this is easy: + print_customrpmtemplate "${for_kernels}" +elif [[ "${build_kernels}" == "akmod" ]]; then + # do only a akmod package + print_akmodtemplate + print_akmodmeta +else + # seems we are on out own to decide for which kernels to build + + # we need more sanity checks in this case + if [[ ! "${repo}" ]]; then + error_out 2 "please provide repo name with --repo" + elif ! $(which buildsys-build-${repo}-kerneldevpkgs &> /dev/null) ; then + error_out 2 "buildsys-build-${repo}-kerneldevpkgs not found" + fi + + # call buildsys-build-${repo}-kerneldevpkgs to get the list of kernels + cmdoptions="--target ${target}" + + # filterfile to filter list of kernels? + if [[ "${filterfile}" ]] ; then + cmdoptions="${cmdoptions} --filterfile ${filterfile}" + fi + + kernel_versions_to_build_for="$(buildsys-build-${repo}-kerneldevpkgs --${build_kernels} ${cmdoptions})" + returncode=$? + if (( ${returncode} != 0 )); then + error_out 2 "buildsys-build-${repo}-kerneldevpkgs failed: $(buildsys-build-${repo}-kerneldevpkgs --${build_kernels} ${cmdoptions})" + fi + + if [[ "${build_kernels}" == "current" ]] && [[ ! "${noakmod}" ]]; then + print_akmodtemplate + fi + + print_rpmtemplate +fi diff --git a/spl-modules.spec.in b/spl-modules.spec.in deleted file mode 100644 index d1315a27b..000000000 --- a/spl-modules.spec.in +++ /dev/null @@ -1,576 +0,0 @@ -# The following block is used to allow the source RPM to be rebuilt -# against specific kernels. It is preferable that rpmbuild define the -# require_kver, require_kdir, require_obj constants for us, but if it does not -# not we attempt to determine the correct values based on your distro. - -# kdir: Full path to the kernel source headers -# kobj: Full path to the kernel build objects -# kver: Kernel version -# kpkg: Kernel package name -# kdevpkg: Kernel devel package name -# kverpkg: Kernel package version - -%if %{defined require_kver} -%define kver %{require_kver} -%endif - -%if %{defined require_kdir} -%define kdir %{require_kdir} -%endif - -%if %{defined require_kobj} -%define kobj %{require_kobj} -%endif - -# Set using 'rpmbuild ... --with kernel ...', defaults to enabled. -%if %{defined _with_kernel} - %define with_kernel 1 -%else - %if %{defined _without_kernel} - %define with_kernel 0 - %else - %define with_kernel 1 - %endif -%endif - -# Set using 'rpmbuild ... --with kernel-debug ...', defaults to disabled. -%if %{defined _with_kernel_debug} - %define with_kernel_debug 1 -%else - %if %{defined _without_kernel_debug} - %define with_kernel_debug 0 - %else - %define with_kernel_debug 0 - %endif -%endif - -# Set using 'rpmbuild ... --with kernel-dkms ...', defaults to disabled. -%if %{defined _with_kernel_dkms} - %define with_kernel_dkms 1 -%else - %if %{defined _without_kernel_dkms} - %define with_kernel_dkms 0 - %else - %define with_kernel_dkms 0 - %endif -%endif - -# Set using 'rpmbuild ... --with debug ...', defaults to disabled. -%if %{defined _with_debug} - %define kdebug --enable-debug -%else - %if %{defined _without_debug} - %define kdebug --disable-debug - %else - %define kdebug --disable-debug - %endif -%endif - -# Set using 'rpmbuild ... --with debug-log ...', defaults to enabled. -%if %{defined _with_debug_log} - %define kdebug_log --enable-debug-log -%else - %if %{defined _without_debug_log} - %define kdebug_log --disable-debug-log - %else - %define kdebug_log --enable-debug-log - %endif -%endif - -# Set using 'rpmbuild ... --with debug-kmem ...', defaults to enabled. -%if %{defined _with_debug_kmem} - %define kdebug_kmem --enable-debug-kmem -%else - %if %{defined _without_debug_kmem} - %define kdebug_kmem --disable-debug-kmem - %else - %define kdebug_kmem --enable-debug-kmem - %endif -%endif - -# Set using 'rpmbuild ... --with debug-tracking ...', defaults to disabled. -%if %{defined _with_debug_kmem_tracking} - %define kdebug_kmem_tracking --enable-debug-kmem-tracking -%else - %if %{defined _without_debug_kmem_tracking} - %define kdebug_kmem_tracking --disable-debug-kmem-tracking - %else - %define kdebug_kmem_tracking --disable-debug-kmem-tracking - %endif -%endif - -# SLES: -%if %{defined suse_version} - %if %{undefined kver} - %ifarch ppc64 - %define kverextra ppc64 - %else - %define kverextra default - %endif - - %if %{suse_version} >= 1100 - %define klnk %{_usrsrc}/linux-obj/%{_target_cpu}/%{kverextra} - %define krelease %{klnk}/include/config/kernel.release - %else - %define klnk %{_usrsrc}/linux-obj/%{_target_cpu}/%{kverextra} - %define krelease %{klnk}/.kernelrelease - %endif - - %define kver_kern %((echo X; %{__cat} %{krelease} 2>/dev/null)|tail -1) - %define kver_dbug %{nil} - %else - %define kver_kern %{kver} - %define kver_dbug %{nil} - %endif - - %if %{undefined kverextra} - %define kverextra %(echo %{kver_kern} | cut -f3 -d'-') - %endif - - %define kpkg_kern kernel-%{kverextra} - %define kpkg_dbug %{nil} - %define kpkg_dkms dkms - - %define kdevpkg_kern kernel-source - %define kdevpkg_dbug %{nil} - %define kdevpkg_dkms dkms - - %define kverpkg_kern %(echo %{kver_kern} | %{__sed} -e 's/-%{kverextra}//g') - %define kverpkg_dbug %{nil} - %define kverpkg_dkms 2.2.0.2 - - # The kernel and rpm versions do not strictly match under SLES11 - # e.g. kernel version 2.6.27.19-5 != rpm version 2.6.27.19-5.1 - %if %{suse_version} >= 1100 - %define koppkg >= - %else - %define koppkg = - %endif - - %if %{undefined kdir} - %define kdir_kern %{_usrsrc}/linux-%{kverpkg_kern} - %define kdir_dbug %{nil} - %else - %define kdir_kern %{kdir} - %define kdir_dbug %{nil} - %endif - - %if %{undefined kobj} - %define kobj_kern %{kdir_kern}-obj/%{_target_cpu}/%{kverextra} - %define kobj_dbug %{nil} - %else - %define kobj_kern %{kobj} - %define kobj_dbug %{nil} - %endif -%else - -# RHEL 5.x/6.x, CHAOS 5.x: -%if %{defined el5} || %{defined el6} || %{defined ch5} - %if %{undefined kver} - %define klnk %{_usrsrc}/kernels/*/include/config - %define kver_kern %((echo X; ((%{__cat} %{klnk}/kernel.release - 2>/dev/null) | %{__grep} -v debug)) | tail -1) - %define kver_dbug %((echo X; ((%{__cat} %{klnk}/kernel.release - 2>/dev/null) | %{__grep} debug)) | tail -1) - %else - %define kver_kern %{kver} - %define kver_dbug %{kver}.debug - %endif - - %define kpkg_kern kernel - %define kpkg_dbug kernel-debug - %define kpkg_dkms dkms - - %define kdevpkg_kern kernel-devel - %define kdevpkg_dbug kernel-debug-devel - %define kdevpkg_dkms dkms - - %define kverpkg_dkms 2.2.0.2 - %if %{defined el6} || %{defined ch5} - %define kverpkg_kern %(echo %{kver_kern} | %{__sed} -e 's/.%{_target_cpu}//g') - %define kverpkg_dbug %(echo %{kver_dbug} | %{__sed} -e 's/.%{_target_cpu}//g' | %{__sed} -e 's/.debug//g') - %else - %define kverpkg_kern %{kver_kern} - %define kverpkg_dbug %{kver_dbug} - %endif - - %define koppkg = - - %if %{undefined kdir} - %if %{defined el6} || %{defined ch5} - %define kdir_kern %{_usrsrc}/kernels/%{kver_kern} - %define kdir_dbug %{_usrsrc}/kernels/%{kver_dbug} - %else - %define kdir_kern %{_usrsrc}/kernels/%{kver_kern}-%{_target_cpu} - %define kdir_dbug %{_usrsrc}/kernels/%{kver_dbug}-%{_target_cpu} - %endif - %else - %define kdir_kern %{kdir} - %define kdir_dbug %{kdir}.debug - %endif - - %if %{undefined kobj} - %define kobj_kern %{kdir_kern} - %define kobj_dbug %{kdir_dbug} - %else - %define kobj_kern %{kobj} - %define kobj_dbug %{kobj}.debug - %endif -%else - -# Fedora: -%if %{defined fedora} - %if %{undefined kver} - %define klnk %{_usrsrc}/kernels/*/include/config - %define kver_kern %((echo X; ((%{__cat} %{klnk}/kernel.release - 2>/dev/null) | %{__grep} -v debug)) | tail -1) - %define kver_dbug %((echo X; ((%{__cat} %{klnk}/kernel.release - 2>/dev/null) | %{__grep} debug)) | tail -1) - %else - %define kver_kern %{kver} - %define kver_dbug %{kver}.debug - %endif - - %define kpkg_kern kernel - %define kpkg_dbug kernel-debug - %define kpkg_dkms dkms - - %define kdevpkg_kern kernel-devel - %define kdevpkg_dbug kernel-debug-devel - %define kdevpkg_dkms dkms - - %define kverpkg_dkms 2.2.0.2 - %define kverpkg_kern %(echo %{kver_kern} | %{__sed} -e 's/.%{_target_cpu}//g') - %define kverpkg_dbug %(echo %{kver_dbug} | %{__sed} -e 's/.%{_target_cpu}//g' | %{__sed} -e 's/.debug//g') - - %define koppkg = - - %if %{undefined kdir} - %define kdir_kern %{_usrsrc}/kernels/%{kver_kern} - %define kdir_dbug %{_usrsrc}/kernels/%{kver_dbug} - %else - %define kdir_kern %{kdir} - %define kdir_dbug %{kdir}.debug - %endif - - %if %{undefined kobj} - %define kobj_kern %{kdir_kern} - %define kobj_dbug %{kdir_dbug} - %else - %define kobj_kern %{kobj} - %define kobj_dbug %{kobj}.debug - %endif -%else - -# Unsupported distro: - %if %{undefined kver} - %define kver_kern %(uname -r) - %define kver_dbug %{nil} - %else - %define kver_kern %{kver} - %define kver_dbug %{nil} - %endif - - %define kverpkg_kern %{kver_kern} - %define kverpkg_dbug %{nil} - %define kverpkg_dkms %{nil} - - %if %{undefined kdir} - %define kdir_kern /lib/modules/%{kver_kern}/build - %define kdir_dbug %{nil} - %else - %define kdir_kern %{kdir} - %define kdir_dbug %{nil} - %endif - - %if %{undefined kobj} - %define kobj_kern %{kdir_kern} - %define kobj_dbug %{nil} - %else - %define kobj_kern %{kobj} - %define kobj_dbug %{nil} - %endif - -%endif -%endif -%endif - -# Distro agnostic: -%define name @PACKAGE@-modules -%define version @VERSION@ - -# The kernel version should only be appended to a binary RPM. When -# building a source RPM it must be kernel version agnostic. This means -# the source RPM must never specify a required kernel version, but the -# final RPM should be keyed to the kernel version it was built against. -%if %{defined build_src_rpm} -%define rel_kern @SPL_META_RELEASE@ -%define rel_dbug @SPL_META_RELEASE@ -%define rel_dkms @SPL_META_RELEASE@ -%if %{defined kpkg_kern} -%define req_kern %{kpkg_kern} -%endif -%if %{defined kpkg_dbug} -%define req_dbug %{kpkg_dbug} -%endif -%if %{defined kpkg_dkms} -%define req_dkms %{kpkg_dkms} -%endif -%if %{defined kdevpkg_kern} -%define devreq_kern %{kdevpkg_kern} -%endif -%if %{defined kdevpkg_dbug} -%define devreq_dbug %{kdevpkg_dbug} -%endif -%else -%define relext_kern %(echo %{kverpkg_kern} | %{__sed} -e 's/-/_/g') -%define relext_dbug %(echo %{kverpkg_dbug} | %{__sed} -e 's/-/_/g') -%define rel_kern @SPL_META_RELEASE@_%{relext_kern} -%define rel_dbug @SPL_META_RELEASE@_%{relext_dbug} -%define rel_dkms @SPL_META_RELEASE@ -%if %{defined kpkg_kern} -%define req_kern %{kpkg_kern} %{koppkg} %{kverpkg_kern} -%endif -%if %{defined kpkg_dbug} -%define req_dbug %{kpkg_dbug} %{koppkg} %{kverpkg_dbug} -%endif -%if %{defined kpkg_dkms} -%define req_dkms %{kpkg_dkms} >= %{kverpkg_dkms} -%endif -%if %{defined kdevpkg_kern} -%define devreq_kern %{kdevpkg_kern} %{koppkg} %{kverpkg_kern} -%endif -%if %{defined kdevpkg_dbug} -%define devreq_dbug %{kdevpkg_dbug} %{koppkg} %{kverpkg_dbug} -%endif -%endif - - -Summary: Solaris Porting Layer Modules -Group: Utilities/System -Name: %{name} -Version: %{version} -Release: %{rel_kern} -License: @LICENSE@ -URL: git://github.com/zfsonlinux/spl.git -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id} -un) -Source: @PACKAGE@-%{version}.tar.gz - -%if %{?with_kernel} - -%if %{defined req_kern} -Requires: %{req_kern} -%endif -%if %{defined kdevpkg_kern} -BuildRequires: %{kdevpkg_kern} -%endif - -%endif - -%description -The %{name} package contains kernel modules for emulating Solaris style -primatives in the linux kernel. These include, but are not limited to: -atomic, condvar, debug, error, memory, kobject, kstat, mutex, rwlock, -taskq, thread, time, and vnode APIs. - -%if %{?with_kernel} - -%package devel -Summary: Solaris Porting Layer Headers and Symbols -Group: Development/Libraries -Release: %{rel_kern} -%if %{defined devreq_kern} -Requires: %{devreq_kern} -%endif -%if %{defined kdevpkg_kern} -BuildRequires: %{kdevpkg_kern} -%endif - -%description devel -The %{name}-devel package contains the header files and Module{s}.symvers -symbols needed for building additional modules which use %{name}. - -%endif -%if %{?with_kernel_debug} - -%package debug -Summary: Solaris Porting Layer Debug Modules -Group: Utilities/System -Release: %{rel_dbug} -%if %{defined req_dbug} -Requires: %{req_dbug} -%endif -%if %{defined kdevpkg_dbug} -BuildRequires: %{kdevpkg_dbug} -%endif - -%description debug -The %{name}-debug package contains kernel modules for emulating Solaris -style primatives in the linux kernel. These include, but are not limited -to: atomic, condvar, debug, error, memory, kobject, kstat, mutex, -rwlock, taskq, thread, time, and vnode APIs. - -%package debug-devel -Summary: Solaris Porting Layer Debug Headers and Symbols -Group: Development/Libraries -Release: %{rel_dbug} -%if %{defined devreq_dbug} -Requires: %{devreq_dbug} -%endif -%if %{defined kdevpkg_dbug} -BuildRequires: %{kdevpkg_dbug} -%endif - -%description debug-devel -The %{name}-debug-devel package contains the header files and -Module{s}.symvers symbols needed for building additional modules which -use %{name}-debug. - -%endif -%if %{?with_kernel_dkms} - -%package dkms -Summary: Solaris Porting Layer Modules (DKMS) -Group: Utilities/System -Release: %{rel_dkms} -Provides: %{name} -BuildArch: noarch -%if %{defined req_dkms} -Requires: %{req_dkms} -%endif -%if %{defined kdevpkg_dkms} -BuildRequires: %{kdevpkg_dkms} -%endif - -%description dkms -The %{name}-dkms package contains all the necessary pieces to build and -install Solaris Porting Layer (SPL) kernel modules with Dynamic Kernel -Modules Support (DKMS). The SPL modules emulate Solaris style primatives -in the the linux kernel. They include, but are not limited to: atomic, -condvar, debug, error, memory, kobject, kstat, mutex, rwlock, taskq, -thread, time, and vnode APIs. - -%endif - -%prep -%setup -n @PACKAGE@-%{version} -%build -rm -rf $RPM_BUILD_ROOT - -%if %{?with_kernel} - -%configure --with-config=kernel \ - --with-linux=%{kdir_kern} --with-linux-obj=%{kobj_kern} \ - %{kdebug} %{kdebug_log} %{kdebug_kmem} %{kdebug_kmem_tracking} -make -make DESTDIR=$RPM_BUILD_ROOT install - -%endif -%if %{?with_kernel_debug} - -%configure --with-config=kernel \ - --with-linux=%{kdir_dbug} --with-linux-obj=%{kobj_dbug} \ - %{kdebug} %{kdebug_log} %{kdebug_kmem} %{kdebug_kmem_tracking} -make -make DESTDIR=$RPM_BUILD_ROOT install - -%endif -%if %{?with_kernel_dkms} - -%configure --with-config=kernel \ - %{kdebug} %{kdebug_log} %{kdebug_kmem} %{kdebug_kmem_tracking} -make dist -mkdir -p $RPM_BUILD_ROOT/%{_prefix}/src -tar -xf @PACKAGE@-%{version}.tar.gz -C $RPM_BUILD_ROOT/%{_prefix}/src -cp -af dkms.conf $RPM_BUILD_ROOT/%{_prefix}/src/@PACKAGE@-%{version} - -%endif - -%clean -rm -rf $RPM_BUILD_ROOT - -%if %{?with_kernel} - -%files -%defattr(-, root, root) -/lib/modules/%{kver_kern}/* - -%files devel -%defattr(-,root,root) -%{_prefix}/src/*/%{kver_kern} - -%post -if [ -f /boot/System.map-%{kver_kern} ]; then - /sbin/depmod -ae -F /boot/System.map-%{kver_kern} %{kver_kern} || exit 0 -else - /sbin/depmod -a || exit 0 -fi - -%postun -if [ -f /boot/System.map-%{kver_kern} ]; then - /sbin/depmod -ae -F /boot/System.map-%{kver_kern} %{kver_kern} || exit 0 -else - /sbin/depmod -a || exit 0 -fi - -%postun devel -rmdir %{_prefix}/src/@PACKAGE@-%{version}-@SPL_META_RELEASE@ 2>/dev/null -exit 0 - -%endif -%if %{?with_kernel_debug} - -%files debug -%defattr(-, root, root) -/lib/modules/%{kver_dbug}/* - -%files debug-devel -%defattr(-,root,root) -%{_prefix}/src/*/%{kver_dbug} - -%post debug -if [ -f /boot/System.map-%{kver_dbug} ]; then - /sbin/depmod -ae -F /boot/System.map-%{kver_dbug} %{kver_dbug} || exit 0 -else - /sbin/depmod -a || exit 0 -fi - -%postun debug -if [ -f /boot/System.map-%{kver_dbug} ]; then - /sbin/depmod -ae -F /boot/System.map-%{kver_dbug} %{kver_dbug} || exit 0 -else - /sbin/depmod -a || exit 0 -fi - -%postun debug-devel -rmdir %{_prefix}/src/@PACKAGE@-%{version}-@SPL_META_RELEASE@ 2>/dev/null -exit 0 - -%endif -%if %{?with_kernel_dkms} - -%files dkms -%defattr(-,root,root) -%{_prefix}/src/@PACKAGE@-%{version} - -%post dkms -for POSTINST in %{_prefix}/lib/dkms/common.postinst; do - if [ -f $POSTINST ]; then - $POSTINST @PACKAGE@ %{version} - exit $? - fi - echo "WARNING: $POSTINST does not exist." -done -echo -e "ERROR: DKMS version is too old and @PACKAGE@ was not" -echo -e "built with legacy DKMS support." -echo -e "You must either rebuild @PACKAGE@ with legacy postinst" -echo -e "support or upgrade DKMS to a more current version." -exit 1 - -%preun dkms -echo -e -echo -e "Uninstall of @PACKAGE@ module (version %{version}) beginning:" -dkms remove -m @PACKAGE@ -v %{version} --all --rpm_safe_upgrade -exit 0 - -%endif diff --git a/spl.spec.in b/spl.spec.in deleted file mode 100644 index 712c3879d..000000000 --- a/spl.spec.in +++ /dev/null @@ -1,39 +0,0 @@ -%define name @PACKAGE@ -%define version @VERSION@ -%define release @SPL_META_RELEASE@ -%define debug_package %{nil} - -Summary: SPL Utils -Group: Utilities/System -Name: %{name} -Version: %{version} -Release: %{release}%{?dist} -License: @LICENSE@ -URL: git://github.com/zfsonlinux/spl.git -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id} -un) -Source: %{name}-%{version}.tar.gz -Requires: spl-modules - -%description -The %{name} package contains the support utilities for the spl. - -%prep -%setup -%build -%configure --with-config=user -make - -%install -rm -rf $RPM_BUILD_ROOT -make DESTDIR=$RPM_BUILD_ROOT install - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-, root, root) -%doc AUTHORS COPYING DISCLAIMER -%{_sbindir}/* - -%post -%postun |