[ovs-dev] [PATCH 2/2] xenserver: spec file uses kernel_version and kernel_suffix from cmdline

Sajjad Lateef slateef at nicira.com
Tue May 10 22:43:35 UTC 2011

Citrix build Oxford CSP kernel does not follow earlier convention of kernel name suffix
being used as the suffix of the kernel version.

In conjunction with this change, the build process will be modified to use rpm
to query the installed kernel.*devel package for its Version, Release and Name
The build process will them invoke rpmbuild with the values on the command line.
The changes to the build process are documented in INSTALL.XenServer

Updated INSTALL.XenServer to reflect this change.

With this change, the spec file is modified to use the command line arguments
of kernel_version and kernel_suffix and use these to name the openvswitch-modules
package and its dependencies.

Signed-off-by: Sajjad Lateef <slateef at nicira.com>
 INSTALL.XenServer              |   13 +++++++++++++
 xenserver/openvswitch-xen.spec |   19 ++++++++++---------
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/INSTALL.XenServer b/INSTALL.XenServer
index 48f8178..1b5cb52 100644
--- a/INSTALL.XenServer
+++ b/INSTALL.XenServer
@@ -24,11 +24,15 @@ Once you have a distribution tarball, copy it into
    VERSION=<Open vSwitch version>
    XENKERNEL=<Xen kernel version>
+   KERNEL_VERSION=<Xen Kernel Devel version>
+   KERNEL_SUFFIX=<Xen Kernel Devel suffix>
    cd /tmp
    tar xfz /usr/src/redhat/SOURCES/openvswitch-$VERSION.tar.gz
    rpmbuild \
         -D "openvswitch_version $VERSION" \
         -D "xen_version $XENKERNEL" \
+        -D "kernel_version $KERNEL_VERSION" \
+        -D "kernel_suffix $KERNEL_SUFFIX" \
         -bb openvswitch-$VERSION/xenserver/openvswitch-xen.spec
@@ -41,6 +45,15 @@ where:
     appears as the name of a directory in /lib/modules inside the VM.
     It always ends in "xen".
+   <Xen Kernel Devel version> is the output of:
+   rpm -q --queryformat "%{Version}-%{Release}" kernel.*xen-devel
+   e.g. 
+   <Xen Kernel Devel suffix> is the output of: 
+   rpm -q --queryformat "%{Name}" kernel.*devel 
+   with the "kernel-" and "-devel" stripped out using  sed 's/kernel-//' | sed 's/-devel//'
+   e.g. kernel-csp-xen-devel => csp-xen
 Three RPMs will be output into /usr/src/redhat/RPMS/i386, whose names begin
 with "openvswitch", "openvswitch-modules-xen", and "openvswitch-debuginfo".
diff --git a/xenserver/openvswitch-xen.spec b/xenserver/openvswitch-xen.spec
index cef948f..fed63e7 100644
--- a/xenserver/openvswitch-xen.spec
+++ b/xenserver/openvswitch-xen.spec
@@ -11,19 +11,20 @@
 # openvswitch_version, xen_version, and build_number using -D arguments.
 # for example:
-#    rpmbuild -D "openvswitch_version 0.8.9~1+build123" -D "xen_version 2.6.18-128.1.1.el5.xs5.1.0.483.1000xen" -D "build_number --with-build-number=123" -bb /usr/src/redhat/SPECS/openvswitch-xen.spec
+#    rpmbuild -D "openvswitch_version 1.1.0+build123"
+#      -D "xen_version"
+#      -D "kernel_version"
+#      -D "kernel_suffix csp-xen"
+#      -D "build_number --with-build-number=123"
+#      -bb /usr/src/redhat/SPECS/openvswitch-xen.spec
 %define version %{openvswitch_version}-%{xen_version}
 # bump this when breaking compatibility with userspace
 %define module_abi_version 0
-# extract kernel type (xen or kdump)
-%define binsuffix -%(echo '%{xen_version}' | sed -r 's/^.*[0-9]+//')
-# kernel version string w/o kernel type
-%define kernel_version %(echo '%{xen_version}' | sed -r 's/[a-z]+$//')
 # build-supplemental-pack.sh requires this naming for kernel module packages
-%define module_package modules%{binsuffix}-%{kernel_version}
+%define module_package modules-%{kernel_suffix}-%{kernel_version}
 Name: openvswitch
 Summary: Open vSwitch daemon/database/utilities
@@ -48,11 +49,11 @@ Summary: Open vSwitch kernel module
 Group: System Environment/Kernel
 License: GPLv2
 Provides: %{name}-modules = %{kernel_version}, openvswitch_mod.ko.%{module_abi_version}
-Requires: kernel%{binsuffix} = %{kernel_version}
+Requires: kernel-%{kernel_suffix} = %{kernel_version}
 %description %{module_package}
 Open vSwitch Linux kernel module compiled against kernel version
 %setup -q -n openvswitch-%{openvswitch_version}
@@ -233,7 +234,7 @@ if [ "$1" = "1" ]; then    # $1 = 2 for upgrade
     printf "or any hosted VM will fail until after the reboot and could\n"
     printf "leave the server in an state requiring manual recovery.\n\n"
-    printf "\nTo use the new Open vSwitch install, you should reboot the\n" 
+    printf "\nTo use the new Open vSwitch install, you should reboot the\n"
     printf "server now.  Failure to do so may result in incorrect operation."
     printf "\n\n"

More information about the dev mailing list