xenserver: Fix build spec for XenServer 6.5.
authorEdwin Chiu <echiu@vmware.com>
Tue, 10 Mar 2015 18:36:43 +0000 (11:36 -0700)
committerAlex Wang <alexw@nicira.com>
Tue, 10 Mar 2015 22:36:06 +0000 (15:36 -0700)
The latest XenServer 6.5 uses a new way for kernel version naming.
Therein, the kernel flavor could not be found anymore.  Also, the
directory name in 'lib/modules/' becomes a shortened version of
kernel version. e.g.:

[root@localhost ~]# ls /lib/modules/
3.10.0+2

As a workaround, this commit modifies the spec file to make
%{kernel_flavor} optional and %{xen_version} definable by users.
In the long run, I'd like to spend time refining the spec file.

Signed-off-by: Edwin Chiu <echiu@vmware.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
AUTHORS
INSTALL.XenServer.md
xenserver/openvswitch-xen.spec.in

diff --git a/AUTHORS b/AUTHORS
index 6e8b4da..fd3749a 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -229,7 +229,7 @@ David Palma             palma@onesource.pt
 Derek Cormier           derek.cormier@lab.ntt.co.jp
 Dhaval Badiani          dbadiani@vmware.com
 DK Moon                 dkmoon@nicira.com
-Edwin Chiu              echiu@nicira.com
+Edwin Chiu              echiu@vmware.com
 Eivind Bulie Haanaes
 Eric Lopez              elopez@nicira.com
 Frido Roose             fr.roose@gmail.com
index 62c76b9..072a9f2 100644 (file)
@@ -80,6 +80,28 @@ where:
     The "xen" flavor is the main running kernel flavor and the "kdump" flavor is
     the crashdump kernel flavor. Commonly, one would specify "xen" here.
 
+For XenServer 6.5 or above, the kernel version naming no longer contains
+KERNEL_FLAVOR.  Correspondingly, the the final "rpmbuild" step changes to:
+
+   ```
+   VERSION=<Open vSwitch version>
+   KERNEL_NAME=<Xen Kernel name>
+   KERNEL_VERSION=<Xen Kernel version>
+   XEN_VERSION=<Xen Kernel flavor(suffix) >
+   rpmbuild \
+        -D "openvswitch_version $VERSION" \
+        -D "kernel_name $KERNEL_NAME" \
+        -D "kernel_version $KERNEL_VERSION" \
+        -D "xen_version $XEN_VERSION" \
+        -bb xenserver/openvswitch-xen.spec
+   ```
+
+where:
+
+    `<Xen Version>` is the output of `uname -r`.  Since XenServer 6.5, the
+    directory name in 'lib/modules/' becomes a shortened expression of the
+    KERNEL_VERSION.
+
 Installing Open vSwitch for XenServer
 -------------------------------------
 
index 31ff1bf..3bae86a 100644 (file)
@@ -7,9 +7,9 @@
 # notice and this notice are preserved.  This file is offered as-is,
 # without warranty of any kind.
 
-# When building, the rpmbuild command line should define
-# openvswitch_version, kernel_name, kernel_version, and kernel_flavor
-# using -D arguments.
+# For XenServer version < 6.5, when building, the rpmbuild command line
+# should define openvswitch_version, kernel_name, kernel_version and
+# kernel_flavor using -D arguments.
 # for example:
 #
 #    rpmbuild -D "openvswitch_version 1.1.0+build123"
 #      -D "kernel_flavor xen"
 #      -bb /usr/src/redhat/SPECS/openvswitch-xen.spec
 #
+# For XenServer version >= 6.5, replace kernel_flavor with xen_version which
+# should be the `uname -r` output.
+# for example:
+#
+#    rpmbuild -D "openvswitch_version 2.3.0+build123"
+#      -D "kernel_name  NAME-xen"
+#      -D "kernel_version 3.10.41-323.380416"
+#      -D "xen_version 3.10.0+2"
+#      -bb /usr/src/redhat/SPECS/openvswitch-xen.spec
+#
 # If tests have to be skipped while building, specify the '--without check'
 # option. For example:
 # rpmbuild -bb --without check xenserver/openvswitch-xen.spec
 %define kernel_flavor xen
 %endif
 
+%if %{?xen_version:0}%{!?xen_version:1}
 %define xen_version %{kernel_version}%{kernel_flavor}
+%endif
 
 # bump this when breaking compatibility with userspace
 %define module_abi_version 0
 
 # build-supplemental-pack.sh requires this naming for kernel module packages
-%define module_package modules-%{kernel_flavor}-%{kernel_version}
+%define module_package modules%{?kernel_flavor:-%{kernel_flavor}}-%{kernel_version}
 
 %bcond_without check
 
@@ -65,12 +77,12 @@ traffic.
 Summary: Open vSwitch kernel module
 Group: System Environment/Kernel
 License: GPLv2
-Provides: %{name}-modules-%{kernel_flavor} = %{kernel_version}, openvswitch.ko.%{module_abi_version}
-Requires: kernel-%{kernel_name} = %{kernel_version}
+Provides: %{name}-modules%{?kernel_flavor:-%{kernel_flavor}} = %{kernel_version}, openvswitch.ko.%{module_abi_version}
+Requires: kernel%{?kernel_flavor:-%{kernel_flavor}} = %{kernel_version}
 
 %description %{module_package}
 Open vSwitch Linux kernel module compiled against kernel version
-%{xen_version}.
+%{kernel_version}%{?kernel_flavor:%{kernel_flavor}}.
 
 %prep
 %setup -q -n openvswitch-%{openvswitch_version}