3 %bcond_without dist_kernel # allow non-distribution kernel
4 %bcond_without kernel # don't build kernel modules
5 %bcond_without userspace # don't build userspace programs
6 %bcond_with verbose # verbose build (V=1)
8 # set kernel_builtin to true for kernels with openvswitch module (>= 3.3)
9 %define kernel_builtin %(echo %{_kernel_ver} | awk '{ split($0, v, "."); vv=v[1]*1000+v[2]; if (vv >= 3003) print 1; else print 0 }')
11 %if %{kernel_builtin} == 1
16 %undefine with_dist_kernel
18 %if "%{_alt_kernel}" != "%{nil}"
19 %undefine with_userspace
21 %if %{without userspace}
22 # nothing to be placed to debuginfo package
23 %define _enable_debug_packages 0
27 %define pname openvswitch
28 Summary: Production Quality, Multilayer Open Virtual Switch
30 Name: %{pname}%{_alt_kernel}
34 Group: Networking/Daemons
35 Source0: http://openvswitch.org/releases/%{pname}-%{version}.tar.gz
36 # Source0-md5: 3847c60af329bfe81ff7220b9f489fa5
40 Source4: %{pname}.logrotate
41 Source5: %{pname}.tmpfiles
42 Source6: %{pname}.sysconfig
43 Source7: %{pname}.init
44 #Source8: openvswitch-controller.init
45 #Source9: openvswitch-ipsec.init
46 Source10: %{pname}.service
47 Source11: ovsdbmonitor.desktop
48 Patch0: linux-3.3.patch
49 Patch1: ovsdbmonitor-move-to-its-own-data-directory.patch
50 URL: http://openvswitch.org/
51 BuildRequires: Zope-Interface
52 BuildRequires: automake
53 BuildRequires: autoconf
54 BuildRequires: graphviz
56 BuildRequires: openssl-devel
57 BuildRequires: openssl-tools
58 BuildRequires: pkgconfig
59 BuildRequires: python-PyQt4-devel
60 BuildRequires: python-PyQt4-devel-tools
61 BuildRequires: python-TwistedConch
62 BuildRequires: python-TwistedCore
63 BuildRequires: python-distribute
64 BuildRequires: rpm-pythonprov
65 BuildRequires: rpmbuild(macros) >= 1.647
67 %{?with_dist_kernel:BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.20.2}
69 Requires(post,preun): /sbin/chkconfig
70 Requires: python-modules
72 Requires: systemd-units
73 BuildRoot: %{tmpdir}/%{pname}-%{version}-root-%(id -u -n)
76 Open vSwitch is a production quality, multilayer virtual switch
77 licensed under the open source Apache 2.0 license. It is designed to
78 enable massive network automation through programmatic extension,
79 while still supporting standard management interfaces and protocols
80 (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag). In addition,
81 it is designed to support distribution across multiple physical
82 servers similar to VMware's vNetwork distributed vswitch or Cisco's
85 #%description -l pl.UTF-8
87 %package -n python-openvswitch
88 Summary: Open vSwitch python bindings
89 Group: Development/Languages/Python
90 Requires: python-modules
92 %description -n python-openvswitch
93 Python bindings for the Open vSwitch database
95 %package -n ovsdbmonitor
96 Summary: Open vSwitch graphical monitoring tool
97 Group: Networking/Admin
98 Requires: Zope-Interface
99 Requires: python-PyQt4-devel-tools
100 Requires: python-TwistedConch
101 Requires: python-TwistedCore
102 Requires: python-modules
103 Requires: python-openvswitch = %{version}-%{release}
105 %description -n ovsdbmonitor
106 A GUI tool for monitoring and troubleshooting local or remote Open
107 vSwitch installations. It presents GUI tables that graphically
108 represent an Open vSwitch kernel flow table (similar to "ovs-dpctl
109 dump-flows") and Open vSwitch database contents (similar to "ovs-vsctl
113 Summary: Open vSwitch test package
114 Group: Networking/Admin
115 Requires: python-modules
116 Requires: python-openvswitch = %{version}-%{release}
119 This package contains utilities that are useful to diagnose
120 performance and connectivity issues in Open vSwitch setup.
122 %package -n kernel%{_alt_kernel}-net-openvswitch
123 Summary: Linux driver for openvswitch
124 Summary(pl.UTF-8): Sterownik dla Linuksa do openvswitch
125 Release: %{rel}@%{_kernel_ver_str}
127 Requires(post,postun): /sbin/depmod
128 %if %{with dist_kernel}
129 %requires_releq_kernel
130 Requires(postun): %releq_kernel
133 %description -n kernel%{_alt_kernel}-net-openvswitch
134 This is driver for openvswitch for Linux.
136 This package contains Linux module.
138 %description -n kernel%{_alt_kernel}-net-openvswitch -l pl.UTF-8
139 Sterownik dla Linuksa do openvswitch.
141 Ten pakiet zawiera moduł jądra Linuksa.
144 %setup -q -n %{pname}-%{version}
155 --with-linux=%{_kernelsrcdir} \
156 --with-linux-source=%{_kernelsrcdir}
162 rm -rf $RPM_BUILD_ROOT
164 %if %{with userspace}
165 install -d $RPM_BUILD_ROOT{%{py_sitescriptdir},%{systemdunitdir},%{systemdtmpfilesdir}} \
166 $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d,logrotate.d},/lib/rc-scripts} \
167 $RPM_BUILD_ROOT%{_desktopdir}
170 DESTDIR=$RPM_BUILD_ROOT
172 install -p %{SOURCE1} $RPM_BUILD_ROOT/lib/rc-scripts/ifdown-ovs
173 install -p %{SOURCE2} $RPM_BUILD_ROOT/lib/rc-scripts/ifup-ovs
174 install -p %{SOURCE4} $RPM_BUILD_ROOT/etc/logrotate.d/openvswitch
175 install -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/openvswitch.conf
176 install -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/openvswitch
177 install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/openvswitch
178 install -p %{SOURCE10} $RPM_BUILD_ROOT%{systemdunitdir}/openvswitch.service
179 install -p %{SOURCE11} $RPM_BUILD_ROOT%{_desktopdir}
181 %{__mv} $RPM_BUILD_ROOT%{_datadir}/%{pname}/python/{ovs,ovstest} $RPM_BUILD_ROOT%{py_sitescriptdir}
182 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/%{pname}/python
184 %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
185 %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
187 %py_ocomp $RPM_BUILD_ROOT%{_datadir}/ovsdbmonitor
188 %py_comp $RPM_BUILD_ROOT%{_datadir}/ovsdbmonitor
193 %install_kernel_modules -m brcompat_mod -d kernel/net/openvswitch
194 %install_kernel_modules -m openvswitch_mod -d kernel/net/openvswitch
198 rm -rf $RPM_BUILD_ROOT
201 /sbin/chkconfig --add openvswitch
202 %service openvswitch restart
203 %systemd_post openvswitch.service
206 if [ "$1" = "0" ]; then
207 %service -q openvswitch stop
208 /sbin/chkconfig --del openvswitch
210 %systemd_preun openvswitch.service
215 %post -n kernel%{_alt_kernel}-net-openvswitch
216 %depmod %{_kernel_ver}
218 %postun -n kernel%{_alt_kernel}-net-openvswitch
219 %depmod %{_kernel_ver}
221 %if %{with userspace}
223 %defattr(644,root,root,755)
224 %doc AUTHORS DESIGN INSTALL.KVM INSTALL.SSL INSTALL.bridge INSTALL.userspace NEWS README
225 %doc REPORTING-BUGS WHY-OVS README.PLD
226 %attr(755,root,root) /lib/rc-scripts/ifdown-ovs
227 %attr(755,root,root) /lib/rc-scripts/ifup-ovs
228 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/openvswitch
229 %{systemdtmpfilesdir}/openvswitch.conf
230 %{systemdunitdir}/openvswitch.service
231 %dir %{_datadir}/%{pname}
232 %{_datadir}/%{pname}/pki
233 %dir %{_datadir}/%{pname}/scripts
234 %attr(755,root,root) %{_datadir}/%{pname}/scripts/*
235 %{_datadir}/%{pname}/bugtool-plugins
236 %{_datadir}/%{pname}/vswitch.ovsschema
238 %attr(754,root,root) /etc/rc.d/init.d/openvswitch
239 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/openvswitch
241 %attr(755,root,root) %{_bindir}/ovs-appctl
242 %attr(755,root,root) %{_bindir}/ovs-benchmark
243 %attr(755,root,root) %{_bindir}/ovs-controller
244 %attr(755,root,root) %{_bindir}/ovs-dpctl
245 %attr(755,root,root) %{_bindir}/ovs-ofctl
246 %attr(755,root,root) %{_bindir}/ovs-parse-leaks
247 %attr(755,root,root) %{_bindir}/ovs-pcap
248 %attr(755,root,root) %{_bindir}/ovs-pki
249 %attr(755,root,root) %{_bindir}/ovs-tcpundump
250 %attr(755,root,root) %{_bindir}/ovs-vsctl
251 %attr(755,root,root) %{_bindir}/ovsdb-client
252 %attr(755,root,root) %{_bindir}/ovsdb-tool
253 %attr(755,root,root) %{_sbindir}/ovs-brcompatd
254 %attr(755,root,root) %{_sbindir}/ovs-bugtool
255 %attr(755,root,root) %{_sbindir}/ovs-vlan-bug-workaround
256 %attr(755,root,root) %{_sbindir}/ovs-vswitchd
257 %attr(755,root,root) %{_sbindir}/ovsdb-server
258 %{_mandir}/man1/ovs-benchmark.1*
259 %{_mandir}/man1/ovs-pcap.1*
260 %{_mandir}/man1/ovs-tcpundump.1*
261 %{_mandir}/man1/ovsdb-client.1*
262 %{_mandir}/man1/ovsdb-server.1*
263 %{_mandir}/man1/ovsdb-tool.1*
264 %{_mandir}/man5/ovs-vswitchd.conf.db.5*
265 %{_mandir}/man8/ovs-appctl.8*
266 %{_mandir}/man8/ovs-brcompatd.8*
267 %{_mandir}/man8/ovs-bugtool.8*
268 %{_mandir}/man8/ovs-controller.8*
269 %{_mandir}/man8/ovs-ctl.8*
270 %{_mandir}/man8/ovs-dpctl.8*
271 %{_mandir}/man8/ovs-ofctl.8*
272 %{_mandir}/man8/ovs-parse-leaks.8*
273 %{_mandir}/man8/ovs-pki.8*
274 %{_mandir}/man8/ovs-vlan-bug-workaround.8*
275 %{_mandir}/man8/ovs-vlan-test.8*
276 %{_mandir}/man8/ovs-vsctl.8*
277 %{_mandir}/man8/ovs-vswitchd.8*
279 %files -n python-openvswitch
280 %defattr(644,root,root,755)
281 %dir %{py_sitescriptdir}/ovs
282 %{py_sitescriptdir}/ovs/*.py*
283 %dir %{py_sitescriptdir}/ovs/db
284 %{py_sitescriptdir}/ovs/db/*.py*
286 %files -n ovsdbmonitor
287 %defattr(644,root,root,755)
288 %attr(755,root,root) %{_bindir}/ovsdbmonitor
289 %{_datadir}/ovsdbmonitor
290 %{_desktopdir}/ovsdbmonitor.desktop
291 %{_mandir}/man1/ovsdbmonitor.1*
294 %defattr(644,root,root,755)
295 %attr(755,root,root) %{_bindir}/ovs-test
296 %attr(755,root,root) %{_bindir}/ovs-vlan-test
297 %{py_sitescriptdir}/ovstest
298 %{_mandir}/man8/ovs-test.8*
302 %files -n kernel%{_alt_kernel}-net-openvswitch
303 %defattr(644,root,root,755)
304 /lib/modules/%{_kernel_ver}/kernel/net/openvswitch/*.ko*