tests: Add ability to automatically rerun failed tests.
[cascardo/ovs.git] / rhel / openvswitch-fedora.spec.in
1 # Spec file for Open vSwitch.
2
3 # Copyright (C) 2009, 2010, 2013, 2014, 2015, 2016 Nicira Networks, Inc.
4 #
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.
9 #
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
13
14 #%define kernel 2.6.40.4-5.fc15.x86_64
15
16 # If libcap-ng isn't available and there is no need for running OVS
17 # as regular user, specify the '--without libcapng'
18 %bcond_without libcapng
19 # To enable DPDK support, specify '--with dpdk' when building
20 %bcond_with dpdk
21
22 # Enable PIE, bz#955181
23 %global _hardened_build 1
24
25 # some distros (e.g: RHEL-7) don't define _rundir macro yet
26 # Fedora 15 onwards uses /run as _rundir
27 %if 0%{!?_rundir:1}
28 %define _rundir /run
29 %endif
30
31 Name: openvswitch
32 Summary: Open vSwitch
33 Group: System Environment/Daemons
34 URL: http://www.openvswitch.org/
35 Version: @VERSION@
36
37 # Nearly all of openvswitch is ASL 2.0.  The bugtool is LGPLv2+, and the
38 # lib/sflow*.[ch] files are SISSL
39 # datapath/ is GPLv2 (although not built into any of the binary packages)
40 License: ASL 2.0 and LGPLv2+ and SISSL
41 Release: 1%{?dist}
42 Source: http://openvswitch.org/releases/%{name}-%{version}.tar.gz
43
44 BuildRequires: autoconf automake libtool
45 BuildRequires: systemd-units openssl openssl-devel
46 BuildRequires: python python-twisted-core python-zope-interface PyQt4 python-six
47 BuildRequires: desktop-file-utils
48 BuildRequires: groff graphviz
49 # make check dependencies
50 BuildRequires: procps-ng
51 %if %{with libcapng}
52 BuildRequires: libcap-ng libcap-ng-devel
53 %endif
54 %if %{with dpdk}
55 BuildRequires: dpdk-devel >= 2.2.0
56 Provides: %{name}-dpdk = %{version}-%{release}
57 %endif
58
59 Requires: openssl iproute module-init-tools
60 #Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
61 #Requires: kernel >= 3.15.0-0
62
63 Requires(post): systemd-units
64 Requires(preun): systemd-units
65 Requires(postun): systemd-units
66 Obsoletes: openvswitch-controller <= 0:2.1.0-1
67
68 %bcond_without check
69
70 %description
71 Open vSwitch provides standard network bridging functions and
72 support for the OpenFlow protocol for remote per-flow control of
73 traffic.
74
75 %package -n python-openvswitch
76 Summary: Open vSwitch python bindings
77 License: ASL 2.0
78 BuildArch: noarch
79 Requires: python
80 Requires: python-six
81
82 %description -n python-openvswitch
83 Python bindings for the Open vSwitch database
84
85 %package test
86 Summary: Open vSwitch testing utilities
87 License: ASL 2.0
88 BuildArch: noarch
89 Requires: python-openvswitch = %{version}-%{release}
90 Requires: python python-twisted-core python-twisted-web
91
92 %description test
93 Utilities that are useful to diagnose performance and connectivity
94 issues in Open vSwitch setup.
95
96 %package devel
97 Summary: Open vSwitch OpenFlow development package (library, headers)
98 License: ASL 2.0
99 Provides: openvswitch-static = %{version}-%{release}
100
101 %description devel
102 This provides static library, libopenswitch.a and the openvswitch header
103 files needed to build an external application.
104
105 %package ovn
106 Summary: Open vSwitch - Open Virtual Network support
107 License: ASL 2.0
108 Requires: openvswitch
109
110 %description ovn
111 OVN, the Open Virtual Network, is a system to support virtual network
112 abstraction.  OVN complements the existing capabilities of OVS to add
113 native support for virtual network abstractions, such as virtual L2 and L3
114 overlays and security groups.
115
116
117 %prep
118 %setup -q
119
120 %build
121 %configure \
122 %if %{with libcapng}
123         --enable-libcapng \
124 %else
125         --disable-libcapng \
126 %endif
127 %if %{with dpdk}
128         --with-dpdk=$(dirname %{_datadir}/dpdk/*/.config) \
129 %endif
130         --enable-ssl \
131         --with-pkidir=%{_sharedstatedir}/openvswitch/pki
132
133 make %{?_smp_mflags}
134
135 %install
136 rm -rf $RPM_BUILD_ROOT
137 make install DESTDIR=$RPM_BUILD_ROOT
138
139 install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch
140
141 install -p -D -m 0644 \
142         rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
143         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/openvswitch
144 for service in openvswitch openvswitch-nonetwork \
145                 ovn-controller ovn-controller-vtep ovn-northd; do
146         install -p -D -m 0644 \
147                         rhel/usr_lib_systemd_system_${service}.service \
148                         $RPM_BUILD_ROOT%{_unitdir}/${service}.service
149 done
150 install -m 0755 rhel/etc_init.d_openvswitch \
151         $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/openvswitch.init
152
153 install -p -D -m 0644 rhel/etc_logrotate.d_openvswitch \
154         $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/openvswitch
155
156 install -m 0644 vswitchd/vswitch.ovsschema \
157         $RPM_BUILD_ROOT/%{_datadir}/openvswitch/vswitch.ovsschema
158
159 install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/
160 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifdown-ovs \
161         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
162 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \
163         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
164
165 install -d -m 0755 $RPM_BUILD_ROOT%{python_sitelib}
166 mv $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/* \
167    $RPM_BUILD_ROOT%{python_sitelib}
168 rmdir $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
169
170 install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
171
172 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
173 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf
174
175 # remove unpackaged files
176 rm -f $RPM_BUILD_ROOT%{_bindir}/ovs-parse-backtrace \
177         $RPM_BUILD_ROOT%{_bindir}/ovs-pcap \
178         $RPM_BUILD_ROOT%{_bindir}/ovs-tcpundump \
179         $RPM_BUILD_ROOT%{_sbindir}/ovs-vlan-bug-workaround \
180         $RPM_BUILD_ROOT%{_mandir}/man1/ovs-pcap.1 \
181         $RPM_BUILD_ROOT%{_mandir}/man1/ovs-tcpundump.1 \
182         $RPM_BUILD_ROOT%{_mandir}/man8/ovs-vlan-bug-workaround.8 \
183         $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/ovs-save
184
185 %check
186 %if %{with check}
187     if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :;
188     else
189         cat tests/testsuite.log
190         exit 1
191     fi
192 %endif
193
194 %clean
195 rm -rf $RPM_BUILD_ROOT
196
197 %preun
198 %if 0%{?systemd_preun:1}
199     %systemd_preun %{name}.service
200 %else
201     if [ $1 -eq 0 ] ; then
202     # Package removal, not upgrade
203         /bin/systemctl --no-reload disable %{name}.service >/dev/null 2>&1 || :
204         /bin/systemctl stop %{name}.service >/dev/null 2>&1 || :
205     fi
206 %endif
207
208 %preun ovn
209 %if 0%{?systemd_preun:1}
210     %systemd_preun ovn-controller.service
211     %systemd_preun ovn-controller-vtep.service
212     %systemd_preun ovn-northd.service
213 %else
214     if [ $1 -eq 0 ] ; then
215     # Package removal, not upgrade
216         /bin/systemctl --no-reload disable ovn-controller.service >/dev/null 2>&1 || :
217         /bin/systemctl stop ovn-controller.service >/dev/null 2>&1 || :
218         /bin/systemctl --no-reload disable ovn-controller-vtep.service >/dev/null 2>&1 || :
219         /bin/systemctl stop ovn-controller-vtep.service >/dev/null 2>&1 || :
220         /bin/systemctl --no-reload disable ovn-northd.service >/dev/null 2>&1 || :
221         /bin/systemctl stop ovn-northd.service >/dev/null 2>&1 || :
222     fi
223 %endif
224
225 %post
226 %if 0%{?systemd_post:1}
227     %systemd_post %{name}.service
228 %else
229     # Package install, not upgrade
230     if [ $1 -eq 1 ]; then
231         /bin/systemctl daemon-reload >dev/null || :
232     fi
233 %endif
234
235 %post ovn
236 %if 0%{?systemd_post:1}
237     %systemd_post ovn-controller.service
238     %systemd_post ovn-controller-vtep.service
239     %systemd_post ovn-northd.service
240 %else
241     # Package install, not upgrade
242     if [ $1 -eq 1 ]; then
243         /bin/systemctl daemon-reload >dev/null || :
244     fi
245 %endif
246
247 %postun
248 %if 0%{?systemd_postun_with_restart:1}
249     %systemd_postun_with_restart %{name}.service
250 %else
251     /bin/systemctl daemon-reload >/dev/null 2>&1 || :
252     if [ "$1" -ge "1" ] ; then
253     # Package upgrade, not uninstall
254         /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
255     fi
256 %endif
257
258 %postun ovn
259 %if 0%{?systemd_postun_with_restart:1}
260     %systemd_postun_with_restart ovn-controller.service
261     %systemd_postun_with_restart ovn-controller-vtep.service
262     %systemd_postun_with_restart ovn-northd.service
263 %else
264     /bin/systemctl daemon-reload >/dev/null 2>&1 || :
265     if [ "$1" -ge "1" ] ; then
266     # Package upgrade, not uninstall
267         /bin/systemctl try-restart ovn-controller.service >/dev/null 2>&1 || :
268         /bin/systemctl try-restart ovn-controller-vtep.service >/dev/null 2>&1 || :
269         /bin/systemctl try-restart ovn-northd.service >/dev/null 2>&1 || :
270     fi
271 %endif
272
273 %files -n python-openvswitch
274 %{python_sitelib}/ovs
275 %doc COPYING
276
277 %files test
278 %{_bindir}/ovs-test
279 %{_bindir}/ovs-vlan-test
280 %{_bindir}/ovs-l3ping
281 %{_mandir}/man8/ovs-test.8*
282 %{_mandir}/man8/ovs-vlan-test.8*
283 %{_mandir}/man8/ovs-l3ping.8*
284 %{python_sitelib}/ovstest
285
286 %files devel
287 %{_libdir}/*.a
288 %{_libdir}/*.la
289 %{_libdir}/pkgconfig/*.pc
290 %{_includedir}/openvswitch/*
291 %{_includedir}/openflow/*
292
293 %files
294 %defattr(-,root,root)
295 %{_sysconfdir}/bash_completion.d/ovs-appctl-bashcomp.bash
296 %{_sysconfdir}/bash_completion.d/ovs-vsctl-bashcomp.bash
297 %dir %{_sysconfdir}/openvswitch
298 %config %ghost %{_sysconfdir}/openvswitch/conf.db
299 %config %ghost %{_sysconfdir}/openvswitch/system-id.conf
300 %config(noreplace) %{_sysconfdir}/sysconfig/openvswitch
301 %config(noreplace) %{_sysconfdir}/logrotate.d/openvswitch
302 %{_unitdir}/openvswitch.service
303 %{_unitdir}/openvswitch-nonetwork.service
304 %{_datadir}/openvswitch/scripts/openvswitch.init
305 %{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
306 %{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
307 %{_datadir}/openvswitch/bugtool-plugins/
308 %{_datadir}/openvswitch/scripts/ovs-bugtool-*
309 %{_datadir}/openvswitch/scripts/ovs-check-dead-ifs
310 %{_datadir}/openvswitch/scripts/ovs-lib
311 %{_datadir}/openvswitch/scripts/ovs-vtep
312 %{_datadir}/openvswitch/scripts/ovs-ctl
313 %config %{_datadir}/openvswitch/vswitch.ovsschema
314 %config %{_datadir}/openvswitch/vtep.ovsschema
315 %{_bindir}/ovs-appctl
316 %{_bindir}/ovs-docker
317 %{_bindir}/ovs-dpctl
318 %{_bindir}/ovs-dpctl-top
319 %{_bindir}/ovs-ofctl
320 %{_bindir}/ovs-vsctl
321 %{_bindir}/ovsdb-client
322 %{_bindir}/ovsdb-tool
323 %{_bindir}/ovs-testcontroller
324 %{_bindir}/ovs-pki
325 %{_bindir}/vtep-ctl
326 %{_sbindir}/ovs-bugtool
327 %{_sbindir}/ovs-vswitchd
328 %{_sbindir}/ovsdb-server
329 %{_mandir}/man1/ovsdb-client.1*
330 %{_mandir}/man1/ovsdb-server.1*
331 %{_mandir}/man1/ovsdb-tool.1*
332 %{_mandir}/man5/ovs-vswitchd.conf.db.5*
333 %{_mandir}/man5/vtep.5*
334 %{_mandir}/man8/vtep-ctl.8*
335 %{_mandir}/man8/ovs-appctl.8*
336 %{_mandir}/man8/ovs-bugtool.8*
337 %{_mandir}/man8/ovs-ctl.8*
338 %{_mandir}/man8/ovs-dpctl.8*
339 %{_mandir}/man8/ovs-dpctl-top.8*
340 %{_mandir}/man8/ovs-ofctl.8*
341 %{_mandir}/man8/ovs-pki.8*
342 %{_mandir}/man8/ovs-vsctl.8*
343 %{_mandir}/man8/ovs-vswitchd.8*
344 %{_mandir}/man8/ovs-parse-backtrace.8*
345 %{_mandir}/man8/ovs-testcontroller.8*
346 %doc COPYING DESIGN.md INSTALL.SSL.md NOTICE README.md WHY-OVS.md
347 %doc FAQ.md NEWS INSTALL.DPDK.md rhel/README.RHEL
348 /var/lib/openvswitch
349 /var/log/openvswitch
350 %ghost %attr(755,root,root) %{_rundir}/openvswitch
351
352 %files ovn
353 %{_bindir}/ovn-controller
354 %{_bindir}/ovn-controller-vtep
355 %{_bindir}/ovn-docker-overlay-driver
356 %{_bindir}/ovn-docker-underlay-driver
357 %{_bindir}/ovn-nbctl
358 %{_bindir}/ovn-northd
359 %{_bindir}/ovn-sbctl
360 %{_datadir}/openvswitch/scripts/ovn-ctl
361 %{_datadir}/openvswitch/scripts/ovn-bugtool-nbctl-show
362 %{_datadir}/openvswitch/scripts/ovn-bugtool-sbctl-lflow-list
363 %{_datadir}/openvswitch/scripts/ovn-bugtool-sbctl-show
364 %{_mandir}/man8/ovs-testcontroller.8*
365 %{_mandir}/man5/ovn-nb.5*
366 %{_mandir}/man5/ovn-sb.5*
367 %{_mandir}/man7/ovn-architecture.7*
368 %{_mandir}/man8/ovn-controller.8*
369 %{_mandir}/man8/ovn-controller-vtep.8*
370 %{_mandir}/man8/ovn-ctl.8*
371 %{_mandir}/man8/ovn-nbctl.8*
372 %{_mandir}/man8/ovn-northd.8*
373 %{_mandir}/man8/ovn-sbctl.8*
374 %config %{_datadir}/openvswitch/ovn-nb.ovsschema
375 %config %{_datadir}/openvswitch/ovn-sb.ovsschema
376 %{_unitdir}/ovn-controller.service
377 %{_unitdir}/ovn-controller-vtep.service
378 %{_unitdir}/ovn-northd.service
379
380 %changelog
381 * Wed Jan 12 2011 Ralf Spenneberg <ralf@os-s.net>
382 - First build on F14