1 # Spec file for Open vSwitch.
3 # Copyright (C) 2009, 2010, 2013, 2014 Nicira Networks, Inc.
5 # Copying and distribution of this file, with or without modification,
6 # are permitted in any medium without royalty provided the copyright
7 # notice and this notice are preserved. This file is offered as-is,
8 # without warranty of any kind.
10 # If tests have to be skipped while building, specify the '--without check'
11 # option. For example:
12 # rpmbuild -bb --without check rhel/openvswitch-fedora.spec
14 #%define kernel 2.6.40.4-5.fc15.x86_64
16 # Enable PIE, bz#955181
17 %global _hardened_build 1
21 Group: System Environment/Daemons
22 URL: http://www.openvswitch.org/
25 # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the
26 # lib/sflow*.[ch] files are SISSL
27 # datapath/ is GPLv2 (although not built into any of the binary packages)
28 # python/compat is Python (although not built into any of the binary packages)
29 License: ASL 2.0 and LGPLv2+ and SISSL
31 Source: http://openvswitch.org/releases/%{name}-%{version}.tar.gz
33 BuildRequires: autoconf
34 BuildRequires: systemd-units openssl openssl-devel
35 BuildRequires: python python-twisted-core python-zope-interface PyQt4
36 BuildRequires: desktop-file-utils
37 BuildRequires: groff graphviz
39 Requires: openssl iproute module-init-tools
40 #Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
41 Requires: kernel >= 3.15.0-0
43 Requires(post): systemd-units
44 Requires(preun): systemd-units
45 Requires(postun): systemd-units
46 Obsoletes: openvswitch-controller <= 0:2.1.0-1
51 Open vSwitch provides standard network bridging functions and
52 support for the OpenFlow protocol for remote per-flow control of
55 %package -n python-openvswitch
56 Summary: Open vSwitch python bindings
61 %description -n python-openvswitch
62 Python bindings for the Open vSwitch database
65 Summary: Open vSwitch testing utilities
68 Requires: python-openvswitch = %{version}-%{release}
69 Requires: python python-twisted-core python-twisted-web
72 Utilities that are useful to diagnose performance and connectivity
73 issues in Open vSwitch setup.
76 Summary: Open vSwitch OpenFlow development package (library, headers)
78 Provides: openvswitch-static = %{version}-%{release}
81 This provides static library, libopenswitch.a and the openvswitch header
82 files needed to build an external application.
89 %configure --enable-ssl --with-pkidir=%{_sharedstatedir}/openvswitch/pki
93 rm -rf $RPM_BUILD_ROOT
94 make install DESTDIR=$RPM_BUILD_ROOT
96 install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch
98 install -p -D -m 0644 \
99 rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
100 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/openvswitch
101 install -p -D -m 0644 \
102 rhel/usr_lib_systemd_system_openvswitch.service \
103 $RPM_BUILD_ROOT%{_unitdir}/openvswitch.service
104 install -p -D -m 0644 \
105 rhel/usr_lib_systemd_system_openvswitch-nonetwork.service \
106 $RPM_BUILD_ROOT%{_unitdir}/openvswitch-nonetwork.service
108 install -m 0755 rhel/etc_init.d_openvswitch \
109 $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/openvswitch.init
111 install -p -D -m 0644 rhel/etc_logrotate.d_openvswitch \
112 $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/openvswitch
114 install -m 0644 vswitchd/vswitch.ovsschema \
115 $RPM_BUILD_ROOT/%{_datadir}/openvswitch/vswitch.ovsschema
117 install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/
118 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifdown-ovs \
119 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
120 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \
121 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
123 install -d -m 0755 $RPM_BUILD_ROOT%{python_sitelib}
124 mv $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/* \
125 $RPM_BUILD_ROOT%{python_sitelib}
126 rmdir $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
128 install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
130 install -d -m 0755 $RPM_BUILD_ROOT%{_includedir}/openvswitch
131 install -p -D -m 0644 include/openvswitch/*.h \
132 -t $RPM_BUILD_ROOT%{_includedir}/openvswitch
133 install -p -D -m 0644 config.h \
134 -t $RPM_BUILD_ROOT%{_includedir}/openvswitch
136 install -d -m 0755 $RPM_BUILD_ROOT%{_includedir}/openvswitch/lib
137 install -p -D -m 0644 lib/*.h \
138 -t $RPM_BUILD_ROOT%{_includedir}/openvswitch/lib
140 install -d -m 0755 $RPM_BUILD_ROOT%{_includedir}/openflow
141 install -p -D -m 0644 include/openflow/*.h \
142 -t $RPM_BUILD_ROOT%{_includedir}/openflow
144 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
145 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf
149 if make check TESTSUITEFLAGS='%{_smp_mflags}' ||
150 make check TESTSUITEFLAGS='--recheck'; then :;
152 cat tests/testsuite.log
158 rm -rf $RPM_BUILD_ROOT
161 %if 0%{?systemd_preun:1}
162 %systemd_preun %{name}.service
164 if [ $1 -eq 0 ] ; then
165 # Package removal, not upgrade
166 /bin/systemctl --no-reload disable %{name}.service >/dev/null 2>&1 || :
167 /bin/systemctl stop %{name}.service >/dev/null 2>&1 || :
173 if test ! -e /etc/openvswitch/conf.db; then
174 install -d -m 755 -o root -g root /etc/openvswitch
176 # Create ovs-vswitchd config database
177 ovsdb-tool -vANY:console:emer create /etc/openvswitch/conf.db \
178 /usr/share/openvswitch/vswitch.ovsschema
180 # Create initial table in config database
181 ovsdb-tool -vANY:console:emer transact /etc/openvswitch/conf.db \
182 '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
186 %if 0%{?systemd_post:1}
187 %systemd_post %{name}.service
189 # Package install, not upgrade
190 if [ $1 -eq 1 ]; then
191 /bin/systemctl daemon-reload >dev/null || :
197 %if 0%{?systemd_postun_with_restart:1}
198 %systemd_postun_with_restart %{name}.service
200 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
201 if [ "$1" -ge "1" ] ; then
202 # Package upgrade, not uninstall
203 /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
208 %files -n python-openvswitch
209 %{python_sitelib}/ovs
214 %{_bindir}/ovs-vlan-test
215 %{_bindir}/ovs-l3ping
216 %{_mandir}/man8/ovs-test.8*
217 %{_mandir}/man8/ovs-vlan-test.8*
218 %{_mandir}/man8/ovs-l3ping.8*
219 %{python_sitelib}/ovstest
224 %{_includedir}/openvswitch/*
225 %{_includedir}/openflow/*
228 %defattr(-,root,root)
229 %dir %{_sysconfdir}/openvswitch
230 %config %ghost %{_sysconfdir}/openvswitch/conf.db
231 %config %ghost %{_sysconfdir}/openvswitch/system-id.conf
232 %config(noreplace) %{_sysconfdir}/sysconfig/openvswitch
233 %config(noreplace) %{_sysconfdir}/logrotate.d/openvswitch
234 %{_unitdir}/openvswitch.service
235 %{_unitdir}/openvswitch-nonetwork.service
236 %{_datadir}/openvswitch/scripts/openvswitch.init
237 %{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
238 %{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
239 %{_datadir}/openvswitch/bugtool-plugins/
240 %{_datadir}/openvswitch/scripts/ovs-bugtool-*
241 %{_datadir}/openvswitch/scripts/ovs-check-dead-ifs
242 %{_datadir}/openvswitch/scripts/ovs-lib
243 %{_datadir}/openvswitch/scripts/ovs-vtep
244 %{_datadir}/openvswitch/scripts/ovs-ctl
245 %config %{_datadir}/openvswitch/vswitch.ovsschema
246 %config %{_datadir}/openvswitch/vtep.ovsschema
247 %{_bindir}/ovs-appctl
248 %{_bindir}/ovs-docker
250 %{_bindir}/ovs-dpctl-top
253 %{_bindir}/ovsdb-client
254 %{_bindir}/ovsdb-tool
255 %{_bindir}/ovs-testcontroller
258 %{_sbindir}/ovs-bugtool
259 %{_sbindir}/ovs-vswitchd
260 %{_sbindir}/ovsdb-server
261 %{_mandir}/man1/ovs-benchmark.1*
262 %{_mandir}/man1/ovs-pcap.1*
263 %{_mandir}/man1/ovs-tcpundump.1*
264 %{_mandir}/man1/ovsdb-client.1*
265 %{_mandir}/man1/ovsdb-server.1*
266 %{_mandir}/man1/ovsdb-tool.1*
267 %{_mandir}/man5/ovs-vswitchd.conf.db.5*
268 %{_mandir}/man5/vtep.5*
269 %{_mandir}/man8/vtep-ctl.8*
270 %{_mandir}/man8/ovs-appctl.8*
271 %{_mandir}/man8/ovs-bugtool.8*
272 %{_mandir}/man8/ovs-ctl.8*
273 %{_mandir}/man8/ovs-dpctl.8*
274 %{_mandir}/man8/ovs-dpctl-top.8*
275 %{_mandir}/man8/ovs-ofctl.8*
276 %{_mandir}/man8/ovs-pki.8*
277 %{_mandir}/man8/ovs-vsctl.8*
278 %{_mandir}/man8/ovs-vswitchd.8*
279 %{_mandir}/man8/ovs-parse-backtrace.8*
280 %{_mandir}/man8/ovs-testcontroller.8*
281 %doc COPYING DESIGN.md INSTALL.SSL.md NOTICE README.md WHY-OVS.md
282 %doc FAQ.md NEWS INSTALL.DPDK.md rhel/README.RHEL
285 %exclude %{_bindir}/ovs-benchmark
286 %exclude %{_bindir}/ovs-parse-backtrace
287 %exclude %{_bindir}/ovs-pcap
288 %exclude %{_bindir}/ovs-tcpundump
289 %exclude %{_sbindir}/ovs-vlan-bug-workaround
290 %exclude %{_mandir}/man1/ovs-benchmark.1.gz
291 %exclude %{_mandir}/man1/ovs-pcap.1.gz
292 %exclude %{_mandir}/man1/ovs-tcpundump.1.gz
293 %exclude %{_mandir}/man8/ovs-vlan-bug-workaround.8.gz
294 %exclude %{_datadir}/openvswitch/scripts/ovs-save
297 * Wed Jan 12 2011 Ralf Spenneberg <ralf@os-s.net>