1 # Spec file for Open vSwitch.
3 # Copyright (C) 2009, 2010, 2013, 2014, 2015, 2016 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 # 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
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.
24 #%define kernel 2.6.40.4-5.fc15.x86_64
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
31 # Enable Python 3 by specifying '--with build_python3'.
32 # This is enabled by default for versions of the distribution that
33 # have Python 3 by default (Fedora > 22).
34 %bcond_with build_python3
35 # If there is a need to automatically enable the package after installation,
36 # specify the "--with autoenable"
37 %bcond_with autoenable
39 # Enable PIE, bz#955181
40 %global _hardened_build
1
42 # some distros (e.g: RHEL-7) don't define _rundir macro yet
43 # Fedora 15 onwards uses /run as _rundir
48 # define the python package prefix based on distribution version so that we can
49 # simultaneously support RHEL-based and later Fedora versions in this spec file.
54 %if 0%{?rhel} || 0%{?fedora} < 25
61 Group: System Environment
/Daemons
62 URL: http
://www.openvswitch.org
/
65 # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the
66 # lib/sflow*.[ch] files are SISSL
67 # datapath/ is GPLv2 (although not built into any of the binary packages)
68 License: ASL
2.0 and LGPLv2
+ and SISSL
70 Source: http
://openvswitch.org
/releases
/%{name}-%{version}.tar.gz
72 BuildRequires
: gcc gcc
-c
++
73 BuildRequires
: autoconf automake libtool
74 BuildRequires
: systemd
-units openssl openssl
-devel
75 BuildRequires
: %{_py2}-devel
76 %if 0%{?fedora} > 22 || %{with build_python3}
77 BuildRequires
: python3
-devel
79 BuildRequires
: desktop
-file
-utils
80 BuildRequires
: groff graphviz
81 BuildRequires
: checkpolicy
, selinux
-policy
-devel
82 BuildRequires
: /usr
/bin
/sphinx
-build
83 # make check dependencies
84 BuildRequires
: %{_py2}-twisted%{?rhel:-core} %{_py2}-zope-interface %{_py2}-six
85 BuildRequires
: procps
-ng
87 BuildRequires
: libcap
-ng libcap
-ng
-devel
90 BuildRequires
: libpcap
-devel numactl
-devel
91 BuildRequires
: dpdk
-devel
>= 17.05.1
92 Provides: %{name}-dpdk = %{version}-%{release}
94 BuildRequires
: unbound unbound
-devel
96 Requires: openssl hostname iproute module
-init
-tools unbound
97 #Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
98 #Requires: kernel >= 3.15.0-0
100 Requires(pre
): shadow
-utils
101 Requires(post
): /bin
/sed
102 Requires(post
): systemd
-units
103 Requires(preun
): systemd
-units
104 Requires(postun
): systemd
-units
105 Obsoletes
: openvswitch
-controller
<= 0:2.1.0-1
107 # to skip running checks, pass --without check
109 %bcond_with check_datapath_kernel
112 Open vSwitch provides standard network bridging functions and
113 support
for the OpenFlow protocol
for remote per
-flow control of
116 %package selinux
-policy
117 Summary: Open vSwitch SELinux policy
120 Requires: selinux
-policy
-targeted
122 %description selinux
-policy
123 Tailored Open vSwitch SELinux policy
125 %package -n
%{_py2}-openvswitch
126 Summary: Open vSwitch python2 bindings
130 Requires: %{_py2}-six
131 %{?python_provide:%python_provide python2-openvswitch = %{version}-%{release}}
132 %description -n
%{_py2}-openvswitch
133 Python bindings
for the Open vSwitch database
135 %if 0%{?fedora} > 22 || %{with build_python3}
136 %package -n python3
-openvswitch
137 Summary: Open vSwitch python3 bindings
141 Requires: python3
-six
142 %{?python_provide:%python_provide python3-openvswitch = %{version}-%{release}}
144 %description -n python3
-openvswitch
145 Python bindings
for the Open vSwitch database
149 Summary: Open vSwitch testing utilities
152 Requires: %{_py2}-openvswitch = %{version}-%{release}
153 Requires: %{_py2} %{_py2}-netifaces %{_py2}-twisted
156 Utilities that are useful to diagnose performance and connectivity
157 issues
in Open vSwitch setup.
160 Summary: Open vSwitch OpenFlow development package
(library
, headers
)
164 This provides shared library
, libopenswitch.so and the openvswitch header
165 files needed to build an external application.
167 %if 0%{?rhel} > 7 || 0%{?fedora} > 28
168 %package -n network
-scripts
-%{name}
169 Summary: Open vSwitch legacy network service support
171 Requires: network
-scripts
172 Supplements
: (%{name} and network
-scripts
)
174 %description -n network
-scripts
-%{name}
175 This provides the ifup and ifdown scripts
for use with the legacy network
180 Summary: Open vSwitch IPsec tunneling support
182 Requires: openvswitch
%{_py2}-openvswitch libreswan
185 This package provides IPsec tunneling support
for OVS tunnels.
198 --with
-dpdk
=$
(dirname
%{_datadir}/dpdk
/*/.config
) \
203 --with
-pkidir
=%{_sharedstatedir}/openvswitch
/pki \
204 %if 0%{?fedora} > 22 || %{with build_python3}
205 PYTHON3
=%{__python3} \
211 build
-aux
/dpdkstrip.py \
217 < rhel
/usr_lib_systemd_system_ovs
-vswitchd.service.
in \
218 > rhel
/usr_lib_systemd_system_ovs
-vswitchd.service
224 rm -rf $RPM_BUILD_ROOT
225 make install DESTDIR
=$RPM_BUILD_ROOT
227 install -d
-m
0755 $RPM_BUILD_ROOT
%{_rundir}/openvswitch
228 install -d
-m
0750 $RPM_BUILD_ROOT
%{_localstatedir}/log
/openvswitch
229 install -d
-m
0755 $RPM_BUILD_ROOT
%{_sysconfdir}/openvswitch
232 dst
=$RPM_BUILD_ROOT
/$
2
233 install -d
-m
0755 $dst
234 install -m
0644 $src
/*.h $dst
236 copy_headers include
%{_includedir}/openvswitch
237 copy_headers include
/openflow
%{_includedir}/openvswitch
/openflow
238 copy_headers include
/openvswitch
%{_includedir}/openvswitch
/openvswitch
239 copy_headers include
/sparse
%{_includedir}/openvswitch
/sparse
240 copy_headers include
/sparse
/arpa
%{_includedir}/openvswitch
/sparse
/arpa
241 copy_headers include
/sparse
/netinet
%{_includedir}/openvswitch
/sparse
/netinet
242 copy_headers include
/sparse
/sys
%{_includedir}/openvswitch
/sparse
/sys
243 copy_headers lib
%{_includedir}/openvswitch
/lib
246 install -p
-D
-m
0644 rhel
/usr_lib_udev_rules.d_91
-vfio.rules \
247 $RPM_BUILD_ROOT
%{_prefix}/lib
/udev
/rules.d
/91-vfio.rules
250 install -p
-D
-m
0644 \
251 rhel
/usr_share_openvswitch_scripts_systemd_sysconfig.template \
252 $RPM_BUILD_ROOT
/%{_sysconfdir}/sysconfig
/openvswitch
253 for service
in openvswitch ovsdb
-server ovs
-vswitchd ovs
-delete
-transient
-ports \
254 openvswitch
-ipsec
; do
255 install -p
-D
-m
0644 \
256 rhel
/usr_lib_systemd_system_$
{service
}.service \
257 $RPM_BUILD_ROOT
%{_unitdir}/${service}.service
259 install -m
0755 rhel
/etc_init.d_openvswitch \
260 $RPM_BUILD_ROOT
%{_datadir}/openvswitch
/scripts
/openvswitch.init
262 install -p
-D
-m
0644 rhel
/etc_openvswitch_default.conf \
263 $RPM_BUILD_ROOT
/%{_sysconfdir}/openvswitch
/default.conf
265 install -p
-D
-m
0644 rhel
/etc_logrotate.d_openvswitch \
266 $RPM_BUILD_ROOT
/%{_sysconfdir}/logrotate.d
/openvswitch
268 install -m
0644 vswitchd
/vswitch.ovsschema \
269 $RPM_BUILD_ROOT
/%{_datadir}/openvswitch
/vswitch.ovsschema
271 install -d
-m
0755 $RPM_BUILD_ROOT
/%{_sysconfdir}/sysconfig
/network
-scripts
/
272 install -p
-m
0755 rhel
/etc_sysconfig_network
-scripts_ifdown
-ovs \
273 $RPM_BUILD_ROOT
/%{_sysconfdir}/sysconfig
/network
-scripts
/ifdown
-ovs
274 install -p
-m
0755 rhel
/etc_sysconfig_network
-scripts_ifup
-ovs \
275 $RPM_BUILD_ROOT
/%{_sysconfdir}/sysconfig
/network
-scripts
/ifup
-ovs
277 install -d
-m
0755 $RPM_BUILD_ROOT
%{python2_sitelib}
278 cp
-a $RPM_BUILD_ROOT
/%{_datadir}/openvswitch
/python
/* \
279 $RPM_BUILD_ROOT
%{python2_sitelib}
281 %if 0%{?fedora} > 22 || %{with build_python3}
282 install -d
-m
0755 $RPM_BUILD_ROOT
%{python3_sitelib}
283 cp
-a $RPM_BUILD_ROOT
/%{_datadir}/openvswitch
/python
/ovs \
284 $RPM_BUILD_ROOT
%{python3_sitelib}
287 rm -rf $RPM_BUILD_ROOT
/%{_datadir}/openvswitch
/python
/
289 install -d
-m
0755 $RPM_BUILD_ROOT
/%{_sharedstatedir}/openvswitch
291 touch $RPM_BUILD_ROOT
%{_sysconfdir}/openvswitch
/conf.db
292 touch $RPM_BUILD_ROOT
%{_sysconfdir}/openvswitch
/.conf.db.~lock~
293 touch $RPM_BUILD_ROOT
%{_sysconfdir}/openvswitch
/system
-id.conf
295 install -p
-m
644 -D selinux
/openvswitch
-custom.pp \
296 $RPM_BUILD_ROOT
%{_datadir}/selinux/packages/%{name}/openvswitch
-custom.pp
298 install -d $RPM_BUILD_ROOT
%{_prefix}/lib
/firewalld
/services
/
300 install -p
-D
-m
0755 \
301 rhel
/usr_share_openvswitch_scripts_ovs
-systemd
-reload \
302 $RPM_BUILD_ROOT
%{_datadir}/openvswitch
/scripts
/ovs
-systemd
-reload
304 # remove unpackaged files
305 rm -f $RPM_BUILD_ROOT
%{_bindir}/ovs
-parse
-backtrace \
306 $RPM_BUILD_ROOT
%{_sbindir}/ovs
-vlan
-bug
-workaround \
307 $RPM_BUILD_ROOT
%{_mandir}/man8
/ovs
-vlan
-bug
-workaround
.8
309 # remove ovn unpackages files
310 rm -f $RPM_BUILD_ROOT
%{_bindir}/ovn
*
311 rm -f $RPM_BUILD_ROOT
%{_mandir}/man1
/ovn
*
312 rm -f $RPM_BUILD_ROOT
%{_mandir}/man5
/ovn
*
313 rm -f $RPM_BUILD_ROOT
%{_mandir}/man7
/ovn
*
314 rm -f $RPM_BUILD_ROOT
%{_mandir}/man8
/ovn
*
315 rm -f $RPM_BUILD_ROOT
%{_datadir}/openvswitch
/ovn
*
316 rm -f $RPM_BUILD_ROOT
%{_datadir}/openvswitch
/scripts
/ovn
*
317 rm -f $RPM_BUILD_ROOT
%{_includedir}/ovn
/*
318 rm -f $RPM_BUILD_ROOT
%{_libdir}/libovn
*
323 export OVS_RESOLV_CONF
=$
(pwd)/resolv.conf
324 if make check TESTSUITEFLAGS
='
%{_smp_mflags}' RECHECK
=yes
; then :;
326 cat tests
/testsuite.log
330 %if %{with check_datapath_kernel}
331 if make check
-kernel RECHECK
=yes
; then :;
333 cat tests
/system
-kmod
-testsuite.log
339 rm -rf $RPM_BUILD_ROOT
342 %selinux_relabel_pre -s targeted
345 %if 0%{?systemd_preun:1}
346 %systemd_preun %{name}.service
348 if [ $
1 -eq
0 ] ; then
349 # Package removal, not upgrade
350 /bin
/systemctl
--no
-reload disable
%{name}.service
>/dev
/null
2>&1 ||
:
351 /bin
/systemctl stop
%{name}.service
>/dev
/null
2>&1 ||
:
357 getent group openvswitch
>/dev
/null || groupadd
-r openvswitch
358 getent passwd openvswitch
>/dev
/null || \
359 useradd
-r
-g openvswitch
-d
/ -s
/sbin
/nologin \
360 -c "Open vSwitch Daemons" openvswitch
363 getent group hugetlbfs
>/dev
/null || groupadd
-r hugetlbfs
364 usermod
-a
-G hugetlbfs openvswitch
368 %if %{with autoenable}
369 if [ -x "
/etc
/init.d
/openvswitch"
]; then
370 touch
%{_tmppath}/ovs
-upgrade
-from
-sysv
377 if [ $
1 -eq
1 ]; then
378 sed
-i 's
:^
#OVS_USER_ID=:OVS_USER_ID=:' /etc/sysconfig/openvswitch
379 sed
-i 's
:\
(.
*su\
).
*:\
1 openvswitch openvswitch
:'
%{_sysconfdir}/logrotate.d
/openvswitch
383 's@OVS_USER_ID
="openvswitch
:openvswitch"@OVS_USER_ID
="openvswitch
:hugetlbfs"@'\
384 /etc
/sysconfig
/openvswitch
387 # In the case of upgrade, this is not needed.
388 chown
-R openvswitch
:openvswitch
/etc
/openvswitch
389 chown
-R openvswitch
:openvswitch
/var
/log
/openvswitch
393 %if 0%{?systemd_post:1}
394 # This may not enable openvswitch service or do daemon-reload.
395 %systemd_post %{name}.service
397 # Package install, not upgrade
398 if [ $
1 -eq
1 ]; then
399 /bin
/systemctl daemon
-reload
>dev
/null ||
:
403 %if %{with autoenable}
404 systemctl daemon
-reload
405 systemctl
enable openvswitch
406 # Handle upgrades to this package from the OVS repo's rhel packages.
407 # One "restart" is needed for newer systemd files to see the old running
408 # daemons. Another "restart" (outside the package postinst script) is
409 # needed to actually run new daemons.
410 if [ -e "
%{_tmppath}/ovs
-upgrade
-from
-sysv"
]; then
411 systemctl restart openvswitch
412 rm "
%{_tmppath}/ovs
-upgrade
-from
-sysv"
417 %selinux_modules_install -s targeted
%{_datadir}/selinux/packages/%{name}/openvswitch
-custom.pp
420 %if 0%{?systemd_postun:1}
421 %systemd_postun %{name}.service
423 /bin
/systemctl daemon
-reload
>/dev
/null
2>&1 ||
:
426 %postun selinux
-policy
427 if [ $
1 -eq
0 ] ; then
428 %selinux_modules_uninstall -s targeted openvswitch
-custom
431 %posttrans selinux
-policy
432 %selinux_relabel_post -s targeted
434 %files selinux
-policy
435 %defattr(-,root
,root
)
436 %{_datadir}/selinux/packages/%{name}/openvswitch
-custom.pp
438 %files -n
%{_py2}-openvswitch
439 %{python2_sitelib}/ovs
441 %if 0%{?fedora} > 22 || %{with build_python3}
442 %files -n python3
-openvswitch
443 %{python3_sitelib}/ovs
448 %{_bindir}/ovs
-vlan
-test
449 %{_bindir}/ovs
-l3ping
451 %{_bindir}/ovs
-tcpdump
452 %{_bindir}/ovs
-tcpundump
453 %{_mandir}/man8
/ovs
-test.8*
454 %{_mandir}/man8
/ovs
-vlan
-test.8*
455 %{_mandir}/man8
/ovs
-l3ping
.8*
456 %{_mandir}/man1
/ovs
-pcap
.1*
457 %{_mandir}/man8
/ovs
-tcpdump
.8*
458 %{_mandir}/man1
/ovs
-tcpundump
.1*
459 %{python2_sitelib}/ovstest
463 %{_libdir}/pkgconfig
/*.pc
464 %{_includedir}/openvswitch
/*
465 %{_includedir}/openflow
/*
466 %exclude %{_libdir}/*.la
468 %if 0%{?rhel} > 7 || 0%{?fedora} > 28
469 %files -n network
-scripts
-%{name}
470 %{_sysconfdir}/sysconfig
/network
-scripts
/ifup
-ovs
471 %{_sysconfdir}/sysconfig
/network
-scripts
/ifdown
-ovs
476 %defattr(-,openvswitch
,openvswitch
)
478 %defattr(-,root
,root
)
480 %dir %{_sysconfdir}/openvswitch
481 %{_sysconfdir}/openvswitch
/default.conf
482 %config %ghost %{_sysconfdir}/openvswitch
/conf.db
483 %ghost %{_sysconfdir}/openvswitch
/.conf.db.~lock~
484 %config %ghost %{_sysconfdir}/openvswitch
/system
-id.conf
485 %config(noreplace
) %{_sysconfdir}/sysconfig
/openvswitch
486 %defattr(-,root
,root
)
487 %{_sysconfdir}/bash_completion.d
/ovs
-appctl
-bashcomp.bash
488 %{_sysconfdir}/bash_completion.d
/ovs
-vsctl
-bashcomp.bash
489 %config(noreplace
) %{_sysconfdir}/logrotate.d
/openvswitch
490 %{_unitdir}/openvswitch.service
491 %{_unitdir}/ovsdb
-server.service
492 %{_unitdir}/ovs
-vswitchd.service
493 %{_unitdir}/ovs
-delete
-transient
-ports.service
494 %{_datadir}/openvswitch
/scripts
/openvswitch.init
495 %if ! (0%{?rhel} > 7 || 0%{?fedora} > 28)
496 %{_sysconfdir}/sysconfig
/network
-scripts
/ifup
-ovs
497 %{_sysconfdir}/sysconfig
/network
-scripts
/ifdown
-ovs
499 %{_datadir}/openvswitch
/bugtool
-plugins
/
500 %{_datadir}/openvswitch
/scripts
/ovs
-bugtool
-*
501 %{_datadir}/openvswitch
/scripts
/ovs
-check
-dead
-ifs
502 %{_datadir}/openvswitch
/scripts
/ovs
-lib
503 %{_datadir}/openvswitch
/scripts
/ovs
-save
504 %{_datadir}/openvswitch
/scripts
/ovs
-vtep
505 %{_datadir}/openvswitch
/scripts
/ovs
-ctl
506 %{_datadir}/openvswitch
/scripts
/ovs
-kmod
-ctl
507 %{_datadir}/openvswitch
/scripts
/ovs
-systemd
-reload
508 %config %{_datadir}/openvswitch
/vswitch.ovsschema
509 %config %{_datadir}/openvswitch
/vtep.ovsschema
510 %{_bindir}/ovs
-appctl
511 %{_bindir}/ovs
-docker
513 %{_bindir}/ovs
-dpctl
-top
516 %{_bindir}/ovsdb
-client
517 %{_bindir}/ovsdb
-tool
518 %{_bindir}/ovs
-testcontroller
522 %{_sbindir}/ovs
-bugtool
523 %{_sbindir}/ovs
-vswitchd
524 %{_sbindir}/ovsdb
-server
525 %{_mandir}/man1
/ovsdb
-client
.1*
526 %{_mandir}/man1
/ovsdb
-server
.1*
527 %{_mandir}/man1
/ovsdb
-tool
.1*
528 %{_mandir}/man5
/ovsdb
-server
.5*
529 %{_mandir}/man5
/ovs
-vswitchd.conf.db
.5*
530 %{_mandir}/man5
/ovsdb
.5*
531 %{_mandir}/man5
/vtep
.5*
532 %{_mandir}/man7
/ovs
-actions
.7*
533 %{_mandir}/man7
/ovs
-fields
.7*
534 %{_mandir}/man7
/ovsdb
.7*
535 %{_mandir}/man7
/ovsdb
-server
.7*
536 %{_mandir}/man8
/vtep
-ctl
.8*
537 %{_mandir}/man8
/ovs
-appctl
.8*
538 %{_mandir}/man8
/ovs
-bugtool
.8*
539 %{_mandir}/man8
/ovs
-ctl
.8*
540 %{_mandir}/man8
/ovs
-dpctl
.8*
541 %{_mandir}/man8
/ovs
-dpctl
-top
.8*
542 %{_mandir}/man8
/ovs
-kmod
-ctl
.8*
543 %{_mandir}/man8
/ovs
-ofctl
.8*
544 %{_mandir}/man8
/ovs
-pki
.8*
545 %{_mandir}/man8
/ovs
-vsctl
.8*
546 %{_mandir}/man8
/ovs
-vswitchd
.8*
547 %{_mandir}/man8
/ovs
-parse
-backtrace
.8*
548 %{_mandir}/man8
/ovs
-testcontroller
.8*
550 %{_prefix}/lib
/udev
/rules.d
/91-vfio.rules
552 %doc NOTICE README.rst NEWS rhel
/README.RHEL.rst
554 %attr(750,root
,root
) /var
/log
/openvswitch
555 %ghost %attr(755,root
,root
) %{_rundir}/openvswitch
556 %ghost %attr(644,root
,root
) %{_rundir}/openvswitch.useropts
559 %{_datadir}/openvswitch
/scripts
/ovs
-monitor
-ipsec
560 %{_unitdir}/openvswitch
-ipsec.service
563 * Wed Jan
12 2011 Ralf Spenneberg
<ralf@os
-s.net
>