e655665539ed144a029d7c749386c9b7198d4ffd
[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 python-six
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 Requires: python-six
75
76 %description -n python-openvswitch
77 Python bindings for the Open vSwitch database
78
79 %package test
80 Summary: Open vSwitch testing utilities
81 License: ASL 2.0
82 BuildArch: noarch
83 Requires: python-openvswitch = %{version}-%{release}
84 Requires: python python-twisted-core python-twisted-web
85
86 %description test
87 Utilities that are useful to diagnose performance and connectivity
88 issues in Open vSwitch setup.
89
90 %package devel
91 Summary: Open vSwitch OpenFlow development package (library, headers)
92 License: ASL 2.0
93 Provides: openvswitch-static = %{version}-%{release}
94
95 %description devel
96 This provides static library, libopenswitch.a and the openvswitch header
97 files needed to build an external application.
98
99 %package ovn
100 Summary: Open vSwitch - Open Virtual Network support
101 License: ASL 2.0
102 Requires: openvswitch
103
104 %description ovn
105 OVN, the Open Virtual Network, is a system to support virtual network
106 abstraction.  OVN complements the existing capabilities of OVS to add
107 native support for virtual network abstractions, such as virtual L2 and L3
108 overlays and security groups.
109
110
111 %prep
112 %setup -q
113
114 %build
115 %configure \
116 %if %{with libcapng}
117         --enable-libcapng \
118 %else
119         --disable-libcapng \
120 %endif
121         --enable-ssl \
122         --with-pkidir=%{_sharedstatedir}/openvswitch/pki
123
124 make %{?_smp_mflags}
125
126 %install
127 rm -rf $RPM_BUILD_ROOT
128 make install DESTDIR=$RPM_BUILD_ROOT
129
130 install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch
131
132 install -p -D -m 0644 \
133         rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
134         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/openvswitch
135 for service in openvswitch openvswitch-nonetwork \
136                 ovn-controller ovn-controller-vtep ovn-northd; do
137         install -p -D -m 0644 \
138                         rhel/usr_lib_systemd_system_${service}.service \
139                         $RPM_BUILD_ROOT%{_unitdir}/${service}.service
140 done
141 install -m 0755 rhel/etc_init.d_openvswitch \
142         $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/openvswitch.init
143
144 install -p -D -m 0644 rhel/etc_logrotate.d_openvswitch \
145         $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/openvswitch
146
147 install -m 0644 vswitchd/vswitch.ovsschema \
148         $RPM_BUILD_ROOT/%{_datadir}/openvswitch/vswitch.ovsschema
149
150 install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/
151 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifdown-ovs \
152         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
153 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \
154         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
155
156 install -d -m 0755 $RPM_BUILD_ROOT%{python_sitelib}
157 mv $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/* \
158    $RPM_BUILD_ROOT%{python_sitelib}
159 rmdir $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
160
161 install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
162
163 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
164 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf
165
166 # remove unpackaged files
167 rm -f $RPM_BUILD_ROOT%{_bindir}/ovs-benchmark \
168         $RPM_BUILD_ROOT%{_bindir}/ovs-parse-backtrace \
169         $RPM_BUILD_ROOT%{_bindir}/ovs-pcap \
170         $RPM_BUILD_ROOT%{_bindir}/ovs-tcpundump \
171         $RPM_BUILD_ROOT%{_sbindir}/ovs-vlan-bug-workaround \
172         $RPM_BUILD_ROOT%{_mandir}/man1/ovs-benchmark.1 \
173         $RPM_BUILD_ROOT%{_mandir}/man1/ovs-pcap.1 \
174         $RPM_BUILD_ROOT%{_mandir}/man1/ovs-tcpundump.1 \
175         $RPM_BUILD_ROOT%{_mandir}/man8/ovs-vlan-bug-workaround.8 \
176         $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/ovs-save
177
178 %check
179 %if %{with check}
180     if make check TESTSUITEFLAGS='%{_smp_mflags}' ||
181        make check TESTSUITEFLAGS='--recheck'; then :;
182     else
183         cat tests/testsuite.log
184         exit 1
185     fi
186 %endif
187
188 %clean
189 rm -rf $RPM_BUILD_ROOT
190
191 %preun
192 %if 0%{?systemd_preun:1}
193     %systemd_preun %{name}.service
194 %else
195     if [ $1 -eq 0 ] ; then
196     # Package removal, not upgrade
197         /bin/systemctl --no-reload disable %{name}.service >/dev/null 2>&1 || :
198         /bin/systemctl stop %{name}.service >/dev/null 2>&1 || :
199     fi
200 %endif
201
202 %preun ovn
203 %if 0%{?systemd_preun:1}
204     %systemd_preun ovn-controller.service
205     %systemd_preun ovn-controller-vtep.service
206     %systemd_preun ovn-northd.service
207 %else
208     if [ $1 -eq 0 ] ; then
209     # Package removal, not upgrade
210         /bin/systemctl --no-reload disable ovn-controller.service >/dev/null 2>&1 || :
211         /bin/systemctl stop ovn-controller.service >/dev/null 2>&1 || :
212         /bin/systemctl --no-reload disable ovn-controller-vtep.service >/dev/null 2>&1 || :
213         /bin/systemctl stop ovn-controller-vtep.service >/dev/null 2>&1 || :
214         /bin/systemctl --no-reload disable ovn-northd.service >/dev/null 2>&1 || :
215         /bin/systemctl stop ovn-northd.service >/dev/null 2>&1 || :
216     fi
217 %endif
218
219 %post
220 %if 0%{?systemd_post:1}
221     %systemd_post %{name}.service
222 %else
223     # Package install, not upgrade
224     if [ $1 -eq 1 ]; then
225         /bin/systemctl daemon-reload >dev/null || :
226     fi
227 %endif
228
229 %post ovn
230 %if 0%{?systemd_post:1}
231     %systemd_post ovn-controller.service
232     %systemd_post ovn-controller-vtep.service
233     %systemd_post ovn-northd.service
234 %else
235     # Package install, not upgrade
236     if [ $1 -eq 1 ]; then
237         /bin/systemctl daemon-reload >dev/null || :
238     fi
239 %endif
240
241 %postun
242 %if 0%{?systemd_postun_with_restart:1}
243     %systemd_postun_with_restart %{name}.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 %{name}.service >/dev/null 2>&1 || :
249     fi
250 %endif
251
252 %postun ovn
253 %if 0%{?systemd_postun_with_restart:1}
254     %systemd_postun_with_restart ovn-controller.service
255     %systemd_postun_with_restart ovn-controller-vtep.service
256     %systemd_postun_with_restart ovn-northd.service
257 %else
258     /bin/systemctl daemon-reload >/dev/null 2>&1 || :
259     if [ "$1" -ge "1" ] ; then
260     # Package upgrade, not uninstall
261         /bin/systemctl try-restart ovn-controller.service >/dev/null 2>&1 || :
262         /bin/systemctl try-restart ovn-controller-vtep.service >/dev/null 2>&1 || :
263         /bin/systemctl try-restart ovn-northd.service >/dev/null 2>&1 || :
264     fi
265 %endif
266
267 %files -n python-openvswitch
268 %{python_sitelib}/ovs
269 %doc COPYING
270
271 %files test
272 %{_bindir}/ovs-test
273 %{_bindir}/ovs-vlan-test
274 %{_bindir}/ovs-l3ping
275 %{_mandir}/man8/ovs-test.8*
276 %{_mandir}/man8/ovs-vlan-test.8*
277 %{_mandir}/man8/ovs-l3ping.8*
278 %{python_sitelib}/ovstest
279
280 %files devel
281 %{_libdir}/*.a
282 %{_libdir}/*.la
283 %{_libdir}/pkgconfig/*.pc
284 %{_includedir}/openvswitch/*
285 %{_includedir}/openflow/*
286
287 %files
288 %defattr(-,root,root)
289 %{_sysconfdir}/bash_completion.d/ovs-appctl-bashcomp.bash
290 %{_sysconfdir}/bash_completion.d/ovs-vsctl-bashcomp.bash
291 %dir %{_sysconfdir}/openvswitch
292 %config %ghost %{_sysconfdir}/openvswitch/conf.db
293 %config %ghost %{_sysconfdir}/openvswitch/system-id.conf
294 %config(noreplace) %{_sysconfdir}/sysconfig/openvswitch
295 %config(noreplace) %{_sysconfdir}/logrotate.d/openvswitch
296 %{_unitdir}/openvswitch.service
297 %{_unitdir}/openvswitch-nonetwork.service
298 %{_datadir}/openvswitch/scripts/openvswitch.init
299 %{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
300 %{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
301 %{_datadir}/openvswitch/bugtool-plugins/
302 %{_datadir}/openvswitch/scripts/ovs-bugtool-*
303 %{_datadir}/openvswitch/scripts/ovs-check-dead-ifs
304 %{_datadir}/openvswitch/scripts/ovs-lib
305 %{_datadir}/openvswitch/scripts/ovs-vtep
306 %{_datadir}/openvswitch/scripts/ovs-ctl
307 %config %{_datadir}/openvswitch/vswitch.ovsschema
308 %config %{_datadir}/openvswitch/vtep.ovsschema
309 %{_bindir}/ovs-appctl
310 %{_bindir}/ovs-docker
311 %{_bindir}/ovs-dpctl
312 %{_bindir}/ovs-dpctl-top
313 %{_bindir}/ovs-ofctl
314 %{_bindir}/ovs-vsctl
315 %{_bindir}/ovsdb-client
316 %{_bindir}/ovsdb-tool
317 %{_bindir}/ovs-testcontroller
318 %{_bindir}/ovs-pki
319 %{_bindir}/vtep-ctl
320 %{_sbindir}/ovs-bugtool
321 %{_sbindir}/ovs-vswitchd
322 %{_sbindir}/ovsdb-server
323 %{_mandir}/man1/ovsdb-client.1*
324 %{_mandir}/man1/ovsdb-server.1*
325 %{_mandir}/man1/ovsdb-tool.1*
326 %{_mandir}/man5/ovs-vswitchd.conf.db.5*
327 %{_mandir}/man5/vtep.5*
328 %{_mandir}/man8/vtep-ctl.8*
329 %{_mandir}/man8/ovs-appctl.8*
330 %{_mandir}/man8/ovs-bugtool.8*
331 %{_mandir}/man8/ovs-ctl.8*
332 %{_mandir}/man8/ovs-dpctl.8*
333 %{_mandir}/man8/ovs-dpctl-top.8*
334 %{_mandir}/man8/ovs-ofctl.8*
335 %{_mandir}/man8/ovs-pki.8*
336 %{_mandir}/man8/ovs-vsctl.8*
337 %{_mandir}/man8/ovs-vswitchd.8*
338 %{_mandir}/man8/ovs-parse-backtrace.8*
339 %{_mandir}/man8/ovs-testcontroller.8*
340 %doc COPYING DESIGN.md INSTALL.SSL.md NOTICE README.md WHY-OVS.md
341 %doc FAQ.md NEWS INSTALL.DPDK.md rhel/README.RHEL
342 /var/lib/openvswitch
343 /var/log/openvswitch
344 %ghost %attr(755,root,root) %{_rundir}/openvswitch
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