]>
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 |
2d2636a3 AA |
39 | BuildRequires: autoconf, automake, libtool |
40 | BuildRequires: python-sphinx | |
c434706a | 41 | |
329cf232 | 42 | %bcond_without check |
8ef22bb1 | 43 | %bcond_with check_datapath_kernel |
329cf232 | 44 | |
c434706a BP |
45 | %description |
46 | Open vSwitch provides standard network bridging functions and | |
47 | support for the OpenFlow protocol for remote per-flow control of | |
48 | traffic. | |
49 | ||
4886d4d2 EC |
50 | %package devel |
51 | Summary: Open vSwitch development package | |
52 | Group: Development/Libraries | |
53 | ||
54 | %description devel | |
55 | This package provides openvswitch headers and libopenvswitch for developers. | |
56 | ||
d8bfab53 JS |
57 | %package selinux-policy |
58 | Summary: Open vSwitch SELinux policy | |
59 | License: ASL 2.0 | |
60 | BuildArch: noarch | |
61 | Requires: selinux-policy-targeted | |
62 | ||
63 | %description selinux-policy | |
64 | Tailored Open vSwitch SELinux policy | |
65 | ||
c434706a BP |
66 | %prep |
67 | %setup -q | |
68 | ||
69 | %build | |
4886d4d2 EC |
70 | ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} \ |
71 | --libdir=%{_libdir} --enable-ssl --enable-shared | |
c434706a | 72 | make %{_smp_mflags} |
ee29e9fe | 73 | make selinux-policy |
c434706a BP |
74 | |
75 | %install | |
76 | rm -rf $RPM_BUILD_ROOT | |
77 | make install DESTDIR=$RPM_BUILD_ROOT | |
53755990 CW |
78 | |
79 | rhel_cp() { | |
80 | base=$1 | |
81 | mode=$2 | |
82 | dst=$RPM_BUILD_ROOT/$(echo $base | sed 's,_,/,g') | |
83 | install -D -m $mode rhel/$base $dst | |
84 | } | |
85 | rhel_cp etc_init.d_openvswitch 0755 | |
86 | rhel_cp etc_logrotate.d_openvswitch 0644 | |
87 | rhel_cp etc_sysconfig_network-scripts_ifup-ovs 0755 | |
88 | rhel_cp etc_sysconfig_network-scripts_ifdown-ovs 0755 | |
89 | rhel_cp usr_share_openvswitch_scripts_sysconfig.template 0644 | |
90 | ||
d8bfab53 JS |
91 | install -p -m 644 -D selinux/openvswitch-custom.pp \ |
92 | $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp | |
93 | ||
c434706a BP |
94 | # Get rid of stuff we don't want to make RPM happy. |
95 | rm \ | |
0bc1b46a BP |
96 | $RPM_BUILD_ROOT/usr/bin/ovs-testcontroller \ |
97 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-testcontroller.8 \ | |
9d7c5643 | 98 | $RPM_BUILD_ROOT/usr/bin/ovs-test \ |
2d8bdd8f | 99 | $RPM_BUILD_ROOT/usr/bin/ovs-l3ping \ |
9d7c5643 | 100 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8 \ |
2d8bdd8f | 101 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \ |
c434706a | 102 | $RPM_BUILD_ROOT/usr/sbin/ovs-vlan-bug-workaround \ |
1247b5a7 PM |
103 | $RPM_BUILD_ROOT/usr/share/man/man8/ovs-vlan-bug-workaround.8 \ |
104 | $RPM_BUILD_ROOT/usr/bin/ovn-* \ | |
105 | $RPM_BUILD_ROOT/usr/share/man/man?/ovn-* \ | |
106 | $RPM_BUILD_ROOT/usr/share/openvswitch/ovn-* \ | |
db1f3866 | 107 | $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/ovn* |
4886d4d2 | 108 | (cd "$RPM_BUILD_ROOT" && rm -rf usr/%{_lib}/*.la) |
2fd84d5e | 109 | (cd "$RPM_BUILD_ROOT" && rm -rf usr/include) |
c434706a | 110 | |
b9b56b27 JS |
111 | install -d -m 0755 $RPM_BUILD_ROOT%{_rundir}/openvswitch |
112 | install -d -m 0755 $RPM_BUILD_ROOT%{_localstatedir}/log/openvswitch | |
113 | install -d -m 0755 $RPM_BUILD_ROOT/var/lib/openvswitch | |
c434706a | 114 | |
4886d4d2 EC |
115 | copy_headers() { |
116 | src=$1 | |
117 | dst=$RPM_BUILD_ROOT/$2 | |
118 | install -d -m 0755 $dst | |
119 | install -m 0644 $src/*.h $dst | |
120 | } | |
121 | copy_headers include %{_includedir}/openvswitch | |
122 | copy_headers include/openflow %{_includedir}/openvswitch/openflow | |
123 | copy_headers include/openvswitch %{_includedir}/openvswitch/openvswitch | |
124 | copy_headers include/sparse %{_includedir}/openvswitch/sparse | |
125 | copy_headers include/sparse/arpa %{_includedir}/openvswitch/sparse/arpa | |
126 | copy_headers include/sparse/netinet %{_includedir}/openvswitch/sparse/netinet | |
127 | copy_headers include/sparse/sys %{_includedir}/openvswitch/sparse/sys | |
128 | copy_headers lib %{_includedir}/openvswitch/lib | |
129 | ||
130 | install -D -m 0644 lib/.libs/libopenvswitch.a \ | |
131 | $RPM_BUILD_ROOT/%{_libdir}/libopenvswitch.a | |
132 | ||
329cf232 GS |
133 | %check |
134 | %if %{with check} | |
0d3f2152 | 135 | if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :; |
329cf232 GS |
136 | else |
137 | cat tests/testsuite.log | |
138 | exit 1 | |
139 | fi | |
140 | %endif | |
8ef22bb1 LR |
141 | %if %{with check_datapath_kernel} |
142 | if make check-kernel RECHECK=yes; then :; | |
143 | else | |
144 | cat tests/system-kmod-testsuite.log | |
145 | exit 1 | |
146 | fi | |
147 | %endif | |
329cf232 | 148 | |
c434706a BP |
149 | %clean |
150 | rm -rf $RPM_BUILD_ROOT | |
151 | ||
152 | %post | |
153 | # Create default or update existing /etc/sysconfig/openvswitch. | |
154 | SYSCONFIG=/etc/sysconfig/openvswitch | |
155 | TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template | |
156 | if [ ! -e $SYSCONFIG ]; then | |
157 | cp $TEMPLATE $SYSCONFIG | |
158 | else | |
159 | for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE) | |
160 | do | |
161 | if ! grep $var $SYSCONFIG >/dev/null 2>&1; then | |
162 | echo >> $SYSCONFIG | |
163 | sed -n "/$var:/,/$var=/p" $TEMPLATE >> $SYSCONFIG | |
164 | fi | |
165 | done | |
166 | fi | |
167 | ||
168 | # Ensure all required services are set to run | |
169 | /sbin/chkconfig --add openvswitch | |
170 | /sbin/chkconfig openvswitch on | |
171 | ||
d8bfab53 JS |
172 | %post selinux-policy |
173 | /usr/sbin/semodule -i %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp &> /dev/null || : | |
174 | ||
c434706a BP |
175 | %preun |
176 | if [ "$1" = "0" ]; then # $1 = 0 for uninstall | |
177 | /sbin/service openvswitch stop | |
178 | /sbin/chkconfig --del openvswitch | |
179 | fi | |
180 | ||
181 | %postun | |
182 | if [ "$1" = "0" ]; then # $1 = 0 for uninstall | |
183 | rm -f /etc/openvswitch/conf.db | |
184 | rm -f /etc/sysconfig/openvswitch | |
185 | rm -f /etc/openvswitch/vswitchd.cacert | |
186 | fi | |
187 | ||
d8bfab53 JS |
188 | %postun selinux-policy |
189 | if [ $1 -eq 0 ] ; then | |
190 | /usr/sbin/semodule -r openvswitch-custom &> /dev/null || : | |
191 | fi | |
192 | ||
c434706a BP |
193 | exit 0 |
194 | ||
195 | %files | |
196 | %defattr(-,root,root) | |
f0dc83b7 | 197 | %dir /etc/openvswitch |
2c9907cd AW |
198 | /etc/bash_completion.d/ovs-appctl-bashcomp.bash |
199 | /etc/bash_completion.d/ovs-vsctl-bashcomp.bash | |
c434706a | 200 | /etc/init.d/openvswitch |
53755990 | 201 | %config(noreplace) /etc/logrotate.d/openvswitch |
0fb42626 AF |
202 | /etc/sysconfig/network-scripts/ifup-ovs |
203 | /etc/sysconfig/network-scripts/ifdown-ovs | |
c434706a BP |
204 | /usr/bin/ovs-appctl |
205 | /usr/bin/ovs-dpctl | |
14b4c575 | 206 | /usr/bin/ovs-dpctl-top |
ec8f0f0c | 207 | /usr/bin/ovs-docker |
c434706a | 208 | /usr/bin/ovs-ofctl |
013061cf | 209 | /usr/bin/ovs-parse-backtrace |
c434706a | 210 | /usr/bin/ovs-pcap |
def046d5 | 211 | /usr/bin/ovs-pki |
f75fe487 | 212 | /usr/bin/ovs-tcpdump |
c434706a BP |
213 | /usr/bin/ovs-tcpundump |
214 | /usr/bin/ovs-vlan-test | |
215 | /usr/bin/ovs-vsctl | |
216 | /usr/bin/ovsdb-client | |
217 | /usr/bin/ovsdb-tool | |
dd2d06c3 | 218 | /usr/bin/vtep-ctl |
4886d4d2 | 219 | %{_libdir}/lib*.so.* |
51a5f442 | 220 | /usr/sbin/ovs-bugtool |
c434706a BP |
221 | /usr/sbin/ovs-vswitchd |
222 | /usr/sbin/ovsdb-server | |
223 | /usr/share/man/man1/ovs-pcap.1.gz | |
224 | /usr/share/man/man1/ovs-tcpundump.1.gz | |
225 | /usr/share/man/man1/ovsdb-client.1.gz | |
226 | /usr/share/man/man1/ovsdb-server.1.gz | |
227 | /usr/share/man/man1/ovsdb-tool.1.gz | |
6bb9b060 | 228 | /usr/share/man/man5/ovsdb-server.5.gz |
c434706a | 229 | /usr/share/man/man5/ovs-vswitchd.conf.db.5.gz |
76c0528f | 230 | %{_mandir}/man5/ovsdb.5* |
dd2d06c3 | 231 | /usr/share/man/man5/vtep.5.gz |
b81dc9a3 | 232 | /usr/share/man/man7/ovs-fields.7.gz |
76c0528f AA |
233 | %{_mandir}/man7/ovsdb.7* |
234 | %{_mandir}/man7/ovsdb-server.7* | |
c434706a | 235 | /usr/share/man/man8/ovs-appctl.8.gz |
2ad7bf32 | 236 | /usr/share/man/man8/ovs-bugtool.8.gz |
c434706a BP |
237 | /usr/share/man/man8/ovs-ctl.8.gz |
238 | /usr/share/man/man8/ovs-dpctl.8.gz | |
14b4c575 | 239 | /usr/share/man/man8/ovs-dpctl-top.8.gz |
c434706a | 240 | /usr/share/man/man8/ovs-ofctl.8.gz |
013061cf | 241 | /usr/share/man/man8/ovs-parse-backtrace.8.gz |
def046d5 | 242 | /usr/share/man/man8/ovs-pki.8.gz |
f75fe487 | 243 | /usr/share/man/man8/ovs-tcpdump.8.gz |
c434706a BP |
244 | /usr/share/man/man8/ovs-vlan-test.8.gz |
245 | /usr/share/man/man8/ovs-vsctl.8.gz | |
246 | /usr/share/man/man8/ovs-vswitchd.8.gz | |
dd2d06c3 | 247 | /usr/share/man/man8/vtep-ctl.8.gz |
4b38c153 | 248 | /usr/share/openvswitch/bugtool-plugins/ |
c434706a | 249 | /usr/share/openvswitch/python/ |
b2df0225 | 250 | /usr/share/openvswitch/scripts/ovs-bugtool-* |
2dc7590d | 251 | /usr/share/openvswitch/scripts/ovs-check-dead-ifs |
c434706a | 252 | /usr/share/openvswitch/scripts/ovs-ctl |
d422c118 | 253 | /usr/share/openvswitch/scripts/ovs-lib |
c434706a | 254 | /usr/share/openvswitch/scripts/ovs-save |
dd2d06c3 | 255 | /usr/share/openvswitch/scripts/ovs-vtep |
c434706a BP |
256 | /usr/share/openvswitch/scripts/sysconfig.template |
257 | /usr/share/openvswitch/vswitch.ovsschema | |
dd2d06c3 | 258 | /usr/share/openvswitch/vtep.ovsschema |
11e02906 | 259 | %doc COPYING NOTICE README.rst NEWS rhel/README.RHEL.rst |
c434706a | 260 | /var/lib/openvswitch |
c649fe54 | 261 | /var/log/openvswitch |
4886d4d2 EC |
262 | |
263 | %files devel | |
264 | %{_libdir}/lib*.so | |
265 | %{_libdir}/lib*.a | |
266 | %{_libdir}/pkgconfig | |
267 | %{_includedir}/openvswitch/* | |
d8bfab53 JS |
268 | |
269 | %files selinux-policy | |
270 | %defattr(-,root,root) | |
271 | %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp |