From 12ba56f1b7c2fd15ff3a6ee7418128647b3af3ec Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Sun, 1 May 2005 00:40:06 +0000 Subject: [PATCH] * Overhaul the module build rules. - Use debhelper to build the module binary package. - Let debhelper handle the module postinst and prerm control scripts. - Properly support modules_config and modules_clean. - Break the build process into configure, build, install, and binary rules, paralleling the regular build rules and making it easier to maintain the make-kpkg build targets. - Include the kernel version in the long description. - Update standards version of module packages to 3.6.1. - Include the copyright and basic documentation in the module binary package. Otherwise, policy requires an exact versioned dependency on the package containing the copyright file. Also note that the logic to turn off optimization when requested doesn't work as documented in the configure script. --- debian/changelog | 15 ++++- debian/control | 2 +- debian/control.module | 5 +- debian/control.module-image | 6 +- debian/postinst.mod | 5 -- debian/prerm.mod | 2 - debian/rules | 115 ++++++++++++++++++------------------ 7 files changed, 79 insertions(+), 71 deletions(-) delete mode 100644 debian/postinst.mod delete mode 100644 debian/prerm.mod diff --git a/debian/changelog b/debian/changelog index 1aff286f4..cb5825b6d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,10 +4,23 @@ openafs (1.3.81-5) unstable; urgency=low or ext3 and that XFS and ReiserFS will not work. upserver and upclient are now provided. Provide some information about why kaserver is not provided. (Closes: #249315) + * Overhaul the module build rules. + - Use debhelper to build the module binary package. + - Let debhelper handle the module postinst and prerm control scripts. + - Properly support modules_config and modules_clean. + - Break the build process into configure, build, install, and binary + rules, paralleling the regular build rules and making it easier to + maintain the make-kpkg build targets. + - Include the kernel version in the long description. + - Update standards version of module packages to 3.6.1. + - Include the copyright and basic documentation in the module binary + package. Otherwise, policy requires an exact versioned dependency + on the package containing the copyright file. * Update standards version to 3.6.1. - Install Debian::OpenAFS::ConfigUtils in /usr/share, not /usr/lib. - Always enable debugging symbols and disable optimization if noopt is - set in DEB_BUILD_OPTIONS. + set in DEB_BUILD_OPTIONS. (Alas, this doesn't entirely work; the + upstream makefiles don't always honor the configure options.) - /etc/init.d/openafs-fileserver restart starts bosserver if it's not already running. diff --git a/debian/control b/debian/control index be2212e6d..f79aec182 100644 --- a/debian/control +++ b/debian/control @@ -76,7 +76,7 @@ Description: The AFS distributed filesystem- development libraries Package: openafs-modules-source Priority: extra -Depends: bison, flex, debhelper, libpam0g-dev, libncurses5-dev, kernel-package, e2fslibs-dev +Depends: bison, flex, debhelper (>= 4.0.0), libpam0g-dev, libncurses5-dev, kernel-package, e2fslibs-dev Architecture: all Description: The AFS distributed filesystem- Module Sources AFS is a distributed filesystem allowing cross-platform sharing of diff --git a/debian/control.module b/debian/control.module index c72c5a6ed..c32426a75 100644 --- a/debian/control.module +++ b/debian/control.module @@ -2,7 +2,7 @@ Source: openafs Section: net Priority: optional Maintainer: Sam Hartman -Standards-Version: 3.1.1 +Standards-Version: 3.6.1 Package: openafs-modules-=KVERS Conflicts: openafs-client (<< 1.2.9) @@ -13,4 +13,5 @@ Description: The AFS distributed filesystem- Kernel Module files among multiple computers. Facilities are provided for access control, authentication, backup and administrative management. . - This package provides the kernel module for the filesystem + This package provides the compiled AFS kernel module for kernel + =KVERS. diff --git a/debian/control.module-image b/debian/control.module-image index f1aaf3392..f1bb6d44f 100644 --- a/debian/control.module-image +++ b/debian/control.module-image @@ -2,7 +2,7 @@ Source: openafs Section: net Priority: optional Maintainer: Sam Hartman -Standards-Version: 3.1.1 +Standards-Version: 3.6.1 Package: openafs-modules-=KVERS Conflicts: openafs-client (<< 1.2.9) @@ -14,4 +14,6 @@ Description: The AFS distributed filesystem- Kernel Module files among multiple computers. Facilities are provided for access control, authentication, backup and administrative management. . - This package provides the kernel module for the filesystem + This package provides the compiled AFS kernel module for kernel + =KVERS. + diff --git a/debian/postinst.mod b/debian/postinst.mod deleted file mode 100644 index cfb292bfe..000000000 --- a/debian/postinst.mod +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -e - -update-modules - -exit 0 diff --git a/debian/prerm.mod b/debian/prerm.mod deleted file mode 100644 index f11f4e184..000000000 --- a/debian/prerm.mod +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -e -exit 0 diff --git a/debian/rules b/debian/rules index 4d85307ad..d76a51d27 100755 --- a/debian/rules +++ b/debian/rules @@ -26,9 +26,6 @@ endif # The AFS sysname is determined by a script KVERS=`perl -e '$$_ = <>; $$_ =~ m/"(.+)"/; print "$$1\n";' < $(KSRC)/include/linux/version.h` SYS_NAME=$(shell KVERS=$(KVERS) sh debian/sysname) -package=openafs -srcpkg = openafs-modules-source -modulepkg=$(shell echo openafs-modules-$(KVERS)${INT_SUBARCH}) ifndef KSRC KSRC=/usr/src/linux endif @@ -39,6 +36,11 @@ export KSRC export KVERS export KPKG_DEST_DIR +package = openafs +srcpkg = openafs-modules-source +modulepkg = $(shell echo openafs-modules-$(KVERS)${INT_SUBARCH}) +moduledir = debian/$(modulepkg)/lib/modules/$(KVERS)/fs + LINTIAN_PACKAGES= openafs-client openafs-fileserver configure: configure-stamp @@ -70,7 +72,8 @@ build-stamp: clean: dh_testdir dh_testroot - rm -f build-stamp configure-stamp build-modules-stamp + rm -f build-stamp configure-stamp configure-modules-stamp + rm -f build-modules-stamp # Add here commands to clean up after the build process. -$(MAKE) -ki distclean -rm -rf obj dest $(SYS_NAME) @sys Makefile debian/openafs-client.init @@ -180,25 +183,25 @@ binary-arch: build install dh_md5sums dh_builddeb -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure +binary: binary-indep binary-arch ############################Module package support -kdist_image: build-modules + +kdist_configure: configure-modules-stamp + +kdist_image: build-modules-stamp $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules binary-modules $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean -kdist: build-modules - $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules KERNEL_DEPENDS=y binary-modules +kdist: build-modules-stamp + $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules KERNEL_DEPENDS=y \ + binary-modules KSRC="$(KSRC)" KMAINT="$(KMAINT)" KEMAIL="$(KEMAIL)" \ - sh -v debian/genchanges.sh + sh -v debian/genchanges.sh $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean - - -kdist_config: configure - -kdist_clean: clean +kdist_clean: + $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean ############################ source stuff ################################# binary-source: @@ -234,58 +237,54 @@ binary-source: chmod 644 debian/$(srcpkg)/usr/src/$(package).tar.gz ############################ modules stuff ################################# -build-modules: build-modules-stamp - -build-modules-stamp: +configure-modules: configure-modules-stamp +configure-modules-stamp: +ifeq ($(KERNEL_DEPENDS),y) + sh debian/prep-modules $(KSRC) debian/control.module > debian/control +else + sh debian/prep-modules $(KSRC) debian/control.module-image > debian/control +endif -ln -s @sys/dest dest -ln -s $(SYS_NAME) @sys sh configure --with-afs-sysname=$(SYS_NAME) \ --with-linux-kernel-headers=$(KSRC) --prefix=`pwd`/debian/tmp \ --enable-debug --enable-lwp-debug --enable-kernel-debug \ $(DEBIAN_OPT_FLAGS) $(DEBIAN_KERN_FLAGS) + touch configure-modules-stamp + +build-modules: build-modules-stamp +build-modules-stamp: configure-modules-stamp make only_libafs - cd src/libafs&&make install touch build-modules-stamp -binary-modules: build-modules -# Perform some tests - test -f debian/rules - test `id -u` = "0" - -# Setup everything first - -rm -rf debian/$(modulepkg) debian/substvars - install -d debian/$(modulepkg) - -# Install the software - install -d -g root -o root -m 755 debian/$(modulepkg)/lib/modules/$(KVERS)/fs - install -g root -o root -m 755 debian/tmp/lib/openafs/*o \ - debian/$(modulepkg)/lib/modules/$(KVERS)/fs -# Fix some stuff up - if test -f debian/$(modulepkg)/lib/modules/$(KVERS)/fs/openafs.o -a ! -f debian/$(modulepkg)/lib/modules/$(KVERS)/fs/openafs.mp.o; then ln debian/$(modulepkg)/lib/modules/$(KVERS)/fs/openafs.o debian/$(modulepkg)/lib/modules/$(KVERS)/fs/openafs.mp.o; fi - install -d -o root -g root -m 755 debian/$(modulepkg)/usr/share/doc - ln -s openafs-client debian/$(modulepkg)/usr/share/doc/$(modulepkg) +install-modules: build-modules-stamp + dh_testdir + dh_testroot + dh_clean -k + cd src/libafs && make install + install -d -g root -o root -m 755 $(moduledir) + install -g root -o root -m 755 debian/tmp/lib/openafs/*o $(moduledir)/ + if test -f $(moduledir)/openafs.o \ + -a ! -f $(moduledir)/openafs.mp.o ; then \ + ln $(moduledir)/openafs.o $(moduledir)/openafs.mp.o || exit 1 ; \ + fi rm -rf debian/$(modulepkg)/usr/include -ifeq ($(KERNEL_DEPENDS),y) - sh debian/prep-modules $(KSRC) debian/control.module > debian/control -else - sh debian/prep-modules $(KSRC) debian/control.module-image > debian/control -endif - -# Install control files - install -d -o root -g root -m 755 debian/$(modulepkg)/DEBIAN - install -p -o root -g root -m 755 debian/prerm.mod \ - debian/$(modulepkg)/DEBIAN/prerm - install -p -o root -g root -m 755 debian/postinst.mod \ - debian/$(modulepkg)/DEBIAN/postinst -# And now.. for the final packaging! - find debian/$(modulepkg) -type f | grep -v "./DEBIAN" | xargs md5sum | \ - sed -e 's#debian/$(modulepkg)/##' > debian/$(modulepkg)/DEBIAN/md5sums +binary-modules: install-modules + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installmodules + dh_strip + dh_link + dh_compress + dh_fixperms + dh_installdeb + dh_gencontrol -- -v`cat debian/VERSION` + dh_md5sums + dh_builddeb --destdir="$(KPKG_DEST_DIR)" - dpkg-gencontrol -isp \ - -p$(modulepkg) \ - -v`cat debian/VERSION` \ - -Pdebian/$(modulepkg) - chown -R root.root debian/$(modulepkg) - chmod -R go=rX debian/$(modulepkg) - dpkg --build debian/$(modulepkg) $(KPKG_DEST_DIR) +.PHONY: build clean binary-indep binary-arch binary install configure +.PHONY: kdist_configure kdist_image kdist kdist_clean binary-source +.PHONY: configure-modules build-modules install-modules binary-modules -- 2.39.5