[ovs-dev] [PATCH] build: Add support for building RPMs for Fedora Linux

Kyle Mestery kmestery at cisco.com
Mon Oct 1 21:20:32 UTC 2012


Add RPM specfiles for building OVS for Fedora Linux. This
allows users of the upstream project the ability to
generate RPMs for their Open vSwitch needs.

Signed-off-by: Kyle Mestery <kmestery at cisco.com>
---
 INSTALL.Fedora                       |  53 +++++++++
 rhel/.gitignore                      |   2 +
 rhel/automake.mk                     |  10 ++
 rhel/openvswitch-fedora.spec.in      | 217 +++++++++++++++++++++++++++++++++++
 rhel/openvswitch-kmod-fedora.spec.in |  67 +++++++++++
 5 files changed, 349 insertions(+)
 create mode 100644 INSTALL.Fedora
 create mode 100644 rhel/openvswitch-fedora.spec.in
 create mode 100644 rhel/openvswitch-kmod-fedora.spec.in

diff --git a/INSTALL.Fedora b/INSTALL.Fedora
new file mode 100644
index 0000000..e5078dc
--- /dev/null
+++ b/INSTALL.Fedora
@@ -0,0 +1,53 @@
+       How to Install Open vSwitch on Fedora Linux
+       =======================================================
+
+This document describes how to build and install Open vSwitch on a Fedora
+Linux host.  If you want to install Open vSwitch on a generic Linux host,
+see INSTALL.Linux instead.
+
+We have tested these instructions with Fedora 15.
+
+Building Open vSwitch for Fedora
+--------------------------------
+
+You may build from an Open vSwitch distribution tarball or from an
+Open vSwitch Git tree.
+
+Before you begin, note the RPM source directory on your version of
+Fedora.  On Fedora 15, it is $HOME/rpmbuild/SOURCES.
+
+1. If you are building from an Open vSwitch Git tree, then you will
+   need to first create a distribution tarball by running "./boot.sh;
+   ./configure; make dist" in the Git tree.
+
+2. Copy the distribution tarball into the RPM source directory.
+
+3. Unpack the distribution tarball into a temporary directory and "cd"
+   into the root of the distribution tarball.
+
+4. To build Open vSwitch userspace, run:
+
+       rpmbuild -bb rhel/openvswitch-fedora.spec
+
+   This produces one RPM: "openvswitch".
+
+5. On Fedora 15, to build the Open vSwitch kernel module, run:
+
+	rpmbuild -bb rhel/openvswitch-kmod-fedora.spec
+
+    You might have to specify a kernel version and/or variants, e.g.:
+
+	rpmbuild -bb \
+		-D "kversion 2.6.32-131.6.1.el6.x86_64" \
+		-D "kflavors default debug kdump" \
+		rhel/openvswitch-kmod-rhel6.spec
+
+    This produces an "kmod-openvswitch" RPM for each kernel variant,
+    in this example: "kmod-openvswitch", "kmod-openvswitch-debug", and
+    "kmod-openvswitch-kdump".
+
+Reporting Bugs
+--------------
+
+Please report problems to dev at openvswitch.org.
+
diff --git a/rhel/.gitignore b/rhel/.gitignore
index 69e69b9..fa2554f 100644
--- a/rhel/.gitignore
+++ b/rhel/.gitignore
@@ -1,3 +1,5 @@
 openvswitch-kmod-rhel5.spec
 openvswitch-kmod-rhel6.spec
+openvswitch-kmod-fedora.spec
 openvswitch.spec
+openvswitch-fedora.spec
diff --git a/rhel/automake.mk b/rhel/automake.mk
index 4c1d782..eeb4264 100644
--- a/rhel/automake.mk
+++ b/rhel/automake.mk
@@ -17,8 +17,12 @@ EXTRA_DIST += \
 	rhel/openvswitch-kmod-rhel5.spec.in \
 	rhel/openvswitch-kmod-rhel6.spec \
 	rhel/openvswitch-kmod-rhel6.spec.in \
