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