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 # To enable AF_XDP support, specify '--with afxdp' when building
34 # If there is a need to automatically enable the package after installation,
35 # specify the "--with autoenable"
36 %bcond_with autoenable
38 # Enable PIE, bz#955181
39 %global _hardened_build
1
41 # some distros (e.g: RHEL-7) don't define _rundir macro yet
42 # Fedora 15 onwards uses /run as _rundir
49 Group: System Environment
/Daemons
50 URL: http
://www.openvswitch.org
/
53 # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the
54 # lib/sflow*.[ch] files are SISSL
55 # datapath/ is GPLv2 (although not built into any of the binary packages)
56 License: ASL
2.0 and LGPLv2
+ and SISSL
58 Source: http
://openvswitch.org
/releases
/%{name}-%{version}.tar.gz
60 BuildRequires
: gcc gcc
-c
++
61 BuildRequires
: autoconf automake libtool
62 BuildRequires
: systemd
-units openssl openssl
-devel
63 BuildRequires
: python3
-devel
64 BuildRequires
: desktop
-file
-utils
65 BuildRequires
: groff graphviz
66 BuildRequires
: checkpolicy
, selinux
-policy
-devel
67 BuildRequires
: /usr
/bin
/sphinx
-build
-3
68 # make check dependencies
69 BuildRequires
: procps
-ng
71 BuildRequires
: libcap
-ng libcap
-ng
-devel
74 BuildRequires
: libpcap
-devel numactl
-devel
75 BuildRequires
: dpdk
-devel
>= 20.11
76 Provides: %{name}-dpdk = %{version}-%{release}
79 BuildRequires
: libbpf
-devel numactl
-devel
81 BuildRequires
: unbound unbound
-devel
83 Requires: openssl hostname iproute module
-init
-tools unbound
84 #Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
85 #Requires: kernel >= 3.15.0-0
87 Requires(pre
): shadow
-utils
88 Requires(post
): /bin
/sed
89 Requires(post
): systemd
-units
90 Requires(preun
): systemd
-units
91 Requires(postun
): systemd
-units
92 Obsoletes
: openvswitch
-controller
<= 0:2.1.0-1
94 # to skip running checks, pass --without check
96 %bcond_with check_datapath_kernel
99 Open vSwitch provides standard network bridging functions and
100 support
for the OpenFlow protocol
for remote per
-flow control of
103 %package selinux
-policy
104 Summary: Open vSwitch SELinux policy
107 Requires: selinux
-policy
-targeted
109 %description selinux
-policy
110 Tailored Open vSwitch SELinux policy
112 %package -n python3
-openvswitch
113 Summary: Open vSwitch python3 bindings
117 %{?python_provide:%python_provide python3-openvswitch = %{version}-%{release}}
119 %description -n python3
-openvswitch
120 Python bindings
for the Open vSwitch database
123 Summary: Open vSwitch testing utilities
128 Utilities that are useful to diagnose performance and connectivity
129 issues
in Open vSwitch setup.
132 Summary: Open vSwitch OpenFlow development package
(library
, headers
)
136 This provides shared library
, libopenswitch.so and the openvswitch header
137 files needed to build an external application.
139 %if 0%{?rhel} > 7 || 0%{?fedora} > 28
140 %package -n network
-scripts
-%{name}
141 Summary: Open vSwitch legacy network service support
143 Requires: network
-scripts
144 Supplements
: (%{name} and network
-scripts
)
146 %description -n network
-scripts
-%{name}
147 This provides the ifup and ifdown scripts
for use with the legacy network
152 Summary: Open vSwitch IPsec tunneling support
154 Requires: openvswitch python3
-openvswitch libreswan
157 This package provides IPsec tunneling support
for OVS tunnels.
178 --with
-pkidir
=%{_sharedstatedir}/openvswitch
/pki \
181 build
-aux
/dpdkstrip.py \
187 < rhel
/usr_lib_systemd_system_ovs
-vswitchd.service.
in \
188 > rhel
/usr_lib_systemd_system_ovs
-vswitchd.service
194 rm -rf $RPM_BUILD_ROOT
195 make install DESTDIR
=$RPM_BUILD_ROOT
197 install -d
-m
0755 $RPM_BUILD_ROOT
%{_rundir}/openvswitch
198 install -d
-m
0750 $RPM_BUILD_ROOT
%{_localstatedir}/log
/openvswitch
199 install -d
-m
0755 $RPM_BUILD_ROOT
%{_sysconfdir}/openvswitch
202 dst
=$RPM_BUILD_ROOT
/$
2
203 install -d
-m
0755 $dst
204 install -m
0644 $src
/*.h $dst
206 copy_headers include
%{_includedir}/openvswitch
207 copy_headers include
/openflow
%{_includedir}/openvswitch
/openflow
208 copy_headers include
/openvswitch
%{_includedir}/openvswitch
/openvswitch
209 copy_headers include
/sparse
%{_includedir}/openvswitch
/sparse
210 copy_headers include
/sparse
/arpa
%{_includedir}/openvswitch
/sparse
/arpa
211 copy_headers include
/sparse
/netinet
%{_includedir}/openvswitch
/sparse
/netinet
212 copy_headers include
/sparse
/sys
%{_includedir}/openvswitch
/sparse
/sys
213 copy_headers lib
%{_includedir}/openvswitch
/lib
216 install -p
-D
-m
0644 rhel
/usr_lib_udev_rules.d_91
-vfio.rules \
217 $RPM_BUILD_ROOT
%{_prefix}/lib
/udev
/rules.d
/91-vfio.rules
220 install -p
-D
-m
0644 \
221 rhel
/usr_share_openvswitch_scripts_systemd_sysconfig.template \
222 $RPM_BUILD_ROOT
/%{_sysconfdir}/sysconfig
/openvswitch
223 for service
in openvswitch ovsdb
-server ovs
-vswitchd ovs
-delete
-transient
-ports \
224 openvswitch
-ipsec
; do
225 install -p
-D
-m
0644 \
226 rhel
/usr_lib_systemd_system_$
{service
}.service \
227 $RPM_BUILD_ROOT
%{_unitdir}/${service}.service
229 install -m
0755 rhel
/etc_init.d_openvswitch \
230 $RPM_BUILD_ROOT
%{_datadir}/openvswitch
/scripts
/openvswitch.init
232 install -p
-D
-m
0644 rhel
/etc_openvswitch_default.conf \
233 $RPM_BUILD_ROOT
/%{_sysconfdir}/openvswitch
/default.conf
235 install -p
-D
-m
0644 rhel
/etc_logrotate.d_openvswitch \
236 $RPM_BUILD_ROOT
/%{_sysconfdir}/logrotate.d
/openvswitch
238 install -m
0644 vswitchd
/vswitch.ovsschema \
239 $RPM_BUILD_ROOT
/%{_datadir}/openvswitch
/vswitch.ovsschema
241 install -d
-m
0755 $RPM_BUILD_ROOT
/%{_sysconfdir}/sysconfig
/network
-scripts
/
242 install -p
-m
0755 rhel
/etc_sysconfig_network
-scripts_ifdown
-ovs \
243 $RPM_BUILD_ROOT
/%{_sysconfdir}/sysconfig
/network
-scripts
/ifdown
-ovs
244 install -p
-m
0755 rhel
/etc_sysconfig_network
-scripts_ifup
-ovs \
245 $RPM_BUILD_ROOT
/%{_sysconfdir}/sysconfig
/network
-scripts
/ifup
-ovs
247 install -d
-m
0755 $RPM_BUILD_ROOT
%{python3_sitelib}
248 cp
-a $RPM_BUILD_ROOT
/%{_datadir}/openvswitch
/python
/* \
249 $RPM_BUILD_ROOT
%{python3_sitelib}
251 rm -rf $RPM_BUILD_ROOT
/%{_datadir}/openvswitch
/python
/
253 install -d
-m
0755 $RPM_BUILD_ROOT
/%{_sharedstatedir}/openvswitch
255 touch $RPM_BUILD_ROOT
%{_sysconfdir}/openvswitch
/conf.db
256 touch $RPM_BUILD_ROOT
%{_sysconfdir}/openvswitch
/.conf.db.~lock~
257 touch $RPM_BUILD_ROOT
%{_sysconfdir}/openvswitch
/system
-id.conf
259 install -p
-m
644 -D selinux
/openvswitch
-custom.pp \
260 $RPM_BUILD_ROOT
%{_datadir}/selinux/packages/%{name}/openvswitch
-custom.pp
262 install -d $RPM_BUILD_ROOT
%{_prefix}/lib
/firewalld
/services
/
264 install -p
-D
-m
0755 \
265 rhel
/usr_share_openvswitch_scripts_ovs
-systemd
-reload \
266 $RPM_BUILD_ROOT
%{_datadir}/openvswitch
/scripts
/ovs
-systemd
-reload
268 # remove unpackaged files
269 rm -f $RPM_BUILD_ROOT
%{_bindir}/ovs
-parse
-backtrace
274 export OVS_RESOLV_CONF
=$
(pwd)/resolv.conf
275 if make check TESTSUITEFLAGS
='
%{_smp_mflags}' RECHECK
=yes
; then :;
277 cat tests
/testsuite.log
281 %if %{with check_datapath_kernel}
282 if make check
-kernel RECHECK
=yes
; then :;
284 cat tests
/system
-kmod
-testsuite.log
290 rm -rf $RPM_BUILD_ROOT
293 %selinux_relabel_pre -s targeted
296 %if 0%{?systemd_preun:1}
297 %systemd_preun %{name}.service
299 if [ $
1 -eq
0 ] ; then
300 # Package removal, not upgrade
301 /bin
/systemctl
--no
-reload disable
%{name}.service
>/dev
/null
2>&1 ||
:
302 /bin
/systemctl stop
%{name}.service
>/dev
/null
2>&1 ||
:
308 getent group openvswitch
>/dev
/null || groupadd
-r openvswitch
309 getent passwd openvswitch
>/dev
/null || \
310 useradd
-r
-g openvswitch
-d
/ -s
/sbin
/nologin \
311 -c "Open vSwitch Daemons" openvswitch
314 getent group hugetlbfs
>/dev
/null || groupadd
-r hugetlbfs
315 usermod
-a
-G hugetlbfs openvswitch
319 %if %{with autoenable}
320 if [ -x "
/etc
/init.d
/openvswitch"
]; then
321 touch
%{_tmppath}/ovs
-upgrade
-from
-sysv
328 if [ $
1 -eq
1 ]; then
330 %define gname hugetlbfs
332 %define gname openvswitch
335 's@^
#OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:%{gname}"@'\
336 %{_sysconfdir}/sysconfig
/openvswitch
337 sed
-i 's
:\
(.
*su\
).
*:\
1 openvswitch
%{gname}:' %{_sysconfdir}/logrotate.d
/openvswitch
339 # In the case of upgrade, this is not needed
340 chown
-R openvswitch
:openvswitch
%{_sysconfdir}/openvswitch
341 chown
-R openvswitch
:%{gname} %{_localstatedir}/log
/openvswitch
345 %if 0%{?systemd_post:1}
346 # This may not enable openvswitch service or do daemon-reload.
347 %systemd_post %{name}.service
349 # Package install, not upgrade
350 if [ $
1 -eq
1 ]; then
351 /bin
/systemctl daemon
-reload
>/dev
/null ||
:
355 %if %{with autoenable}
356 systemctl daemon
-reload
357 systemctl
enable openvswitch
358 # Handle upgrades to this package from the OVS repo's rhel packages.
359 # One "restart" is needed for newer systemd files to see the old running
360 # daemons. Another "restart" (outside the package postinst script) is
361 # needed to actually run new daemons.
362 if [ -e "
%{_tmppath}/ovs
-upgrade
-from
-sysv"
]; then
363 systemctl restart openvswitch
364 rm "
%{_tmppath}/ovs
-upgrade
-from
-sysv"
369 %selinux_modules_install -s targeted
%{_datadir}/selinux/packages/%{name}/openvswitch
-custom.pp
372 %if 0%{?systemd_postun:1}
373 %systemd_postun %{name}.service
375 /bin
/systemctl daemon
-reload
>/dev
/null
2>&1 ||
:
378 %postun selinux
-policy
379 if [ $
1 -eq
0 ] ; then
380 %selinux_modules_uninstall -s targeted openvswitch
-custom
383 %posttrans selinux
-policy
384 %selinux_relabel_post -s targeted
386 %files selinux
-policy
387 %defattr(-,root
,root
)
388 %{_datadir}/selinux/packages/%{name}/openvswitch
-custom.pp
390 %files -n python3
-openvswitch
391 %{python3_sitelib}/ovs
395 %{_bindir}/ovs
-vlan
-test
396 %{_bindir}/ovs
-l3ping
398 %{_bindir}/ovs
-tcpdump
399 %{_bindir}/ovs
-tcpundump
400 %{_mandir}/man8
/ovs
-test.8*
401 %{_mandir}/man8
/ovs
-vlan
-test.8*
402 %{_mandir}/man8
/ovs
-l3ping
.8*
403 %{_mandir}/man1
/ovs
-pcap
.1*
404 %{_mandir}/man8
/ovs
-tcpdump
.8*
405 %{_mandir}/man1
/ovs
-tcpundump
.1*
406 %{python3_sitelib}/ovstest
410 %{_libdir}/pkgconfig
/*.pc
411 %{_includedir}/openvswitch
/*
412 %{_includedir}/openflow
/*
413 %exclude %{_libdir}/*.la
414 %exclude %{_libdir}/*.a
416 %if 0%{?rhel} > 7 || 0%{?fedora} > 28
417 %files -n network
-scripts
-%{name}
418 %{_sysconfdir}/sysconfig
/network
-scripts
/ifup
-ovs
419 %{_sysconfdir}/sysconfig
/network
-scripts
/ifdown
-ovs
424 %defattr(-,openvswitch
,openvswitch
)
426 %defattr(-,root
,root
)
428 %dir %{_sysconfdir}/openvswitch
429 %{_sysconfdir}/openvswitch
/default.conf
430 %config %ghost %{_sysconfdir}/openvswitch
/conf.db
431 %ghost %{_sysconfdir}/openvswitch
/.conf.db.~lock~
432 %config %ghost %{_sysconfdir}/openvswitch
/system
-id.conf
433 %config(noreplace
) %{_sysconfdir}/sysconfig
/openvswitch
434 %defattr(-,root
,root
)
435 %{_sysconfdir}/bash_completion.d
/ovs
-appctl
-bashcomp.bash
436 %{_sysconfdir}/bash_completion.d
/ovs
-vsctl
-bashcomp.bash
437 %config(noreplace
) %{_sysconfdir}/logrotate.d
/openvswitch
438 %{_unitdir}/openvswitch.service
439 %{_unitdir}/ovsdb
-server.service
440 %{_unitdir}/ovs
-vswitchd.service
441 %{_unitdir}/ovs
-delete
-transient
-ports.service
442 %{_datadir}/openvswitch
/scripts
/openvswitch.init
443 %if ! (0%{?rhel} > 7 || 0%{?fedora} > 28)
444 %{_sysconfdir}/sysconfig
/network
-scripts
/ifup
-ovs
445 %{_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 %{_datadir}/openvswitch
/scripts
/ovs
-kmod
-ctl
455 %{_datadir}/openvswitch
/scripts
/ovs
-systemd
-reload
456 %config %{_datadir}/openvswitch
/vswitch.ovsschema
457 %config %{_datadir}/openvswitch
/vtep.ovsschema
458 %{_bindir}/ovs
-appctl
459 %{_bindir}/ovs
-docker
461 %{_bindir}/ovs
-dpctl
-top
464 %{_bindir}/ovsdb
-client
465 %{_bindir}/ovsdb
-tool
466 %{_bindir}/ovs
-testcontroller
470 %{_sbindir}/ovs
-bugtool
471 %{_sbindir}/ovs
-vswitchd
472 %{_sbindir}/ovsdb
-server
473 %{_mandir}/man1
/ovsdb
-client
.1*
474 %{_mandir}/man1
/ovsdb
-server
.1*
475 %{_mandir}/man1
/ovsdb
-tool
.1*
476 %{_mandir}/man5
/ovsdb
-server
.5*
477 %{_mandir}/man5
/ovs
-vswitchd.conf.db
.5*
478 %{_mandir}/man5
/ovsdb
.5*
479 %{_mandir}/man5
/vtep
.5*
480 %{_mandir}/man7
/ovs
-actions
.7*
481 %{_mandir}/man7
/ovs
-fields
.7*
482 %{_mandir}/man7
/ovsdb
.7*
483 %{_mandir}/man7
/ovsdb
-server
.7*
484 %{_mandir}/man8
/vtep
-ctl
.8*
485 %{_mandir}/man8
/ovs
-appctl
.8*
486 %{_mandir}/man8
/ovs
-bugtool
.8*
487 %{_mandir}/man8
/ovs
-ctl
.8*
488 %{_mandir}/man8
/ovs
-dpctl
.8*
489 %{_mandir}/man8
/ovs
-dpctl
-top
.8*
490 %{_mandir}/man8
/ovs
-kmod
-ctl
.8*
491 %{_mandir}/man8
/ovs
-ofctl
.8*
492 %{_mandir}/man8
/ovs
-pki
.8*
493 %{_mandir}/man8
/ovs
-vsctl
.8*
494 %{_mandir}/man8
/ovs
-vswitchd
.8*
495 %{_mandir}/man8
/ovs
-parse
-backtrace
.8*
496 %{_mandir}/man8
/ovs
-testcontroller
.8*
498 %{_prefix}/lib
/udev
/rules.d
/91-vfio.rules
500 %doc NOTICE README.rst NEWS rhel
/README.RHEL.rst
502 %attr(750,root
,root
) /var
/log
/openvswitch
503 %ghost %attr(755,root
,root
) %{_rundir}/openvswitch
504 %ghost %attr(644,root
,root
) %{_rundir}/openvswitch.useropts
507 %{_datadir}/openvswitch
/scripts
/ovs
-monitor
-ipsec
508 %{_unitdir}/openvswitch
-ipsec.service
511 * Wed Jan
12 2011 Ralf Spenneberg
<ralf@os
-s.net
>