+	rhel/openvswitch-kmod-fedora.spec \
+	rhel/openvswitch-kmod-fedora.spec.in \
 	rhel/openvswitch.spec \
 	rhel/openvswitch.spec.in \
+	rhel/openvswitch-fedora.spec \
+	rhel/openvswitch-fedora.spec.in \
 	rhel/usr_share_openvswitch_scripts_sysconfig.template
 
 update_rhel_spec = \
@@ -32,5 +36,11 @@ $(srcdir)/rhel/openvswitch-kmod-rhel5.spec: rhel/openvswitch-kmod-rhel5.spec.in
 $(srcdir)/rhel/openvswitch-kmod-rhel6.spec: rhel/openvswitch-kmod-rhel6.spec.in $(top_builddir)/config.status
 	$(update_rhel_spec)
 
+$(srcdir)/rhel/openvswitch-kmod-fedora.spec: rhel/openvswitch-kmod-fedora.spec.in $(top_builddir)/config.status
+	$(update_rhel_spec)
+
 $(srcdir)/rhel/openvswitch.spec: rhel/openvswitch.spec.in $(top_builddir)/config.status
 	$(update_rhel_spec)
+
+$(srcdir)/rhel/openvswitch-fedora.spec: rhel/openvswitch-fedora.spec.in $(top_builddir)/config.status
+	$(update_rhel_spec)
diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
new file mode 100644
index 0000000..4fcbf0e
--- /dev/null
+++ b/rhel/openvswitch-fedora.spec.in
@@ -0,0 +1,217 @@
+# Spec file for Open vSwitch.
+
+# Copyright (C) 2009, 2010 Nicira Networks, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without warranty of any kind.
+
+#%define kernel 2.6.40.4-5.fc15.x86_64
+
+Name: openvswitch
+Summary: Open vSwitch
+Group: System Environment/Daemons
+URL: http://www.openvswitch.org/
+Vendor: OpenSource Security Ralf Spenneberg <ralf at os-s.net>
+Version: @VERSION@
+
+# The entire source code is ASL 2.0 except datapath/ which is GPLv2
+License: ASL 2.0
+Release: 1%{?dist}
+Source: openvswitch-%{version}.tar.gz
+#Source1: openvswitch-init
+Buildroot: /tmp/openvswitch-xen-rpm
+
+%description
+Open vSwitch provides standard network bridging functions augmented with
+support for the OpenFlow protocol for remote per-flow control of
+traffic.
+
+%prep
+%setup -q -n openvswitch-%{version}
+
+%build
+./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} --enable-ssl %{build_number}
+make %{_smp_mflags}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+install -d -m 755 $RPM_BUILD_ROOT/etc
+install -d -m 755 $RPM_BUILD_ROOT/etc/init.d
+install -d -m 755 $RPM_BUILD_ROOT/etc/openvswitch
+install -m 755 %{_builddir}/openvswitch-%{version}/rhel/etc_init.d_openvswitch \
+         $RPM_BUILD_ROOT/etc/init.d/openvswitch
+install -d -m 755 $RPM_BUILD_ROOT/etc/sysconfig
+install -d -m 755 $RPM_BUILD_ROOT/etc/logrotate.d
+install -m 755 xenserver/etc_logrotate.d_openvswitch \
+         $RPM_BUILD_ROOT/etc/logrotate.d/openvswitch
+install -d -m 755 $RPM_BUILD_ROOT/etc/profile.d
+install -m 755 xenserver/etc_profile.d_openvswitch.sh \
+         $RPM_BUILD_ROOT/etc/profile.d/openvswitch.sh
+install -m 644 vswitchd/vswitch.ovsschema \
+         $RPM_BUILD_ROOT/usr/share/openvswitch/vswitch.ovsschema
+install -d -m 755 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts
+install -m 755 xenserver/usr_share_openvswitch_scripts_sysconfig.template \
+         $RPM_BUILD_ROOT/etc/sysconfig/openvswitch
+install -d -m 755 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts
+
+install python/compat/uuid.py $RPM_BUILD_ROOT/usr/share/openvswitch/python
+install python/compat/argparse.py $RPM_BUILD_ROOT/usr/share/openvswitch/python
+
+install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%preun
+/etc/init.d/openvswitch stop
+
+%post
+if grep -F net.ipv4.conf.all.arp_filter /etc/sysctl.conf >/dev/null 2>&1; then :; else
+    cat >>/etc/sysctl.conf <<EOF
+# This works around an issue in xhad, which binds to a particular
+# Ethernet device, which in turn causes ICMP port unreachable messages
+# if packets are received are on the wrong interface, which in turn
+# can happen if we send out ARP replies on every interface (as Linux
+# does by default) instead of just on the interface that has the IP
+# address being ARPed for, which this sysctl setting in turn works
+# around.
+#
+# Bug #1378.
+net.ipv4.conf.all.arp_filter = 1
+EOF
+fi
+
+if test ! -e /etc/openvswitch/conf.db; then
+    install -d -m 755 -o root -g root /etc/openvswitch
+
+    # Create ovs-vswitchd config database
+    ovsdb-tool -vANY:console:emer create /etc/openvswitch/conf.db \
+            /usr/share/openvswitch/vswitch.ovsschema
+
+    # Create initial table in config database
+    ovsdb-tool -vANY:console:emer transact /etc/openvswitch/conf.db \
+            '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
+            > /dev/null
+fi
+
+
+
+%files
+%defattr(-,root,root)
+%config /etc/init.d/openvswitch
+%config /etc/sysconfig/openvswitch
+%config /etc/logrotate.d/openvswitch
+%config /etc/profile.d/openvswitch.sh
+/usr/share/openvswitch/python/ovs/__init__.py
+/usr/share/openvswitch/python/ovs/daemon.py
+/usr/share/openvswitch/python/ovs/db/__init__.py
+/usr/share/openvswitch/python/ovs/db/data.py
+/usr/share/openvswitch/python/ovs/db/error.py
+/usr/share/openvswitch/python/ovs/db/idl.py
+/usr/share/openvswitch/python/ovs/db/parser.py
+/usr/share/openvswitch/python/ovs/db/schema.py
+/usr/share/openvswitch/python/ovs/db/types.py
+/usr/share/openvswitch/python/ovs/dirs.py
+/usr/share/openvswitch/python/ovs/fatal_signal.py
+/usr/share/openvswitch/python/ovs/json.py
+/usr/share/openvswitch/python/ovs/jsonrpc.py
+/usr/share/openvswitch/python/ovs/ovsuuid.py
+/usr/share/openvswitch/python/ovs/poller.py
+/usr/share/openvswitch/python/ovs/process.py
+/usr/share/openvswitch/python/ovs/reconnect.py
+/usr/share/openvswitch/python/ovs/socket_util.py
+/usr/share/openvswitch/python/ovs/stream.py
+/usr/share/openvswitch/python/ovs/timeval.py
+/usr/share/openvswitch/python/ovs/util.py
+/usr/share/openvswitch/python/ovs/version.py
+/usr/share/openvswitch/python/ovs/unixctl/__init__.py
+/usr/share/openvswitch/python/ovs/unixctl/client.py
+/usr/share/openvswitch/python/ovs/unixctl/server.py
+/usr/share/openvswitch/python/uuid.py
+/usr/share/openvswitch/python/argparse.py
+/usr/share/openvswitch/python/ovs/vlog.py
+/usr/share/openvswitch/python/ovstest/__init__.py
+/usr/share/openvswitch/python/ovstest/args.py
+/usr/share/openvswitch/python/ovstest/rpcserver.py
+/usr/share/openvswitch/python/ovstest/tcp.py
+/usr/share/openvswitch/python/ovstest/udp.py
+/usr/share/openvswitch/python/ovstest/util.py
+/usr/share/openvswitch/python/ovstest/vswitch.py
+/usr/share/openvswitch/python/ovstest/tests.py
+/usr/share/openvswitch/scripts/ovs-bugtool-bond-show
+/usr/share/openvswitch/scripts/ovs-bugtool-cfm-show
+/usr/share/openvswitch/scripts/ovs-bugtool-lacp-show
+/usr/share/openvswitch/scripts/ovs-bugtool-memory-show
+/usr/share/openvswitch/scripts/ovs-bugtool-coverage-show
+/usr/share/openvswitch/scripts/ovs-bugtool-vsctl-show
+/usr/share/openvswitch/scripts/ovs-check-dead-ifs
+/usr/share/openvswitch/bugtool-plugins/kernel-info/openvswitch.xml
+/usr/share/openvswitch/bugtool-plugins/network-status/openvswitch.xml
+/usr/share/openvswitch/bugtool-plugins/system-configuration.xml
+/usr/share/openvswitch/bugtool-plugins/system-configuration/openvswitch.xml
+/usr/share/openvswitch/bugtool-plugins/system-logs/openvswitch.xml
+/usr/share/openvswitch/scripts/ovs-lib
+%config /usr/share/openvswitch/vswitch.ovsschema
+/usr/sbin/ovs-brcompatd
+/usr/sbin/ovs-vswitchd
+/usr/sbin/ovsdb-server
+/usr/bin/ovs-appctl
+/usr/bin/ovs-dpctl
+/usr/bin/ovs-ofctl
+/usr/bin/ovs-vsctl
+/usr/bin/ovsdb-client
+/usr/bin/ovsdb-tool
+/usr/bin/ovs-controller
+/usr/bin/ovs-pki
+/usr/bin/ovs-test
+/usr/bin/ovs-l3ping
+%doc /usr/share/man/man8/ovs-controller.8.gz
+%doc /usr/share/man/man8/ovs-pki.8.gz
+%doc /usr/share/man/man1/ovsdb-client.1.gz
+%doc /usr/share/man/man1/ovsdb-server.1.gz
+%doc /usr/share/man/man1/ovsdb-tool.1.gz
+%doc /usr/share/man/man5/ovs-vswitchd.conf.db.5.gz
+%doc /usr/share/man/man8/ovs-appctl.8.gz
+%doc /usr/share/man/man8/ovs-brcompatd.8.gz
+%doc /usr/share/man/man8/ovs-dpctl.8.gz
+%doc /usr/share/man/man8/ovs-ofctl.8.gz
+%doc /usr/share/man/man8/ovs-parse-leaks.8.gz
+%doc /usr/share/man/man8/ovs-vsctl.8.gz
+%doc /usr/share/man/man8/ovs-vswitchd.8.gz
+%doc /usr/share/man/man8/ovs-test.8.gz
+%doc /usr/share/man/man8/ovs-l3ping.8.gz
+/var/lib/openvswitch
+/usr/share/openvswitch/scripts/ovs-lib
+/usr/share/openvswitch/scripts/ovs-ctl
+/usr/share/openvswitch/scripts/ovs-bugtool-daemons-ver
+%exclude /etc/openvswitch
+%exclude /usr/bin/ovs-benchmark
+%exclude /usr/bin/ovs-parse-leaks
+%exclude /usr/bin/ovs-pcap
+%exclude /usr/bin/ovs-tcpundump
+%exclude /usr/bin/ovs-vlan-test
+%exclude /usr/sbin/ovs-bugtool
+%exclude /usr/sbin/ovs-vlan-bug-workaround
+%exclude /usr/share/man/man1/ovs-benchmark.1.gz
+%exclude /usr/share/man/man1/ovs-pcap.1.gz
+%exclude /usr/share/man/man1/ovs-tcpundump.1.gz
+%exclude /usr/share/man/man8/ovs-bugtool.8.gz
+%exclude /usr/share/man/man8/ovs-ctl.8.gz
+%exclude /usr/share/man/man8/ovs-vlan-bug-workaround.8.gz
+%exclude /usr/share/man/man8/ovs-vlan-test.8.gz
+%exclude /usr/share/openvswitch/scripts/ovs-bugtool-ovsdb-dump
+%exclude /usr/share/openvswitch/scripts/ovs-bugtool-tc-class-show
+%exclude /usr/share/openvswitch/scripts/ovs-save
+#%exclude /usr/lib/xsconsole/plugins-base/*.py[co]
+#%exclude /usr/share/openvswitch/scripts/*.py[co]
+#%exclude /usr/share/openvswitch/python/*.py[co]
+#%exclude /usr/share/openvswitch/python/ovs/*.py[co]
+#%exclude /usr/share/openvswitch/python/ovs/db/*.py[co]
+
+%changelog
+* Wed Jan 12 2011 Ralf Spenneberg <ralf at os-s.net>
+- First build on F14
+
diff --git a/rhel/openvswitch-kmod-fedora.spec.in b/rhel/openvswitch-kmod-fedora.spec.in
new file mode 100644
index 0000000..dc278a8
--- /dev/null
+++ b/rhel/openvswitch-kmod-fedora.spec.in
@@ -0,0 +1,67 @@
+# Spec file for Open vSwitch.
+
+# Copyright (C) 2009, 2010 Nicira Networks, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without warranty of any kind.
+
+#%define kernel 3.1.5-1.fc16.x86_64
+#define kernel %{kernel_source}
+%{?kversion:%define kernel %kversion}
+
+Name: openvswitch-kmod
+Summary: Open vSwitch Kernel Modules
+Group: System Environment/Daemons
+URL: http://www.openvswitch.org/
+Vendor: OpenSource Security Ralf Spenneberg <ralf at os-s.net>
+Version: @VERSION@
+
+# The entire source code is ASL 2.0 except datapath/ which is GPLv2
+License: GPLv2
+Release: 1%{?dist}
+Source: openvswitch-%{version}.tar.gz
+#Source1: openvswitch-init
+Buildroot: /tmp/openvswitch-xen-rpm
+
+%description
+Open vSwitch provides standard network bridging functions augmented with
+support for the OpenFlow protocol for remote per-flow control of
+traffic. This package contains the kernel modules.
+
+%prep
+%setup -q -n openvswitch-%{version}
+
+%build
+./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} --with-linux=/lib/modules/%{kernel}/build --enable-ssl %{build_number}
+make %{_smp_mflags} -C datapath/linux
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make -C datapath/linux modules_install
+
+install -d -m 755 $RPM_BUILD_ROOT/lib/modules/%{kernel}/kernel/extra/openvswitch
+find datapath/linux -name *.ko -exec install -m 755  \{\} $RPM_BUILD_ROOT/lib/modules/%{kernel}/kernel/extra/openvswitch \;
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%preun
+/etc/init.d/openvswitch stop
+
+%post
+# Ensure that modprobe will find our modules.
+depmod %{kernel}
+
+%files
+%defattr(-,root,root)
+/lib/modules/%{kernel}/kernel/extra/openvswitch/openvswitch.ko
+/lib/modules/%{kernel}/kernel/extra/openvswitch/brcompat.ko
+
+%changelog
+* Wed Sep 21 2011 Kyle Mestery <kmestery at cisco.com>
+- Updated for F15
+* Wed Jan 12 2011 Ralf Spenneberg <ralf at os-s.net>
+- First build on F14
+
-- 
1.7.11.4




More information about the dev mailing list