8faea6cb8c26c605534483d7e4e64126f9f88b54
[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 # The entire source code is ASL 2.0 except datapath/ which is GPLv2
23 License: ASL 2.0
24 Release: 1%{?dist}
25 Source: openvswitch-%{version}.tar.gz
26 #Source1: openvswitch-init
27 Buildroot: /tmp/openvswitch-fedora-rpm
28
29 # make check dependencies
30 BuildRequires: procps-ng
31
32 Requires(post):  systemd-units
33 Requires(preun): systemd-units
34 Requires(postun): systemd-units
35
36 %bcond_without check
37
38 %description
39 Open vSwitch provides standard network bridging functions augmented with
40 support for the OpenFlow protocol for remote per-flow control of
41 traffic.
42
43 %prep
44 %setup -q -n openvswitch-%{version}
45
46 %build
47 ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} --enable-ssl
48 make %{_smp_mflags}
49
50 %install
51 rm -rf $RPM_BUILD_ROOT
52 make install DESTDIR=$RPM_BUILD_ROOT
53 install -d -m 755 $RPM_BUILD_ROOT/etc
54 install -d -m 755 $RPM_BUILD_ROOT/etc/openvswitch
55 install -p -D -m 0644 rhel/usr_lib_systemd_system_openvswitch.service \
56         $RPM_BUILD_ROOT%{_unitdir}/openvswitch.service
57 install -p -D -m 0644 rhel/usr_lib_systemd_system_openvswitch-nonetwork.service \
58         $RPM_BUILD_ROOT%{_unitdir}/openvswitch-nonetwork.service
59 install -m 755 rhel/etc_init.d_openvswitch \
60         $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/openvswitch.init
61 install -d -m 755 $RPM_BUILD_ROOT/etc/sysconfig
62 install -d -m 755 $RPM_BUILD_ROOT/etc/logrotate.d
63 install -m 755 rhel/etc_logrotate.d_openvswitch \
64         $RPM_BUILD_ROOT/etc/logrotate.d/openvswitch
65 install -d -m 755 $RPM_BUILD_ROOT/etc/profile.d
66 install -m 644 vswitchd/vswitch.ovsschema \
67         $RPM_BUILD_ROOT/usr/share/openvswitch/vswitch.ovsschema
68 install -d -m 755 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts
69 install -d -m 0755 $RPM_BUILD_ROOT/etc/sysconfig/network-scripts/
70 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifdown-ovs \
71         $RPM_BUILD_ROOT/etc/sysconfig/network-scripts/ifdown-ovs
72 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \
73         $RPM_BUILD_ROOT/etc/sysconfig/network-scripts/ifup-ovs
74 install -p -D -m 0644 rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
75         $RPM_BUILD_ROOT/etc/sysconfig/openvswitch
76 install -d -m 755 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts
77
78 install python/compat/uuid.py $RPM_BUILD_ROOT/usr/share/openvswitch/python
79 install python/compat/argparse.py $RPM_BUILD_ROOT/usr/share/openvswitch/python
80
81 install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
82
83 # Get rid of stuff we don't want to make RPM happy.
84 (cd "$RPM_BUILD_ROOT" && rm -f usr/lib/lib*)
85
86 %check
87 %if %{with check}
88     if make check TESTSUITEFLAGS='%{_smp_mflags}' ||
89        make check TESTSUITEFLAGS='--recheck'; then :;
90     else
91         cat tests/testsuite.log
92         exit 1
93     fi
94 %endif
95
96 %clean
97 rm -rf $RPM_BUILD_ROOT
98
99 %preun
100 # Package removal, not upgrade
101 systemctl stop openvswitch.service
102 systemctl disable openvswitch.service
103
104 %post
105 if test ! -e /etc/openvswitch/conf.db; then
106     install -d -m 755 -o root -g root /etc/openvswitch
107
108     # Create ovs-vswitchd config database
109     ovsdb-tool -vANY:console:emer create /etc/openvswitch/conf.db \
110             /usr/share/openvswitch/vswitch.ovsschema
111
112     # Create initial table in config database
113     ovsdb-tool -vANY:console:emer transact /etc/openvswitch/conf.db \
114             '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
115             > /dev/null
116 fi
117 # Initial installation
118 systemctl enable openvswitch.service
119 systemctl start openvswitch.service
120
121 %postun
122
123 %files
124 %defattr(-,root,root)
125 %config /etc/sysconfig/openvswitch
126 %config /etc/logrotate.d/openvswitch
127 %{_unitdir}/openvswitch.service
128 %{_unitdir}/openvswitch-nonetwork.service
129 %{_datadir}/openvswitch/scripts/openvswitch.init
130 %{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
131 %{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
132 /usr/share/openvswitch/bugtool-plugins/
133 /usr/share/openvswitch/python/ovs/__init__.py*
134 /usr/share/openvswitch/python/ovs/daemon.py*
135 /usr/share/openvswitch/python/ovs/db/__init__.py*
136 /usr/share/openvswitch/python/ovs/db/data.py*
137 /usr/share/openvswitch/python/ovs/db/error.py*
138 /usr/share/openvswitch/python/ovs/db/idl.py*
139 /usr/share/openvswitch/python/ovs/db/parser.py*
140 /usr/share/openvswitch/python/ovs/db/schema.py*
141 /usr/share/openvswitch/python/ovs/db/types.py*
142 /usr/share/openvswitch/python/ovs/dirs.py*
143 /usr/share/openvswitch/python/ovs/fatal_signal.py*
144 /usr/share/openvswitch/python/ovs/json.py*
145 /usr/share/openvswitch/python/ovs/jsonrpc.py*
146 /usr/share/openvswitch/python/ovs/ovsuuid.py*
147 /usr/share/openvswitch/python/ovs/poller.py*
148 /usr/share/openvswitch/python/ovs/process.py*
149 /usr/share/openvswitch/python/ovs/reconnect.py*
150 /usr/share/openvswitch/python/ovs/socket_util.py*
151 /usr/share/openvswitch/python/ovs/stream.py*
152 /usr/share/openvswitch/python/ovs/timeval.py*
153 /usr/share/openvswitch/python/ovs/util.py*
154 /usr/share/openvswitch/python/ovs/version.py*
155 /usr/share/openvswitch/python/ovs/unixctl/__init__.py*
156 /usr/share/openvswitch/python/ovs/unixctl/client.py*
157 /usr/share/openvswitch/python/ovs/unixctl/server.py*
158 /usr/share/openvswitch/python/uuid.py*
159 /usr/share/openvswitch/python/argparse.py*
160 /usr/share/openvswitch/python/ovs/vlog.py*
161 /usr/share/openvswitch/python/ovstest/__init__.py*
162 /usr/share/openvswitch/python/ovstest/args.py*
163 /usr/share/openvswitch/python/ovstest/rpcserver.py*
164 /usr/share/openvswitch/python/ovstest/tcp.py*
165 /usr/share/openvswitch/python/ovstest/udp.py*
166 /usr/share/openvswitch/python/ovstest/util.py*
167 /usr/share/openvswitch/python/ovstest/vswitch.py*
168 /usr/share/openvswitch/python/ovstest/tests.py*
169 /usr/share/openvswitch/scripts/ovs-bugtool-*
170 /usr/share/openvswitch/scripts/ovs-check-dead-ifs
171 /usr/share/openvswitch/scripts/ovs-lib
172 /usr/share/openvswitch/scripts/ovs-vtep
173 %config /usr/share/openvswitch/vswitch.ovsschema
174 %config /usr/share/openvswitch/vtep.ovsschema
175 /usr/sbin/ovs-bugtool
176 /usr/sbin/ovs-vswitchd
177 /usr/sbin/ovsdb-server
178 /usr/bin/ovs-appctl
179 /usr/bin/ovs-dpctl
180 /usr/bin/ovs-dpctl-top
181 /usr/bin/ovs-ofctl
182 /usr/bin/ovs-vsctl
183 /usr/bin/ovsdb-client
184 /usr/bin/ovsdb-tool
185 /usr/bin/ovs-pki
186 /usr/bin/ovs-test
187 /usr/bin/ovs-l3ping
188 /usr/bin/vtep-ctl
189 %doc /usr/share/man/man8/ovs-pki.8.gz
190 %doc /usr/share/man/man1/ovsdb-client.1.gz
191 %doc /usr/share/man/man1/ovsdb-server.1.gz
192 %doc /usr/share/man/man1/ovsdb-tool.1.gz
193 %doc /usr/share/man/man5/ovs-vswitchd.conf.db.5.gz
194 %doc /usr/share/man/man5/vtep.5.gz
195 %doc /usr/share/man/man8/ovs-appctl.8.gz
196 %doc /usr/share/man/man8/ovs-bugtool.8.gz
197 %doc /usr/share/man/man8/ovs-ctl.8.gz
198 %doc /usr/share/man/man8/ovs-dpctl.8.gz
199 %doc /usr/share/man/man8/ovs-dpctl-top.8.gz
200 %doc /usr/share/man/man8/ovs-ofctl.8.gz
201 %doc /usr/share/man/man8/ovs-parse-backtrace.8.gz
202 %doc /usr/share/man/man8/ovs-vsctl.8.gz
203 %doc /usr/share/man/man8/ovs-vswitchd.8.gz
204 %doc /usr/share/man/man8/ovs-test.8.gz
205 %doc /usr/share/man/man8/ovs-l3ping.8.gz
206 %doc /usr/share/man/man8/vtep-ctl.8.gz
207 /var/lib/openvswitch
208 /var/log/openvswitch
209 /usr/share/openvswitch/scripts/ovs-ctl
210 %exclude /etc/openvswitch
211 %exclude /usr/bin/ovs-benchmark
212 %exclude /usr/bin/ovs-parse-backtrace
213 %exclude /usr/bin/ovs-pcap
214 %exclude /usr/bin/ovs-tcpundump
215 %exclude /usr/bin/ovs-vlan-test
216 %exclude /usr/sbin/ovs-vlan-bug-workaround
217 %exclude /usr/share/man/man1/ovs-benchmark.1.gz
218 %exclude /usr/share/man/man1/ovs-pcap.1.gz
219 %exclude /usr/share/man/man1/ovs-tcpundump.1.gz
220 %exclude /usr/share/man/man8/ovs-vlan-bug-workaround.8.gz
221 %exclude /usr/share/man/man8/ovs-vlan-test.8.gz
222 %exclude /usr/share/openvswitch/scripts/ovs-save
223
224 %changelog
225 * Wed Jan 12 2011 Ralf Spenneberg <ralf@os-s.net>
226 - First build on F14