]> git.proxmox.com Git - mirror_spl-debian.git/commitdiff
Explicity select what is copied inside the DKMS source tree
authorCarlos Alberto Lopez Perez <clopez@igalia.com>
Wed, 20 Feb 2013 22:06:48 +0000 (23:06 +0100)
committerCarlos Alberto Lopez Perez <clopez@igalia.com>
Wed, 20 Feb 2013 22:06:48 +0000 (23:06 +0100)
 * We use the variable DKMSFILES to explicity select wich files
   or directories are copied inside the DKMS source tree.

 * Once copied. We rewrite configure.ac with awk to remove the
   userland/misc components and only keep the kernel stuff that
   is needed by DKMS.

   * The awk lines deletes from inside AC_CONFIG_FILES([]) of configure.ac
     everything except:
(Makefile$|include/|module/|*.release$|dkms.conf$)

   * Then we run ./autogen.sh to generate the configure scripts
     inside the DKMS source tree

 * This allows us to ship a clean DKMS source tree with *only* the kernel
   components and free from the userland/misc ones (ex: splat)

    * Prevents manual build on the DKMS source tree.

debian/rules

index d5b53e3b2c1ef0d6a74feab3e7ce975de73e8545..7066fe363706178a114853d377c0a625af229a3e 100755 (executable)
@@ -4,6 +4,9 @@ NAME := $(shell awk '$$1 == "Name:" { print $$2; }' META)
 VERSION := $(shell dpkg-parsechangelog \
   | awk '$$1 == "Version:" { print $$2; }' | cut -d- -f1)
 
+DKMSFILES := module include config Makefile.in autogen.sh dkms.conf.in \
+                       spl.release.in META spl_config.h AUTHORS DISCLAIMER
+
 %:
        dh $@ --with dkms
 
@@ -34,18 +37,26 @@ override_dh_auto_install:
        @# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree.
        $(MAKE) distdir
 
-       @# Delete boilerplate to satisfy the lintian extra-license-file check.
-       rm '$(CURDIR)/$(NAME)-$(VERSION)/COPYING'
+       # Install the DKMS source.
+       @# We only want the files needed to build the modules
+       mkdir -p '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
+       $(foreach file,$(DKMSFILES),mv '$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)';)
+       @# Hellish awk line:
+       @#  * Deletes from configure.ac the parts not needed for building the kernel module
+       @#     * It deletes from inside AC_CONFIG_FILES([]) everything except:
+       @#        (Makefile$|include/|module/|*.release$|dkms.conf$)
+       @#  * Takes care of spaces and tabs
+       awk '/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|spl\.release([ \t]+)?$$|dkms\.conf([ \t]+)?$$))/){next} } {print}' \
+               '$(CURDIR)/$(NAME)-$(VERSION)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/configure.ac'
+       cp '$(CURDIR)/autogen.sh' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
+       cd '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; ./autogen.sh
+       rm -fr '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache'
 
        @# This shunt allows DKMS to install the Module.symvers and spl_config.h
        @# files to the ${dkms_tree} area through the POST_INSTALL directive.
-       echo '#!/bin/sh'  >'$(CURDIR)/$(NAME)-$(VERSION)/cp'
-       echo 'cp "$$@"'  >>'$(CURDIR)/$(NAME)-$(VERSION)/cp'
-       chmod 755 '$(CURDIR)/$(NAME)-$(VERSION)/cp'
-
-       # Install the DKMS source.
-       mkdir -p '$(CURDIR)/debian/tmp/usr/src/'
-       mv '$(CURDIR)/$(NAME)-$(VERSION)' '$(CURDIR)/debian/tmp/usr/src/'
+       echo '#!/bin/sh'  >'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
+       echo 'cp "$$@"'  >>'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
+       chmod 755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
 
 override_dh_dkms:
        dh_dkms -V $(VERSION)