]>
Commit | Line | Data |
---|---|---|
c434706a BP |
1 | # Spec file for Open vSwitch on Red Hat Enterprise Linux. |
2 | ||
e7529141 | 3 | # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc. |
c434706a BP |
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. | |
329cf232 GS |
9 | # |
10 | # If tests have to be skipped while building, specify the '--without check' | |
11 | # option. For example: | |
8ef22bb1 LR |
12 | # rpmbuild -bb --without check rhel/openvswitch.spec |
13 | # | |
14 | # Support for executing kernel data path tests under rpmbuild is | |
15 | # provided, however this is intended for use only in test environments | |
16 | # and should not be used otherwise (these tests require root privileges). | |
17 | # These tests can be executed, for example, via: | |
18 | # rpmbuild -rb --with check_datapath_kernel openvswitch.src.rpm | |
19 | # | |
20 | # These tests will use the currently installed OVS kernel modules, when | |
21 | # testing out of tree kernel modules the appropriate openvswitch-kmod | |
22 | # package should be installed first. | |
c434706a BP |
23 | |
24 | Name: openvswitch | |
25 | Summary: Open vSwitch daemon/database/utilities | |
26 | Group: System Environment/Daemons | |
27 | URL: http://www.openvswitch.org/ | |
e0edde6f | 28 | Vendor: Nicira, Inc. |
c434706a BP |
29 | Version: @VERSION@ |
30 | ||
31 | License: ASL 2.0 | |
32 | Release: 1 | |
33 | Source: openvswitch-%{version}.tar.gz | |
34 | Buildroot: /tmp/openvswitch-rpm | |
89ca9021 | 35 | Requires: logrotate, hostname, python >= 2.7, python-six |
4f3f6904 | 36 | BuildRequires: python-six |
4465062f | 37 | BuildRequires: openssl-devel |
d8bfab53 | 38 | BuildRequires: checkpolicy, selinux-policy-devel |
c434706a | 39 | |
329cf232 | 40 | %bcond_without check |
8ef22bb1 | 41 | %bcond_with check_datapath_kernel |
329cf232 | 42 | |
c434706a BP |
43 | %description |
44 | Open vSwitch provides standard network bridging functions and | |
45 | support for the OpenFlow protocol for remote per-flow control of | |
46 | traffic. | |
47 | ||
4886d4d2 EC |
48 | %package devel |
49 | Summary: Open vSwitch development package | |
50 | Group: Development/Libraries | |
51 | ||
52 | %description devel | |
53 | This package provides openvswitch headers and libopenvswitch for developers. | |
54 | ||
d8bfab53 JS |
55 | %package selinux-policy |
56 | Summary: Open vSwitch SELinux policy | |
57 | License: ASL 2.0 | |
58 | BuildArch: noarch | |
59 | Requires: selinux-policy-targeted | |
60 | ||
61 | %description selinux-policy | |
62 | Tailored Open vSwitch SELinux policy | |
63 | ||
c434706a BP |
64 | %prep |
65 | %setup -q | |
66 | ||
67 | %build | |
4886d4d2 EC |
68 | ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} \ |
69 | --libdir=%{_libdir} --enable-ssl --enable-shared | |
c434706a | 70 | make %{_smp_mflags} |
d8bfab53 JS |
71 | cd selinux |
72 | make -f %{_datadir}/selinux/devel/Makefile | |
c434706a BP |
73 | |
74 | %install | |
75 | rm -rf $RPM_BUILD_ROOT | |
76 | make install DESTDIR=$RPM_BUILD_ROOT | |
53755990 CW |
77 | |
78 | rhel_cp() { | |
79 | base=$1 | |
80 | mode=$2 | |
81 | dst=$RPM_BUILD_ROOT/$(echo $base | sed 's,_,/,g') | |
82 | install -D -m $mode rhel/$base $dst | |
83 | } | |
84 | rhel_cp etc_init.d_openvswitch 0755 | |
85 | rhel_cp etc_logrotate.d_openvswitch 0644 | |
86 | rhel_cp etc_sysconfig_network-scripts_ifup-ovs 0755 | |
87 | rhel_cp etc_sysconfig_network-scripts_ifdown-ovs 0755 | |
88 | rhel_cp usr_share_openvswitch_scripts_sysconfig.template 0644 | |
89 | ||
d8bfab53 JS |
90 | install -p -m 644 -D selinux/openvswitch-custom.pp \ |
91 | $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp | |
92 | ||
c434706a BP |
93 | # Get rid of stuff we don't want to make RPM happy. |
94 | rm \ | |
0bc1b46a BP |
95 | $RPM_BUILD_ROOT/usr/bin/ovs-testcontroller \ |
96 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-testcontroller.8 \ | |
9d7c5643 | 97 | $RPM_BUILD_ROOT/usr/bin/ovs-test \ |
2d8bdd8f | 98 | $RPM_BUILD_ROOT/usr/bin/ovs-l3ping \ |
9d7c5643 | 99 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8 \ |
2d8bdd8f | 100 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \ |
c434706a | 101 | $RPM_BUILD_ROOT/usr/sbin/ovs-vlan-bug-workaround \ |
1247b5a7 PM |
102 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-vlan-bug-workaround.8 \ |
103 | $RPM_BUILD_ROOT/usr/bin/ovn-* \ | |
104 | $RPM_BUILD_ROOT/usr/share/man/man?/ovn-* \ | |
105 | $RPM_BUILD_ROOT/usr/share/openvswitch/ovn-* \ | |
db1f3866 | 106 | $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/ovn* |
4886d4d2 | 107 | (cd "$RPM_BUILD_ROOT" && rm -rf usr/%{_lib}/*.la) |
2fd84d5e | 108 | (cd "$RPM_BUILD_ROOT" && rm -rf usr/include) |
c434706a | 109 | |
b9b56b27 JS |
110 | install -d -m 0755 $RPM_BUILD_ROOT%{_rundir}/openvswitch |
111 | install -d -m 0755 $RPM_BUILD_ROOT%{_localstatedir}/log/openvswitch | |
112 | install -d -m 0755 $RPM_BUILD_ROOT/var/lib/openvswitch | |
c434706a | 113 | |
4886d4d2 EC |
114 | copy_headers() { |
115 | src=$1 | |
116 | dst=$RPM_BUILD_ROOT/$2 | |
117 | install -d -m 0755 $dst | |
118 | install -m 0644 $src/*.h $dst | |
119 | } | |
120 | copy_headers include %{_includedir}/openvswitch | |
121 | copy_headers include/openflow %{_includedir}/openvswitch/openflow | |
122 | copy_headers include/openvswitch %{_includedir}/openvswitch/openvswitch | |
123 | copy_headers include/sparse %{_includedir}/openvswitch/sparse | |
124 | copy_headers include/sparse/arpa %{_includedir}/openvswitch/sparse/arpa | |
125 | copy_headers include/sparse/netinet %{_includedir}/openvswitch/sparse/netinet | |
126 | copy_headers include/sparse/sys %{_includedir}/openvswitch/sparse/sys | |
127 | copy_headers lib %{_includedir}/openvswitch/lib | |
128 | ||
129 | install -D -m 0644 lib/.libs/libopenvswitch.a \ | |
130 | $RPM_BUILD_ROOT/%{_libdir}/libopenvswitch.a | |
131 | ||
329cf232 GS |
132 | %check |
133 | %if %{with check} | |
0d3f2152 | 134 | if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :; |
329cf232 GS |
135 | else |
136 | cat tests/testsuite.log | |
137 | exit 1 | |
138 | fi | |
139 | %endif | |
8ef22bb1 LR |
140 | %if %{with check_datapath_kernel} |
141 | if make check-kernel RECHECK=yes; then :; | |
142 | else | |
143 | cat tests/system-kmod-testsuite.log | |
144 | exit 1 | |
145 | fi | |
146 | %endif | |
329cf232 | 147 | |
c434706a BP |
148 | %clean |
149 | rm -rf $RPM_BUILD_ROOT | |
150 | ||
151 | %post | |
152 | # Create default or update existing /etc/sysconfig/openvswitch. | |
153 | SYSCONFIG=/etc/sysconfig/openvswitch | |
154 | TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template | |
155 | if [ ! -e $SYSCONFIG ]; then | |
156 | cp $TEMPLATE $SYSCONFIG | |
157 | else | |
158 | for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE) | |
159 | do | |
160 | if ! grep $var $SYSCONFIG >/dev/null 2>&1; then | |
161 | echo >> $SYSCONFIG | |
162 | sed -n "/$var:/,/$var=/p" $TEMPLATE >> $SYSCONFIG | |
163 | fi | |
164 | done | |
165 | fi | |
166 | ||
167 | # Ensure all required services are set to run | |
168 | /sbin/chkconfig --add openvswitch | |
169 | /sbin/chkconfig openvswitch on | |
170 | ||
d8bfab53 JS |
171 | %post selinux-policy |
172 | /usr/sbin/semodule -i %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp &> /dev/null || : | |
173 | ||
c434706a BP |
174 | %preun |
175 | if [ "$1" = "0" ]; then # $1 = 0 for uninstall | |
176 | /sbin/service openvswitch stop | |
177 | /sbin/chkconfig --del openvswitch | |
178 | fi | |
179 | ||
180 | %postun | |
181 | if [ "$1" = "0" ]; then # $1 = 0 for uninstall | |
182 | rm -f /etc/openvswitch/conf.db | |
183 | rm -f /etc/sysconfig/openvswitch | |
184 | rm -f /etc/openvswitch/vswitchd.cacert | |
185 | fi | |
186 | ||
d8bfab53 JS |
187 | %postun selinux-policy |
188 | if [ $1 -eq 0 ] ; then | |
189 | /usr/sbin/semodule -r openvswitch-custom &> /dev/null || : | |
190 | fi | |
191 | ||
c434706a BP |
192 | exit 0 |
193 | ||
194 | %files | |
195 | %defattr(-,root,root) | |
f0dc83b7 | 196 | %dir /etc/openvswitch |
2c9907cd AW |
197 | /etc/bash_completion.d/ovs-appctl-bashcomp.bash |
198 | /etc/bash_completion.d/ovs-vsctl-bashcomp.bash | |
c434706a | 199 | /etc/init.d/openvswitch |
53755990 | 200 | %config(noreplace) /etc/logrotate.d/openvswitch |
0fb42626 AF |
201 | /etc/sysconfig/network-scripts/ifup-ovs |
202 | /etc/sysconfig/network-scripts/ifdown-ovs | |
c434706a BP |
203 | /usr/bin/ovs-appctl |
204 | /usr/bin/ovs-dpctl | |
14b4c575 | 205 | /usr/bin/ovs-dpctl-top |
ec8f0f0c | 206 | /usr/bin/ovs-docker |
c434706a | 207 | /usr/bin/ovs-ofctl |
013061cf | 208 | /usr/bin/ovs-parse-backtrace |
c434706a | 209 | /usr/bin/ovs-pcap |
def046d5 | 210 | /usr/bin/ovs-pki |
f75fe487 | 211 | /usr/bin/ovs-tcpdump |
c434706a BP |
212 | /usr/bin/ovs-tcpundump |
213 | /usr/bin/ovs-vlan-test | |
214 | /usr/bin/ovs-vsctl | |
215 | /usr/bin/ovsdb-client | |
216 | /usr/bin/ovsdb-tool | |
dd2d06c3 | 217 | /usr/bin/vtep-ctl |
4886d4d2 | 218 | %{_libdir}/lib*.so.* |
51a5f442 | 219 | /usr/sbin/ovs-bugtool |
c434706a BP |
220 | /usr/sbin/ovs-vswitchd |
221 | /usr/sbin/ovsdb-server | |
222 | /usr/share/man/man1/ovs-pcap.1.gz | |
223 | /usr/share/man/man1/ovs-tcpundump.1.gz | |
224 | /usr/share/man/man1/ovsdb-client.1.gz | |
225 | /usr/share/man/man1/ovsdb-server.1.gz | |
226 | /usr/share/man/man1/ovsdb-tool.1.gz | |
227 | /usr/share/man/man5/ovs-vswitchd.conf.db.5.gz | |
dd2d06c3 | 228 | /usr/share/man/man5/vtep.5.gz |
b81dc9a3 | 229 | /usr/share/man/man7/ovs-fields.7.gz |
c434706a | 230 | /usr/share/man/man8/ovs-appctl.8.gz |
2ad7bf32 | 231 | /usr/share/man/man8/ovs-bugtool.8.gz |
c434706a BP |
232 | /usr/share/man/man8/ovs-ctl.8.gz |
233 | /usr/share/man/man8/ovs-dpctl.8.gz | |
14b4c575 | 234 | /usr/share/man/man8/ovs-dpctl-top.8.gz |
c434706a | 235 | /usr/share/man/man8/ovs-ofctl.8.gz |
013061cf | 236 | /usr/share/man/man8/ovs-parse-backtrace.8.gz |
def046d5 | 237 | /usr/share/man/man8/ovs-pki.8.gz |
f75fe487 | 238 | /usr/share/man/man8/ovs-tcpdump.8.gz |
c434706a BP |
239 | /usr/share/man/man8/ovs-vlan-test.8.gz |
240 | /usr/share/man/man8/ovs-vsctl.8.gz | |
241 | /usr/share/man/man8/ovs-vswitchd.8.gz | |
dd2d06c3 | 242 | /usr/share/man/man8/vtep-ctl.8.gz |
4b38c153 | 243 | /usr/share/openvswitch/bugtool-plugins/ |
c434706a | 244 | /usr/share/openvswitch/python/ |
b2df0225 | 245 | /usr/share/openvswitch/scripts/ovs-bugtool-* |
2dc7590d | 246 | /usr/share/openvswitch/scripts/ovs-check-dead-ifs |
c434706a | 247 | /usr/share/openvswitch/scripts/ovs-ctl |
d422c118 | 248 | /usr/share/openvswitch/scripts/ovs-lib |
c434706a | 249 | /usr/share/openvswitch/scripts/ovs-save |
dd2d06c3 | 250 | /usr/share/openvswitch/scripts/ovs-vtep |
c434706a BP |
251 | /usr/share/openvswitch/scripts/sysconfig.template |
252 | /usr/share/openvswitch/vswitch.ovsschema | |
dd2d06c3 | 253 | /usr/share/openvswitch/vtep.ovsschema |
11e02906 | 254 | %doc COPYING NOTICE README.rst NEWS rhel/README.RHEL.rst |
c434706a | 255 | /var/lib/openvswitch |
c649fe54 | 256 | /var/log/openvswitch |
4886d4d2 EC |
257 | |
258 | %files devel | |
259 | %{_libdir}/lib*.so | |
260 | %{_libdir}/lib*.a | |
261 | %{_libdir}/pkgconfig | |
262 | %{_includedir}/openvswitch/* | |
d8bfab53 JS |
263 | |
264 | %files selinux-policy | |
265 | %defattr(-,root,root) | |
266 | %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp |