debian: Apply Ubuntu patch to add DKMS support.
authorChuck Short <zulcss@ubuntu.com>
Tue, 23 Aug 2011 22:37:11 +0000 (15:37 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 25 Aug 2011 17:24:59 +0000 (10:24 -0700)
I tested that installing openvswitch-datapath-dkms worked OK on my own
Debian machine.

The bulk of this patch is taken from downstream Ubuntu DKMS support written
by Chuck Short <zulcss@ubuntu.com>, version 1.2.0-1ubuntu1.  I made the
following changes:

  * Update debian/.gitignore.

  * Update debian/automake.mk.

  * Correct description in debian/control (it was a cut-and-paste from
    the openvswitch-datapath-source description without editing).

  * Fix up for --with-l26 to --with-linux and datapath/linux-2.6 to
    datapath/linux transitions.

CC: Chuck Short <zulcss@ubuntu.com>
CC: Dave Walker <DaveWalker@ubuntu.com>
Acked-by: Simon Horman <horms@verge.net.au>
AUTHORS
debian/.gitignore
debian/automake.mk
debian/control
debian/dkms.conf.in [new file with mode: 0644]
debian/openvswitch-datapath-dkms.postinst [new file with mode: 0644]
debian/openvswitch-datapath-dkms.prerm [new file with mode: 0644]
debian/rules

diff --git a/AUTHORS b/AUTHORS
index f6206979054b0faea88a2d13f91a161362cda0d2..44311ffb616d8e4a858b5fbee16011189ae58b32 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -7,6 +7,7 @@ Andy Southgate          andy.southgate@citrix.com
 Ben Pfaff               blp@nicira.com
 Bryan Phillippe         bp@toroki.com
 Casey Barker            crbarker@google.com
+Chuck Short             zulcss@ubuntu.com
 Dan Wendlandt           dan@nicira.com
 David Erickson          derickso@stanford.edu
 Ethan Jackson           ethan@nicira.com
index 7b8dffea35ff1cd9297fece2807020cfa1f76d58..7e6d65626f402093da8c5817e8595dc8aa5b57e6 100644 (file)
@@ -11,6 +11,7 @@
 /openvswitch-common.copyright
 /openvswitch-controller
 /openvswitch-datapath-source
+/openvswitch-datapath-dkms
 /openvswitch-dbg
 /openvswitch-ipsec
 /openvswitch-pki
index 7e166ddca97c5c9200702a557da6d51146abf767..d2898301affc0986b64b93012df707f66b8e29ee 100644 (file)
@@ -5,6 +5,7 @@ EXTRA_DIST += \
        debian/control.modules.in \
        debian/copyright \
        debian/copyright.in \
+       debian/dkms.conf.in \
        debian/dirs \
        debian/openvswitch-brcompat.install \
        debian/openvswitch-brcompat.manpages \
@@ -20,6 +21,8 @@ EXTRA_DIST += \
        debian/openvswitch-controller.manpages \
        debian/openvswitch-controller.postinst \
        debian/openvswitch-datapath-module-_KVERS_.postinst.modules.in \
+       debian/openvswitch-datapath-dkms.postinst \
+       debian/openvswitch-datapath-dkms.prerm \
        debian/openvswitch-datapath-source.README.Debian \
        debian/openvswitch-datapath-source.copyright \
        debian/openvswitch-datapath-source.dirs \
index 1d09d94bda7324278ec0ed15b48d602302b2591f..8b3e7bf9fcc21e518b2207cd3fb8b9edeb5104e6 100644 (file)
@@ -15,7 +15,7 @@ Package: openvswitch-datapath-source
 Architecture: all
 Depends: module-assistant, bzip2, debhelper (>= 5.0.37), ${misc:Depends}
 Suggests: openvswitch-switch
-Description: Source code for Open vSwitch datapath Linux module
+Description: Open vSwitch datapath module source - module-assistant version
  This package provides the Open vSwitch datapath module source code
  that is needed by openvswitch-switch.  The kernel module can be built
  from it using module-assistant or make-kpkg.  README.Debian in this
@@ -23,6 +23,14 @@ Description: Source code for Open vSwitch datapath Linux module
  .
  Open vSwitch is a full-featured software-based Ethernet switch.
 
+Package: openvswitch-datapath-dkms
+Architecture: all
+Depends: dkms (>= 1.95), make, ${misc:Depends}
+Description: Open vSwitch datapath module source - DKMS version
+ This package provides the Open vSwitch datapath module source code
+ that is needed by openvswitch-switch.  DKMS can built the kernel
+ module from it.
+
 Package: openvswitch-common
 Architecture: linux-any
 Depends: ${shlibs:Depends}, openssl, ${misc:Depends}, python
diff --git a/debian/dkms.conf.in b/debian/dkms.conf.in
new file mode 100644 (file)
index 0000000..56c6398
--- /dev/null
@@ -0,0 +1,9 @@
+PACKAGE_NAME="openvswitch"
+PACKAGE_VERSION="__VERSION__"
+MAKE="./configure --with-linux=/usr/src/linux-headers-`uname -r` ; make -C datapath/linux"
+BUILT_MODULE_NAME[0]=openvswitch_mod
+BUILT_MODULE_NAME[1]=brcompat_mod
+BUILT_MODULE_LOCATION[0]=datapath/linux/
+BUILT_MODULE_LOCATION[1]=datapath/linux/
+DEST_MODULE_LOCATION[0]=/kernel/drivers/net/openvswitch/
+DEST_MODULE_LOCATION[1]=/kernel/drivers/net/openvswitch/
diff --git a/debian/openvswitch-datapath-dkms.postinst b/debian/openvswitch-datapath-dkms.postinst
new file mode 100644 (file)
index 0000000..4903119
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+package=openvswitch-datapath-dkms
+name=openvswitch
+
+version=`dpkg-query -W -f='${Version}' "$package" \
+        |rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n"`
+
+isadded=`dkms status -m "$name" -v "$version"`
+
+if [ "x${isadded}" = "x" ] ; then
+        dkms add -m "$name" -v "$version"
+fi
+
+if [ "$1" = 'configure' ] ; then
+        dkms build -m "$name" -v "$version" && dkms install -m "$name" -v "$version" || true
+fi
+
+#DEBHELPER#
diff --git a/debian/openvswitch-datapath-dkms.prerm b/debian/openvswitch-datapath-dkms.prerm
new file mode 100644 (file)
index 0000000..5c8ad31
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+package=openvswitch-datapath-dkms
+name=openvswitch
+
+version=`dpkg-query -W -f='${Version}' "$package" \
+        |rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n"`
+
+dkms remove -m "$name" -v "$version" --all || true
+
+#DEBHELPER#
+
+exit 0
index 37d321b7d183fb947470babece4abcf6c8b8d7a0..fb781e6c3b28a6a371b29927fb2fc21b20ff51fe 100755 (executable)
 # Official build number.  Leave set to 0 if not an official build.
 BUILD_NUMBER = 0
 
+PACKAGE=openvswitch
+pdkms=openvswitch-datapath-dkms
+DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p')
+srcfiles := $(filter-out debian, $(wildcard * .[^.]*))
+
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
 PARALLEL = -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
 else
@@ -82,6 +87,16 @@ install-indep: build-indep
        chmod 755 debian/openvswitch-datapath-source/usr/src/modules/openvswitch-datapath/debian/rules
        cd debian/openvswitch-datapath-source/usr/src && tar -c modules | bzip2 -9 > openvswitch-datapath.tar.bz2 && rm -rf modules
 
+       #dkms stuff
+       # setup the dirs
+       dh_installdirs -p$(pdkms) usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)
+
+       # copy the source
+       cd debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION) && tar xvzf $(CURDIR)/_debian/openvswitch.tar.gz && mv openvswitch/* . && rmdir openvswitch
+
+       # Prepare dkms.conf from the dkms.conf.in template
+       sed "s/__VERSION__/$(DEB_UPSTREAM_VERSION)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/dkms.conf
+
 install-arch: build-arch
        dh_testdir
        dh_testroot