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