xenserver: Fix build spec for XenServer 6.5.
[cascardo/ovs.git] / xenserver / openvswitch-xen.spec.in
index 4d3b8fa..80cb91b 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_version 2.6.32.12-0.7.1.xs5.6.100.323.170596"
 #      -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
 
 %if %{?openvswitch_version:0}%{!?openvswitch_version:1}
 %define openvswitch_version @VERSION@
 %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
 
 Name: openvswitch
 Summary: Open vSwitch daemon/database/utilities
@@ -59,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}
@@ -123,18 +141,27 @@ cp -rf $RPM_BUILD_ROOT/usr/share/openvswitch/bugtool-plugins/* $RPM_BUILD_ROOT/e
 # Get rid of stuff we don't want to make RPM happy.
 rm \
     $RPM_BUILD_ROOT/usr/bin/ovs-benchmark \
-    $RPM_BUILD_ROOT/usr/bin/ovs-controller \
     $RPM_BUILD_ROOT/usr/bin/ovs-l3ping \
     $RPM_BUILD_ROOT/usr/bin/ovs-pki \
     $RPM_BUILD_ROOT/usr/bin/ovs-test \
     $RPM_BUILD_ROOT/usr/share/man/man1/ovs-benchmark.1 \
-    $RPM_BUILD_ROOT/usr/share/man/man8/ovs-controller.8 \
     $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \
     $RPM_BUILD_ROOT/usr/share/man/man8/ovs-pki.8 \
     $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8
+(cd "$RPM_BUILD_ROOT" && rm -f usr/lib/lib*)
 
 install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
 
+%check
+%if %{with check}
+    if make check TESTSUITEFLAGS='%{_smp_mflags}' ||
+       make check TESTSUITEFLAGS='--recheck'; then :;
+    else
+        cat tests/testsuite.log
+        exit 1
+    fi
+%endif
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -419,13 +446,16 @@ exit 0
 /usr/share/openvswitch/scripts/ovs-save
 /usr/share/openvswitch/scripts/ovs-ctl
 /usr/share/openvswitch/scripts/ovs-lib
+/usr/share/openvswitch/scripts/ovs-vtep
 /usr/share/openvswitch/vswitch.ovsschema
+/usr/share/openvswitch/vtep.ovsschema
 /usr/sbin/ovs-bugtool
 /usr/sbin/ovs-vlan-bug-workaround
 /usr/sbin/ovs-vswitchd
 /usr/sbin/ovsdb-server
 /usr/bin/ovs-appctl
 /usr/bin/ovs-dpctl
+/usr/bin/ovs-dpctl-top
 /usr/bin/ovs-ofctl
 /usr/bin/ovs-parse-backtrace
 /usr/bin/ovs-pcap
@@ -434,15 +464,18 @@ exit 0
 /usr/bin/ovs-vsctl
 /usr/bin/ovsdb-client
 /usr/bin/ovsdb-tool
+/usr/bin/vtep-ctl
 /usr/lib/xsconsole/plugins-base/XSFeatureVSwitch.py
 /usr/share/man/man1/ovsdb-client.1.gz
 /usr/share/man/man1/ovsdb-server.1.gz
 /usr/share/man/man1/ovsdb-tool.1.gz
 /usr/share/man/man5/ovs-vswitchd.conf.db.5.gz
+/usr/share/man/man5/vtep.5.gz
 /usr/share/man/man8/ovs-appctl.8.gz
 /usr/share/man/man8/ovs-bugtool.8.gz
 /usr/share/man/man8/ovs-ctl.8.gz
 /usr/share/man/man8/ovs-dpctl.8.gz
+/usr/share/man/man8/ovs-dpctl-top.8.gz
 /usr/share/man/man8/ovs-ofctl.8.gz
 /usr/share/man/man8/ovs-parse-backtrace.8.gz
 /usr/share/man/man1/ovs-pcap.1.gz
@@ -451,6 +484,7 @@ exit 0
 /usr/share/man/man8/ovs-vlan-test.8.gz
 /usr/share/man/man8/ovs-vsctl.8.gz
 /usr/share/man/man8/ovs-vswitchd.8.gz
+/usr/share/man/man8/vtep-ctl.8.gz
 /var/lib/openvswitch
 /var/log/openvswitch
 %exclude /usr/lib/xsconsole/plugins-base/*.py[co]