]> git.proxmox.com Git - mirror_ovs.git/blob - rhel/openvswitch-fedora.spec.in
OVN: Fix OCF symbolic link lost after ovn-common upgrade
[mirror_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 # Support for executing kernel data path tests under rpmbuild is
15 # provided, however this is intended for use only in test environments
16 # and should not be used otherwise (these tests require root privileges).
17 # These tests can be executed, for example, via:
18 # rpmbuild -rb --with check_datapath_kernel openvswitch-fedora.src.rpm
19 #
20 # These tests will use the currently installed OVS kernel modules, when
21 # testing out of tree kernel modules the appropriate openvswitch-kmod
22 # package should be installed first.
23
24 #%define kernel 2.6.40.4-5.fc15.x86_64
25
26 # If libcap-ng isn't available and there is no need for running OVS
27 # as regular user, specify the '--without libcapng'
28 %bcond_without libcapng
29 # To enable DPDK support, specify '--with dpdk' when building
30 %bcond_with dpdk
31
32 # Enable PIE, bz#955181
33 %global _hardened_build 1
34
35 # some distros (e.g: RHEL-7) don't define _rundir macro yet
36 # Fedora 15 onwards uses /run as _rundir
37 %if 0%{!?_rundir:1}
38 %define _rundir /run
39 %endif
40
41 Name: openvswitch
42 Summary: Open vSwitch
43 Group: System Environment/Daemons
44 URL: http://www.openvswitch.org/
45 Version: @VERSION@
46
47 # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the
48 # lib/sflow*.[ch] files are SISSL
49 # datapath/ is GPLv2 (although not built into any of the binary packages)
50 License: ASL 2.0 and LGPLv2+ and SISSL
51 Release: 1%{?dist}
52 Source: http://openvswitch.org/releases/%{name}-%{version}.tar.gz
53
54 BuildRequires: autoconf automake libtool
55 BuildRequires: systemd-units openssl openssl-devel
56 BuildRequires: python python-twisted-core python-zope-interface python-six
57 BuildRequires: desktop-file-utils
58 BuildRequires: groff graphviz
59 BuildRequires: checkpolicy, selinux-policy-devel
60 # make check dependencies
61 BuildRequires: procps-ng
62 %if %{with libcapng}
63 BuildRequires: libcap-ng libcap-ng-devel
64 %endif
65 %if %{with dpdk}
66 BuildRequires: dpdk-devel >= 2.2.0
67 Provides: %{name}-dpdk = %{version}-%{release}
68 %endif
69
70 Requires: openssl iproute module-init-tools
71 #Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
72 #Requires: kernel >= 3.15.0-0
73
74 Requires(post): systemd-units
75 Requires(preun): systemd-units
76 Requires(postun): systemd-units
77 Obsoletes: openvswitch-controller <= 0:2.1.0-1
78
79 %bcond_without check
80 %bcond_with check_datapath_kernel
81
82 %description
83 Open vSwitch provides standard network bridging functions and
84 support for the OpenFlow protocol for remote per-flow control of
85 traffic.
86
87 %package selinux-policy
88 Summary: Open vSwitch SELinux policy
89 License: ASL 2.0
90 BuildArch: noarch
91 Requires: selinux-policy-targeted
92
93 %description selinux-policy
94 Tailored Open vSwitch SELinux policy
95
96 %package -n python-openvswitch
97 Summary: Open vSwitch python bindings
98 License: ASL 2.0
99 BuildArch: noarch
100 Requires: python
101 Requires: python-six
102
103 %description -n python-openvswitch
104 Python bindings for the Open vSwitch database
105
106 %package test
107 Summary: Open vSwitch testing utilities
108 License: ASL 2.0
109 BuildArch: noarch
110 Requires: python-openvswitch = %{version}-%{release}
111 Requires: python python-twisted-core python-twisted-web
112
113 %description test
114 Utilities that are useful to diagnose performance and connectivity
115 issues in Open vSwitch setup.
116
117 %package devel
118 Summary: Open vSwitch OpenFlow development package (library, headers)
119 License: ASL 2.0
120 Provides: openvswitch-static = %{version}-%{release}
121
122 %description devel
123 This provides static library, libopenswitch.a and the openvswitch header
124 files needed to build an external application.
125
126 %package ovn-central
127 Summary: Open vSwitch - Open Virtual Network support
128 License: ASL 2.0
129 Requires: openvswitch openvswitch-ovn-common
130
131 %description ovn-central
132 OVN, the Open Virtual Network, is a system to support virtual network
133 abstraction. OVN complements the existing capabilities of OVS to add
134 native support for virtual network abstractions, such as virtual L2 and L3
135 overlays and security groups.
136
137 %package ovn-host
138 Summary: Open vSwitch - Open Virtual Network support
139 License: ASL 2.0
140 Requires: openvswitch openvswitch-ovn-common
141
142 %description ovn-host
143 OVN, the Open Virtual Network, is a system to support virtual network
144 abstraction. OVN complements the existing capabilities of OVS to add
145 native support for virtual network abstractions, such as virtual L2 and L3
146 overlays and security groups.
147
148 %package ovn-vtep
149 Summary: Open vSwitch - Open Virtual Network support
150 License: ASL 2.0
151 Requires: openvswitch openvswitch-ovn-common
152
153 %description ovn-vtep
154 OVN vtep controller
155
156 %package ovn-common
157 Summary: Open vSwitch - Open Virtual Network support
158 License: ASL 2.0
159 Requires: openvswitch
160
161 %description ovn-common
162 Utilities that are use to diagnose and manage the OVN components.
163
164 %package ovn-docker
165 Summary: Open vSwitch - Open Virtual Network support
166 License: ASL 2.0
167 Requires: openvswitch openvswitch-ovn-common python-openvswitch
168
169 %description ovn-docker
170 Docker network plugins for OVN.
171
172 %prep
173 %setup -q
174
175 %build
176 %configure \
177 %if %{with libcapng}
178 --enable-libcapng \
179 %else
180 --disable-libcapng \
181 %endif
182 %if %{with dpdk}
183 --with-dpdk=$(dirname %{_datadir}/dpdk/*/.config) \
184 %endif
185 --enable-ssl \
186 --with-pkidir=%{_sharedstatedir}/openvswitch/pki
187
188 make %{?_smp_mflags}
189 cd selinux
190 make -f %{_datadir}/selinux/devel/Makefile
191
192 %install
193 rm -rf $RPM_BUILD_ROOT
194 make install DESTDIR=$RPM_BUILD_ROOT
195
196 install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch
197
198 install -p -D -m 0644 \
199 rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
200 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/openvswitch
201 for service in openvswitch ovsdb-server ovs-vswitchd \
202 ovn-controller ovn-controller-vtep ovn-northd; do
203 install -p -D -m 0644 \
204 rhel/usr_lib_systemd_system_${service}.service \
205 $RPM_BUILD_ROOT%{_unitdir}/${service}.service
206 done
207 install -m 0755 rhel/etc_init.d_openvswitch \
208 $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/openvswitch.init
209
210 install -p -D -m 0644 rhel/etc_logrotate.d_openvswitch \
211 $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/openvswitch
212
213 install -m 0644 vswitchd/vswitch.ovsschema \
214 $RPM_BUILD_ROOT/%{_datadir}/openvswitch/vswitch.ovsschema
215
216 install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/
217 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifdown-ovs \
218 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
219 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \
220 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
221
222 install -d -m 0755 $RPM_BUILD_ROOT%{python_sitelib}
223 mv $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/* \
224 $RPM_BUILD_ROOT%{python_sitelib}
225 rmdir $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
226
227 install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
228
229 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
230 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf
231
232 install -p -m 644 -D selinux/openvswitch-custom.pp \
233 $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp
234
235 # remove unpackaged files
236 rm -f $RPM_BUILD_ROOT%{_bindir}/ovs-parse-backtrace \
237 $RPM_BUILD_ROOT%{_sbindir}/ovs-vlan-bug-workaround \
238 $RPM_BUILD_ROOT%{_mandir}/man8/ovs-vlan-bug-workaround.8
239
240 %check
241 %if %{with check}
242 if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :;
243 else
244 cat tests/testsuite.log
245 exit 1
246 fi
247 %endif
248 %if %{with check_datapath_kernel}
249 if make check-kernel RECHECK=yes; then :;
250 else
251 cat tests/system-kmod-testsuite.log
252 exit 1
253 fi
254 %endif
255
256 %clean
257 rm -rf $RPM_BUILD_ROOT
258
259 %preun
260 %if 0%{?systemd_preun:1}
261 %systemd_preun %{name}.service
262 %else
263 if [ $1 -eq 0 ] ; then
264 # Package removal, not upgrade
265 /bin/systemctl --no-reload disable %{name}.service >/dev/null 2>&1 || :
266 /bin/systemctl stop %{name}.service >/dev/null 2>&1 || :
267 fi
268 %endif
269
270 %preun ovn-central
271 %if 0%{?systemd_preun:1}
272 %systemd_preun ovn-northd.service
273 %else
274 if [ $1 -eq 0 ] ; then
275 # Package removal, not upgrade
276 /bin/systemctl --no-reload disable ovn-northd.service >/dev/null 2>&1 || :
277 /bin/systemctl stop ovn-northd.service >/dev/null 2>&1 || :
278 fi
279 %endif
280
281 %preun ovn-host
282 %if 0%{?systemd_preun:1}
283 %systemd_preun ovn-controller.service
284 %else
285 if [ $1 -eq 0 ] ; then
286 # Package removal, not upgrade
287 /bin/systemctl --no-reload disable ovn-controller.service >/dev/null 2>&1 || :
288 /bin/systemctl stop ovn-controller.service >/dev/null 2>&1 || :
289 fi
290 %endif
291
292 %preun ovn-vtep
293 %if 0%{?systemd_preun:1}
294 %systemd_preun ovn-controller-vtep.service
295 %else
296 if [ $1 -eq 0 ] ; then
297 # Package removal, not upgrade
298 /bin/systemctl --no-reload disable ovn-controller-vtep.service >/dev/null 2>&1 || :
299 /bin/systemctl stop ovn-controller-vtep.service >/dev/null 2>&1 || :
300 fi
301 %endif
302
303 %post
304 %if 0%{?systemd_post:1}
305 %systemd_post %{name}.service
306 %else
307 # Package install, not upgrade
308 if [ $1 -eq 1 ]; then
309 /bin/systemctl daemon-reload >dev/null || :
310 fi
311 %endif
312
313 %post ovn-common
314 mkdir -p /usr/lib/ocf/resource.d/ovn
315 ln -sf %{_datadir}/openvswitch/scripts/ovndb-servers.ocf /usr/lib/ocf/resource.d/ovn/ovndb-servers
316
317 %post ovn-central
318 %if 0%{?systemd_post:1}
319 %systemd_post ovn-northd.service
320 %else
321 # Package install, not upgrade
322 if [ $1 -eq 1 ]; then
323 /bin/systemctl daemon-reload >dev/null || :
324 fi
325 %endif
326
327 %post ovn-host
328 %if 0%{?systemd_post:1}
329 %systemd_post ovn-controller.service
330 %else
331 # Package install, not upgrade
332 if [ $1 -eq 1 ]; then
333 /bin/systemctl daemon-reload >dev/null || :
334 fi
335 %endif
336
337 %post ovn-vtep
338 %if 0%{?systemd_post:1}
339 %systemd_post ovn-controller-vtep.service
340 %else
341 # Package install, not upgrade
342 if [ $1 -eq 1 ]; then
343 /bin/systemctl daemon-reload >dev/null || :
344 fi
345 %endif
346
347 %post selinux-policy
348 /usr/sbin/semodule -i %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp &> /dev/null || :
349
350 %postun
351 %if 0%{?systemd_postun:1}
352 %systemd_postun %{name}.service
353 %else
354 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
355 %endif
356
357 %postun ovn-common
358 if [ $1 -eq 0 ] ; then
359 # Package removal, not upgrade
360 rm -rf /usr/lib/ocf/resource.d/ovn
361 fi
362
363 %postun ovn-central
364 %if 0%{?systemd_postun_with_restart:1}
365 %systemd_postun_with_restart ovn-northd.service
366 %else
367 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
368 if [ "$1" -ge "1" ] ; then
369 # Package upgrade, not uninstall
370 /bin/systemctl try-restart ovn-northd.service >/dev/null 2>&1 || :
371 fi
372 %endif
373
374 %postun ovn-host
375 %if 0%{?systemd_postun_with_restart:1}
376 %systemd_postun_with_restart ovn-controller.service
377 %else
378 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
379 if [ "$1" -ge "1" ] ; then
380 # Package upgrade, not uninstall
381 /bin/systemctl try-restart ovn-controller.service >/dev/null 2>&1 || :
382 fi
383 %endif
384
385 %postun ovn-vtep
386 %if 0%{?systemd_postun_with_restart:1}
387 %systemd_postun_with_restart ovn-controller-vtep.service
388 %else
389 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
390 if [ "$1" -ge "1" ] ; then
391 # Package upgrade, not uninstall
392 /bin/systemctl try-restart ovn-controller-vtep.service >/dev/null 2>&1 || :
393 fi
394 %endif
395
396 %postun selinux-policy
397 if [ $1 -eq 0 ] ; then
398 /usr/sbin/semodule -r openvswitch-custom &> /dev/null || :
399 fi
400
401 %files selinux-policy
402 %defattr(-,root,root)
403 %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp
404
405 %files -n python-openvswitch
406 %{python_sitelib}/ovs
407 %doc COPYING
408
409 %files test
410 %{_bindir}/ovs-test
411 %{_bindir}/ovs-vlan-test
412 %{_bindir}/ovs-l3ping
413 %{_bindir}/ovs-pcap
414 %{_bindir}/ovs-tcpdump
415 %{_bindir}/ovs-tcpundump
416 %{_mandir}/man8/ovs-test.8*
417 %{_mandir}/man8/ovs-vlan-test.8*
418 %{_mandir}/man8/ovs-l3ping.8*
419 %{_mandir}/man1/ovs-pcap.1*
420 %{_mandir}/man8/ovs-tcpdump.8*
421 %{_mandir}/man1/ovs-tcpundump.1*
422 %{python_sitelib}/ovstest
423
424 %files devel
425 %{_libdir}/*.a
426 %{_libdir}/*.la
427 %{_libdir}/pkgconfig/*.pc
428 %{_includedir}/openvswitch/*
429 %{_includedir}/openflow/*
430 %{_includedir}/ovn/*
431
432 %files
433 %defattr(-,root,root)
434 %{_sysconfdir}/bash_completion.d/ovs-appctl-bashcomp.bash
435 %{_sysconfdir}/bash_completion.d/ovs-vsctl-bashcomp.bash
436 %dir %{_sysconfdir}/openvswitch
437 %config %ghost %{_sysconfdir}/openvswitch/conf.db
438 %config %ghost %{_sysconfdir}/openvswitch/system-id.conf
439 %config(noreplace) %{_sysconfdir}/sysconfig/openvswitch
440 %config(noreplace) %{_sysconfdir}/logrotate.d/openvswitch
441 %{_unitdir}/openvswitch.service
442 %{_unitdir}/ovsdb-server.service
443 %{_unitdir}/ovs-vswitchd.service
444 %{_datadir}/openvswitch/scripts/openvswitch.init
445 %{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
446 %{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
447 %{_datadir}/openvswitch/bugtool-plugins/
448 %{_datadir}/openvswitch/scripts/ovs-bugtool-*
449 %{_datadir}/openvswitch/scripts/ovs-check-dead-ifs
450 %{_datadir}/openvswitch/scripts/ovs-lib
451 %{_datadir}/openvswitch/scripts/ovs-save
452 %{_datadir}/openvswitch/scripts/ovs-vtep
453 %{_datadir}/openvswitch/scripts/ovs-ctl
454 %config %{_datadir}/openvswitch/vswitch.ovsschema
455 %config %{_datadir}/openvswitch/vtep.ovsschema
456 %{_bindir}/ovs-appctl
457 %{_bindir}/ovs-docker
458 %{_bindir}/ovs-dpctl
459 %{_bindir}/ovs-dpctl-top
460 %{_bindir}/ovs-ofctl
461 %{_bindir}/ovs-vsctl
462 %{_bindir}/ovsdb-client
463 %{_bindir}/ovsdb-tool
464 %{_bindir}/ovs-testcontroller
465 %{_bindir}/ovs-pki
466 %{_bindir}/vtep-ctl
467 %{_sbindir}/ovs-bugtool
468 %{_sbindir}/ovs-vswitchd
469 %{_sbindir}/ovsdb-server
470 %{_mandir}/man1/ovsdb-client.1*
471 %{_mandir}/man1/ovsdb-server.1*
472 %{_mandir}/man1/ovsdb-tool.1*
473 %{_mandir}/man5/ovs-vswitchd.conf.db.5*
474 %{_mandir}/man5/vtep.5*
475 %{_mandir}/man8/vtep-ctl.8*
476 %{_mandir}/man8/ovs-appctl.8*
477 %{_mandir}/man8/ovs-bugtool.8*
478 %{_mandir}/man8/ovs-ctl.8*
479 %{_mandir}/man8/ovs-dpctl.8*
480 %{_mandir}/man8/ovs-dpctl-top.8*
481 %{_mandir}/man8/ovs-ofctl.8*
482 %{_mandir}/man8/ovs-pki.8*
483 %{_mandir}/man8/ovs-vsctl.8*
484 %{_mandir}/man8/ovs-vswitchd.8*
485 %{_mandir}/man8/ovs-parse-backtrace.8*
486 %{_mandir}/man8/ovs-testcontroller.8*
487 %doc COPYING NOTICE README.rst NEWS rhel/README.RHEL.rst
488 /var/lib/openvswitch
489 /var/log/openvswitch
490 %ghost %attr(755,root,root) %{_rundir}/openvswitch
491
492 %files ovn-docker
493 %{_bindir}/ovn-docker-overlay-driver
494 %{_bindir}/ovn-docker-underlay-driver
495
496 %files ovn-common
497 %{_bindir}/ovn-nbctl
498 %{_bindir}/ovn-sbctl
499 %{_bindir}/ovn-trace
500 %{_datadir}/openvswitch/scripts/ovn-ctl
501 %{_datadir}/openvswitch/scripts/ovndb-servers.ocf
502 %{_datadir}/openvswitch/scripts/ovn-bugtool-nbctl-show
503 %{_datadir}/openvswitch/scripts/ovn-bugtool-sbctl-lflow-list
504 %{_datadir}/openvswitch/scripts/ovn-bugtool-sbctl-show
505 %{_mandir}/man8/ovn-ctl.8*
506 %{_mandir}/man8/ovn-nbctl.8*
507 %{_mandir}/man8/ovn-trace.8*
508 %{_mandir}/man7/ovn-architecture.7*
509 %{_mandir}/man8/ovn-sbctl.8*
510 %{_mandir}/man5/ovn-nb.5*
511 %{_mandir}/man5/ovn-sb.5*
512
513 %files ovn-central
514 %{_bindir}/ovn-northd
515 %{_mandir}/man8/ovn-northd.8*
516 %config %{_datadir}/openvswitch/ovn-nb.ovsschema
517 %config %{_datadir}/openvswitch/ovn-sb.ovsschema
518 %{_unitdir}/ovn-northd.service
519
520 %files ovn-host
521 %{_bindir}/ovn-controller
522 %{_mandir}/man8/ovn-controller.8*
523 %{_unitdir}/ovn-controller.service
524
525 %files ovn-vtep
526 %{_bindir}/ovn-controller-vtep
527 %{_mandir}/man8/ovn-controller-vtep.8*
528 %{_unitdir}/ovn-controller-vtep.service
529
530 %changelog
531 * Wed Jan 12 2011 Ralf Spenneberg <ralf@os-s.net>
532 - First build on F14