fedora-spec: add openvswitch-test package
[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 Name: openvswitch
17 Summary: Open vSwitch
18 Group: System Environment/Daemons
19 URL: http://www.openvswitch.org/
20 Version: @VERSION@
21
22 # Nearly all of openvswitch is ASL 2.0.  The bugtool is LGPLv2+, and the
23 # lib/sflow*.[ch] files are SISSL
24 # datapath/ is GPLv2 (although not built into any of the binary packages)
25 # python/compat is Python (although not built into any of the binary packages)
26 License: ASL 2.0 and LGPLv2+ and SISSL
27 Release: 1%{?dist}
28 Source: http://openvswitch.org/releases/%{name}-%{version}.tar.gz
29
30 BuildRequires: autoconf
31 BuildRequires: systemd-units openssl openssl-devel
32 BuildRequires: python python-twisted-core python-zope-interface PyQt4
33 BuildRequires: desktop-file-utils
34 BuildRequires: groff graphviz
35
36 Requires: openssl iproute module-init-tools
37 #Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
38 Requires: kernel >= 3.15.0-0
39
40 Requires(post): systemd-units
41 Requires(preun): systemd-units
42 Requires(postun): systemd-units
43
44 %bcond_without check
45
46 %description
47 Open vSwitch provides standard network bridging functions and
48 support for the OpenFlow protocol for remote per-flow control of
49 traffic.
50
51 %package -n python-openvswitch
52 Summary: Open vSwitch python bindings
53 License: ASL 2.0
54 BuildArch: noarch
55 Requires: python
56
57 %description -n python-openvswitch
58 Python bindings for the Open vSwitch database
59
60 %package test
61 Summary: Open vSwitch testing utilities
62 License: ASL 2.0
63 BuildArch: noarch
64 Requires: python-openvswitch = %{version}-%{release}
65 Requires: python python-twisted-core python-twisted-web
66
67 %description test
68 Utilities that are useful to diagnose performance and connectivity
69 issues in Open vSwitch setup.
70
71 %prep
72 %setup -q -n openvswitch-%{version}
73
74 %build
75 %configure --enable-ssl --with-pkidir=%{_sharedstatedir}/openvswitch/pki
76 make %{_smp_mflags}
77
78 %install
79 rm -rf $RPM_BUILD_ROOT
80 make install DESTDIR=$RPM_BUILD_ROOT
81 install -d -m 755 $RPM_BUILD_ROOT/etc
82 install -d -m 755 $RPM_BUILD_ROOT/etc/openvswitch
83 install -p -D -m 0644 rhel/usr_lib_systemd_system_openvswitch.service \
84         $RPM_BUILD_ROOT%{_unitdir}/openvswitch.service
85 install -p -D -m 0644 rhel/usr_lib_systemd_system_openvswitch-nonetwork.service \
86         $RPM_BUILD_ROOT%{_unitdir}/openvswitch-nonetwork.service
87 install -m 755 rhel/etc_init.d_openvswitch \
88         $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/openvswitch.init
89 install -d -m 755 $RPM_BUILD_ROOT/etc/sysconfig
90 install -d -m 755 $RPM_BUILD_ROOT/etc/logrotate.d
91 install -m 755 rhel/etc_logrotate.d_openvswitch \
92         $RPM_BUILD_ROOT/etc/logrotate.d/openvswitch
93 install -d -m 755 $RPM_BUILD_ROOT/etc/profile.d
94 install -m 644 vswitchd/vswitch.ovsschema \
95         $RPM_BUILD_ROOT/usr/share/openvswitch/vswitch.ovsschema
96 install -d -m 755 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts
97 install -d -m 0755 $RPM_BUILD_ROOT/etc/sysconfig/network-scripts/
98 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifdown-ovs \
99         $RPM_BUILD_ROOT/etc/sysconfig/network-scripts/ifdown-ovs
100 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \
101         $RPM_BUILD_ROOT/etc/sysconfig/network-scripts/ifup-ovs
102 install -p -D -m 0644 rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
103         $RPM_BUILD_ROOT/etc/sysconfig/openvswitch
104 install -d -m 755 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts
105
106 install -d -m 0755 $RPM_BUILD_ROOT%{python_sitelib}
107 mv $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/* $RPM_BUILD_ROOT%{python_sitelib}
108 rmdir $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
109
110 install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
111
112 # Get rid of stuff we don't want to make RPM happy.
113 (cd "$RPM_BUILD_ROOT" && rm -f usr/lib/lib*)
114
115 %check
116 %if %{with check}
117     if make check TESTSUITEFLAGS='%{_smp_mflags}' ||
118        make check TESTSUITEFLAGS='--recheck'; then :;
119     else
120         cat tests/testsuite.log
121         exit 1
122     fi
123 %endif
124
125 %clean
126 rm -rf $RPM_BUILD_ROOT
127
128 %preun
129 # Package removal, not upgrade
130 systemctl stop openvswitch.service
131 systemctl disable openvswitch.service
132
133 %post
134 if test ! -e /etc/openvswitch/conf.db; then
135     install -d -m 755 -o root -g root /etc/openvswitch
136
137     # Create ovs-vswitchd config database
138     ovsdb-tool -vANY:console:emer create /etc/openvswitch/conf.db \
139             /usr/share/openvswitch/vswitch.ovsschema
140
141     # Create initial table in config database
142     ovsdb-tool -vANY:console:emer transact /etc/openvswitch/conf.db \
143             '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
144             > /dev/null
145 fi
146 # Initial installation
147 systemctl enable openvswitch.service
148 systemctl start openvswitch.service
149
150 %postun
151
152 %files -n python-openvswitch
153 %{python_sitelib}/ovs
154 %doc COPYING
155
156 %files test
157 %{_bindir}/ovs-test
158 %{_bindir}/ovs-vlan-test
159 %{_bindir}/ovs-l3ping
160 %{_mandir}/man8/ovs-test.8*
161 %{_mandir}/man8/ovs-vlan-test.8*
162 %{_mandir}/man8/ovs-l3ping.8*
163 %{python_sitelib}/ovstest
164
165 %files
166 %defattr(-,root,root)
167 %config /etc/sysconfig/openvswitch
168 %config /etc/logrotate.d/openvswitch
169 %{_unitdir}/openvswitch.service
170 %{_unitdir}/openvswitch-nonetwork.service
171 %{_datadir}/openvswitch/scripts/openvswitch.init
172 %{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
173 %{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
174 /usr/share/openvswitch/bugtool-plugins/
175 /usr/share/openvswitch/scripts/ovs-bugtool-*
176 /usr/share/openvswitch/scripts/ovs-check-dead-ifs
177 /usr/share/openvswitch/scripts/ovs-lib
178 /usr/share/openvswitch/scripts/ovs-vtep
179 %config /usr/share/openvswitch/vswitch.ovsschema
180 %config /usr/share/openvswitch/vtep.ovsschema
181 /usr/sbin/ovs-bugtool
182 /usr/sbin/ovs-vswitchd
183 /usr/sbin/ovsdb-server
184 /usr/bin/ovs-appctl
185 /usr/bin/ovs-docker
186 /usr/bin/ovs-dpctl
187 /usr/bin/ovs-dpctl-top
188 /usr/bin/ovs-ofctl
189 /usr/bin/ovs-vsctl
190 /usr/bin/ovsdb-client
191 /usr/bin/ovsdb-tool
192 /usr/bin/ovs-testcontroller
193 /usr/bin/ovs-pki
194 /usr/bin/vtep-ctl
195 %doc /usr/share/man/man8/ovs-testcontroller.8.gz
196 %doc /usr/share/man/man8/ovs-pki.8.gz
197 %doc /usr/share/man/man1/ovsdb-client.1.gz
198 %doc /usr/share/man/man1/ovsdb-server.1.gz
199 %doc /usr/share/man/man1/ovsdb-tool.1.gz
200 %doc /usr/share/man/man5/ovs-vswitchd.conf.db.5.gz
201 %doc /usr/share/man/man5/vtep.5.gz
202 %doc /usr/share/man/man8/ovs-appctl.8.gz
203 %doc /usr/share/man/man8/ovs-bugtool.8.gz
204 %doc /usr/share/man/man8/ovs-ctl.8.gz
205 %doc /usr/share/man/man8/ovs-dpctl.8.gz
206 %doc /usr/share/man/man8/ovs-dpctl-top.8.gz
207 %doc /usr/share/man/man8/ovs-ofctl.8.gz
208 %doc /usr/share/man/man8/ovs-parse-backtrace.8.gz
209 %doc /usr/share/man/man8/ovs-vsctl.8.gz
210 %doc /usr/share/man/man8/ovs-vswitchd.8.gz
211 %doc /usr/share/man/man8/vtep-ctl.8.gz
212 %doc COPYING DESIGN.md INSTALL.SSL.md NOTICE README.md WHY-OVS.md FAQ.md NEWS INSTALL.DPDK.md
213 /var/lib/openvswitch
214 /var/log/openvswitch
215 /usr/share/openvswitch/scripts/ovs-ctl
216 %exclude /etc/openvswitch
217 %exclude /usr/bin/ovs-benchmark
218 %exclude /usr/bin/ovs-parse-backtrace
219 %exclude /usr/bin/ovs-pcap
220 %exclude /usr/bin/ovs-tcpundump
221 %exclude /usr/sbin/ovs-vlan-bug-workaround
222 %exclude /usr/share/man/man1/ovs-benchmark.1.gz
223 %exclude /usr/share/man/man1/ovs-pcap.1.gz
224 %exclude /usr/share/man/man1/ovs-tcpundump.1.gz
225 %exclude /usr/share/man/man8/ovs-vlan-bug-workaround.8.gz
226 %exclude /usr/share/openvswitch/scripts/ovs-save
227
228 %changelog
229 * Wed Jan 12 2011 Ralf Spenneberg <ralf@os-s.net>
230 - First build on F14