b48e97117b016a7e64b9dacc771b5f76083a219f
[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
39 Requires: openssl iproute module-init-tools
40 #Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
41 Requires: kernel >= 3.15.0-0
42
43 Requires(post): systemd-units
44 Requires(preun): systemd-units
45 Requires(postun): systemd-units
46 Obsoletes: openvswitch-controller <= 0:2.1.0-1
47
48 %bcond_without check
49
50 %description
51 Open vSwitch provides standard network bridging functions and
52 support for the OpenFlow protocol for remote per-flow control of
53 traffic.
54
55 %package -n python-openvswitch
56 Summary: Open vSwitch python bindings
57 License: ASL 2.0
58 BuildArch: noarch
59 Requires: python
60
61 %description -n python-openvswitch
62 Python bindings for the Open vSwitch database
63
64 %package test
65 Summary: Open vSwitch testing utilities
66 License: ASL 2.0
67 BuildArch: noarch
68 Requires: python-openvswitch = %{version}-%{release}
69 Requires: python python-twisted-core python-twisted-web
70
71 %description test
72 Utilities that are useful to diagnose performance and connectivity
73 issues in Open vSwitch setup.
74
75 %package devel
76 Summary: Open vSwitch OpenFlow development package (library, headers)
77 License: ASL 2.0
78 Provides: openvswitch-static = %{version}-%{release}
79
80 %description devel
81 This provides static library, libopenswitch.a and the openvswitch header
82 files needed to build an external application.
83
84
85 %prep
86 %setup -q
87
88 %build
89 %configure --enable-ssl --with-pkidir=%{_sharedstatedir}/openvswitch/pki
90 make %{?_smp_mflags}
91
92 %install
93 rm -rf $RPM_BUILD_ROOT
94 make install DESTDIR=$RPM_BUILD_ROOT
95
96 install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}
97 install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch
98
99 install -p -D -m 0644 rhel/usr_lib_systemd_system_openvswitch.service \
100         $RPM_BUILD_ROOT%{_unitdir}/openvswitch.service
101 install -p -D -m 0644 rhel/usr_lib_systemd_system_openvswitch-nonetwork.service \
102         $RPM_BUILD_ROOT%{_unitdir}/openvswitch-nonetwork.service
103
104 install -m 0755 rhel/etc_init.d_openvswitch \
105         $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/openvswitch.init
106
107 install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig
108
109 install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d
110 install -m 0755 rhel/etc_logrotate.d_openvswitch \
111         $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/openvswitch
112
113 install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/profile.d
114
115 install -m 0644 vswitchd/vswitch.ovsschema \
116         $RPM_BUILD_ROOT/%{_datadir}/openvswitch/vswitch.ovsschema
117
118 install -d -m 0755 $RPM_BUILD_ROOT/%{_datadir}/openvswitch/scripts
119
120 install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/
121 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifdown-ovs \
122         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
123 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \
124         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
125
126 install -p -D -m 0644 rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
127         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/openvswitch
128
129 install -d -m 0755 $RPM_BUILD_ROOT/%{_datadir}/openvswitch/scripts
130
131 install -d -m 0755 $RPM_BUILD_ROOT%{python_sitelib}
132 mv $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/* $RPM_BUILD_ROOT%{python_sitelib}
133 rmdir $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
134
135 install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
136
137 install -d -m 0755 $RPM_BUILD_ROOT%{_includedir}/openvswitch
138 install -p -D -m 0644 include/openvswitch/*.h \
139         -t $RPM_BUILD_ROOT%{_includedir}/openvswitch
140 install -p -D -m 0644 config.h -t $RPM_BUILD_ROOT%{_includedir}/openvswitch
141
142 install -d -m 0755 $RPM_BUILD_ROOT%{_includedir}/openvswitch/lib
143 install -p -D -m 0644 lib/*.h \
144         -t $RPM_BUILD_ROOT%{_includedir}/openvswitch/lib
145
146 install -d -m 0755 $RPM_BUILD_ROOT%{_includedir}/openflow
147 install -p -D -m 0644 include/openflow/*.h \
148         -t $RPM_BUILD_ROOT%{_includedir}/openflow
149
150 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
151 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf
152
153 %check
154 %if %{with check}
155     if make check TESTSUITEFLAGS='%{_smp_mflags}' ||
156        make check TESTSUITEFLAGS='--recheck'; then :;
157     else
158         cat tests/testsuite.log
159         exit 1
160     fi
161 %endif
162
163 %clean
164 rm -rf $RPM_BUILD_ROOT
165
166 %preun
167 # Package removal, not upgrade
168 systemctl stop openvswitch.service
169 systemctl disable openvswitch.service
170
171 %post
172 if test ! -e /etc/openvswitch/conf.db; then
173     install -d -m 755 -o root -g root /etc/openvswitch
174
175     # Create ovs-vswitchd config database
176     ovsdb-tool -vANY:console:emer create /etc/openvswitch/conf.db \
177             /usr/share/openvswitch/vswitch.ovsschema
178
179     # Create initial table in config database
180     ovsdb-tool -vANY:console:emer transact /etc/openvswitch/conf.db \
181             '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
182             > /dev/null
183 fi
184 # Initial installation
185 systemctl enable openvswitch.service
186 systemctl start openvswitch.service
187
188 %postun
189
190 %files -n python-openvswitch
191 %{python_sitelib}/ovs
192 %doc COPYING
193
194 %files test
195 %{_bindir}/ovs-test
196 %{_bindir}/ovs-vlan-test
197 %{_bindir}/ovs-l3ping
198 %{_mandir}/man8/ovs-test.8*
199 %{_mandir}/man8/ovs-vlan-test.8*
200 %{_mandir}/man8/ovs-l3ping.8*
201 %{python_sitelib}/ovstest
202
203 %files devel
204 %{_libdir}/*.a
205 %{_libdir}/*.la
206 %{_includedir}/openvswitch/*
207 %{_includedir}/openflow/*
208
209 %files
210 %defattr(-,root,root)
211 %dir %{_sysconfdir}/openvswitch
212 %config %ghost %{_sysconfdir}/openvswitch/conf.db
213 %config %ghost %{_sysconfdir}/openvswitch/system-id.conf
214 %config(noreplace) %{_sysconfdir}/sysconfig/openvswitch
215 %config(noreplace) %{_sysconfdir}/logrotate.d/openvswitch
216 %{_unitdir}/openvswitch.service
217 %{_unitdir}/openvswitch-nonetwork.service
218 %{_datadir}/openvswitch/scripts/openvswitch.init
219 %{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
220 %{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
221 %{_datadir}/openvswitch/bugtool-plugins/
222 %{_datadir}/openvswitch/scripts/ovs-bugtool-*
223 %{_datadir}/openvswitch/scripts/ovs-check-dead-ifs
224 %{_datadir}/openvswitch/scripts/ovs-lib
225 %{_datadir}/openvswitch/scripts/ovs-vtep
226 %{_datadir}/openvswitch/scripts/ovs-ctl
227 %config %{_datadir}/openvswitch/vswitch.ovsschema
228 %config %{_datadir}/openvswitch/vtep.ovsschema
229 %{_bindir}/ovs-appctl
230 %{_bindir}/ovs-docker
231 %{_bindir}/ovs-dpctl
232 %{_bindir}/ovs-dpctl-top
233 %{_bindir}/ovs-ofctl
234 %{_bindir}/ovs-vsctl
235 %{_bindir}/ovsdb-client
236 %{_bindir}/ovsdb-tool
237 %{_bindir}/ovs-testcontroller
238 %{_bindir}/ovs-pki
239 %{_bindir}/vtep-ctl
240 %{_sbindir}/ovs-bugtool
241 %{_sbindir}/ovs-vswitchd
242 %{_sbindir}/ovsdb-server
243 %{_mandir}/man1/ovs-benchmark.1*
244 %{_mandir}/man1/ovs-pcap.1*
245 %{_mandir}/man1/ovs-tcpundump.1*
246 %{_mandir}/man1/ovsdb-client.1*
247 %{_mandir}/man1/ovsdb-server.1*
248 %{_mandir}/man1/ovsdb-tool.1*
249 %{_mandir}/man5/ovs-vswitchd.conf.db.5*
250 %{_mandir}/man5/vtep.5*
251 %{_mandir}/man8/vtep-ctl.8*
252 %{_mandir}/man8/ovs-appctl.8*
253 %{_mandir}/man8/ovs-bugtool.8*
254 %{_mandir}/man8/ovs-ctl.8*
255 %{_mandir}/man8/ovs-dpctl.8*
256 %{_mandir}/man8/ovs-dpctl-top.8*
257 %{_mandir}/man8/ovs-ofctl.8*
258 %{_mandir}/man8/ovs-pki.8*
259 %{_mandir}/man8/ovs-vsctl.8*
260 %{_mandir}/man8/ovs-vswitchd.8*
261 %{_mandir}/man8/ovs-parse-backtrace.8*
262 %{_mandir}/man8/ovs-testcontroller.8*
263 %doc COPYING DESIGN.md INSTALL.SSL.md NOTICE README.md WHY-OVS.md
264 %doc FAQ.md NEWS INSTALL.DPDK.md rhel/README.RHEL
265 /var/lib/openvswitch
266 /var/log/openvswitch
267 %exclude %{_bindir}/ovs-benchmark
268 %exclude %{_bindir}/ovs-parse-backtrace
269 %exclude %{_bindir}/ovs-pcap
270 %exclude %{_bindir}/ovs-tcpundump
271 %exclude %{_sbindir}/ovs-vlan-bug-workaround
272 %exclude %{_mandir}/man1/ovs-benchmark.1.gz
273 %exclude %{_mandir}/man1/ovs-pcap.1.gz
274 %exclude %{_mandir}/man1/ovs-tcpundump.1.gz
275 %exclude %{_mandir}/man8/ovs-vlan-bug-workaround.8.gz
276 %exclude %{_datadir}/openvswitch/scripts/ovs-save
277
278 %changelog
279 * Wed Jan 12 2011 Ralf Spenneberg <ralf@os-s.net>
280 - First build on F14