Skip to content

Commit

Permalink
Refresh RPM packaging
Browse files Browse the repository at this point in the history
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.

  https://fedoraproject.org/wiki/Packaging:Guidelines
  https://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 openzfs#222
  • Loading branch information
behlendorf committed Mar 18, 2013
1 parent 4a6d8d2 commit 493972c
Show file tree
Hide file tree
Showing 26 changed files with 1,139 additions and 730 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
20 changes: 9 additions & 11 deletions config/deb.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
90 changes: 32 additions & 58 deletions config/rpm.am
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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) \
Expand All @@ -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) \
Expand All @@ -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)
34 changes: 34 additions & 0 deletions config/spl-build.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -256,13 +261,42 @@ 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)
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 #
Expand Down
3 changes: 3 additions & 0 deletions config/spl-meta.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 9 additions & 11 deletions config/tgz.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 9 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 0 additions & 23 deletions dkms.conf.in

This file was deleted.

1 change: 1 addition & 0 deletions rpm/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBDIRS = fedora generic
3 changes: 3 additions & 0 deletions rpm/fedora/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/spl-dkms.spec
/spl-kmod.spec
/spl.spec
1 change: 1 addition & 0 deletions rpm/fedora/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EXTRA_DIST = spl.spec.in spl-kmod.spec.in spl-dkms.spec.in
1 change: 1 addition & 0 deletions rpm/fedora/spl-dkms.spec.in
Loading

0 comments on commit 493972c

Please sign in to comment.