]> git.proxmox.com Git - mirror_spl-debian.git/commitdiff
Fix and improve the generation of the stripped kernel source tree
authorCarlos Alberto Lopez Perez <clopez@igalia.com>
Tue, 2 Apr 2013 21:00:01 +0000 (23:00 +0200)
committerCarlos Alberto Lopez Perez <clopez@igalia.com>
Tue, 2 Apr 2013 21:10:35 +0000 (23:10 +0200)
  * Commit 493972c8 broke the rules used for the generation of the
    stripped kernel source tree because of the requirement of the
    rpm directory to be present for CONFIG_KERNEL
    (which is clearly not required for us).

  * Add a new rule to sed Makefile.am and manually set "SUBDIRS" to
    "module include" for CONFIG_KERNEL and remove it for the other
    configs.

    * This has the benefit that now running ./configure --with-config=user
    && make in the DKMS source tree is a nop while before it gave
    an error.

  * Improve the robustness of the rules by ensuring that they will
    abort if something is not as expected.

debian/rules

index 652d1efba2d863cc72146e1e974dbd7602098154..e9380d9aa5d1c896fb4f3181fc708546e7363d13 100755 (executable)
@@ -4,8 +4,8 @@ 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
+DKMSFILES := module include config spl.release.in autogen.sh \
+               META AUTHORS DISCLAIMER
 
 %:
        dh $@ --with dkms
@@ -19,7 +19,7 @@ override_dh_auto_configure:
 
        @# Build the userland, but don't build the kernel modules.
        ./configure --prefix=/usr --with-config=user
-       
+
 override_dh_auto_test:
        # scripts/check.sh tries insmod and rmmod, so it cannot
        # run in an unprivileged build environment.
@@ -35,15 +35,20 @@ override_dh_auto_install:
        # 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)';)
+       $(foreach file,$(DKMSFILES),mv '$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)' || exit 1;)
        @# 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$)
+       @#        (Makefile$|include/|module/|*.release$)
        @#  * 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}' \
+       awk '/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|spl\.release([ \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)'
+       @# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
+       sed '1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
+               '$(CURDIR)/$(NAME)-$(VERSION)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
+       @# Sanity test
+       grep -q 'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
+       @# Run autogen on the stripped source tree
        cd '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; ./autogen.sh
        rm -fr '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache'