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