]> git.proxmox.com Git - mirror_ovs.git/blob - rhel/openvswitch.spec.in
Merge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEAD
[mirror_ovs.git] / rhel / openvswitch.spec.in
1 # Spec file for Open vSwitch on Red Hat Enterprise Linux.
2
3 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, 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.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.
23
24 Name: openvswitch
25 Summary: Open vSwitch daemon/database/utilities
26 Group: System Environment/Daemons
27 URL: http://www.openvswitch.org/
28 Vendor: Nicira, Inc.
29 Version: @VERSION@
30
31 License: ASL 2.0
32 Release: 1
33 Source: openvswitch-%{version}.tar.gz
34 Buildroot: /tmp/openvswitch-rpm
35 Requires: logrotate, hostname, python >= 2.7, python-six
36 BuildRequires: python-six
37 BuildRequires: openssl-devel
38 BuildRequires: checkpolicy, selinux-policy-devel
39 BuildRequires: autoconf, automake, libtool
40 BuildRequires: python-sphinx
41
42 %bcond_without check
43 %bcond_with check_datapath_kernel
44
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
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
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
66 %prep
67 %setup -q
68
69 %build
70 ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} \
71 --libdir=%{_libdir} --enable-ssl --enable-shared
72 make %{_smp_mflags}
73 make selinux/openvswitch-custom.te
74 cd selinux
75 make -f %{_datadir}/selinux/devel/Makefile
76
77 %install
78 rm -rf $RPM_BUILD_ROOT
79 make install DESTDIR=$RPM_BUILD_ROOT
80
81 rhel_cp() {
82 base=$1
83 mode=$2
84 dst=$RPM_BUILD_ROOT/$(echo $base | sed 's,_,/,g')
85 install -D -m $mode rhel/$base $dst
86 }
87 rhel_cp etc_init.d_openvswitch 0755
88 rhel_cp etc_logrotate.d_openvswitch 0644
89 rhel_cp etc_sysconfig_network-scripts_ifup-ovs 0755
90 rhel_cp etc_sysconfig_network-scripts_ifdown-ovs 0755
91 rhel_cp usr_share_openvswitch_scripts_sysconfig.template 0644
92
93 install -p -m 644 -D selinux/openvswitch-custom.pp \
94 $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp
95
96 # Get rid of stuff we don't want to make RPM happy.
97 rm \
98 $RPM_BUILD_ROOT/usr/bin/ovs-testcontroller \
99 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-testcontroller.8 \
100 $RPM_BUILD_ROOT/usr/bin/ovs-test \
101 $RPM_BUILD_ROOT/usr/bin/ovs-l3ping \
102 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8 \
103 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \
104 $RPM_BUILD_ROOT/usr/sbin/ovs-vlan-bug-workaround \
105 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-vlan-bug-workaround.8 \
106 $RPM_BUILD_ROOT/usr/bin/ovn-* \
107 $RPM_BUILD_ROOT/usr/share/man/man?/ovn-* \
108 $RPM_BUILD_ROOT/usr/share/openvswitch/ovn-* \
109 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/ovn*
110 (cd "$RPM_BUILD_ROOT" && rm -rf usr/%{_lib}/*.la)
111 (cd "$RPM_BUILD_ROOT" && rm -rf usr/include)
112
113 install -d -m 0755 $RPM_BUILD_ROOT%{_rundir}/openvswitch
114 install -d -m 0755 $RPM_BUILD_ROOT%{_localstatedir}/log/openvswitch
115 install -d -m 0755 $RPM_BUILD_ROOT/var/lib/openvswitch
116
117 copy_headers() {
118 src=$1
119 dst=$RPM_BUILD_ROOT/$2
120 install -d -m 0755 $dst
121 install -m 0644 $src/*.h $dst
122 }
123 copy_headers include %{_includedir}/openvswitch
124 copy_headers include/openflow %{_includedir}/openvswitch/openflow
125 copy_headers include/openvswitch %{_includedir}/openvswitch/openvswitch
126 copy_headers include/sparse %{_includedir}/openvswitch/sparse
127 copy_headers include/sparse/arpa %{_includedir}/openvswitch/sparse/arpa
128 copy_headers include/sparse/netinet %{_includedir}/openvswitch/sparse/netinet
129 copy_headers include/sparse/sys %{_includedir}/openvswitch/sparse/sys
130 copy_headers lib %{_includedir}/openvswitch/lib
131
132 install -D -m 0644 lib/.libs/libopenvswitch.a \
133 $RPM_BUILD_ROOT/%{_libdir}/libopenvswitch.a
134
135 %check
136 %if %{with check}
137 if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :;
138 else
139 cat tests/testsuite.log
140 exit 1
141 fi
142 %endif
143 %if %{with check_datapath_kernel}
144 if make check-kernel RECHECK=yes; then :;
145 else
146 cat tests/system-kmod-testsuite.log
147 exit 1
148 fi
149 %endif
150
151 %clean
152 rm -rf $RPM_BUILD_ROOT
153
154 %post
155 # Create default or update existing /etc/sysconfig/openvswitch.
156 SYSCONFIG=/etc/sysconfig/openvswitch
157 TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template
158 if [ ! -e $SYSCONFIG ]; then
159 cp $TEMPLATE $SYSCONFIG
160 else
161 for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE)
162 do
163 if ! grep $var $SYSCONFIG >/dev/null 2>&1; then
164 echo >> $SYSCONFIG
165 sed -n "/$var:/,/$var=/p" $TEMPLATE >> $SYSCONFIG
166 fi
167 done
168 fi
169
170 # Ensure all required services are set to run
171 /sbin/chkconfig --add openvswitch
172 /sbin/chkconfig openvswitch on
173
174 %post selinux-policy
175 /usr/sbin/semodule -i %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp &> /dev/null || :
176
177 %preun
178 if [ "$1" = "0" ]; then # $1 = 0 for uninstall
179 /sbin/service openvswitch stop
180 /sbin/chkconfig --del openvswitch
181 fi
182
183 %postun
184 if [ "$1" = "0" ]; then # $1 = 0 for uninstall
185 rm -f /etc/openvswitch/conf.db
186 rm -f /etc/sysconfig/openvswitch
187 rm -f /etc/openvswitch/vswitchd.cacert
188 fi
189
190 %postun selinux-policy
191 if [ $1 -eq 0 ] ; then
192 /usr/sbin/semodule -r openvswitch-custom &> /dev/null || :
193 fi
194
195 exit 0
196
197 %files
198 %defattr(-,root,root)
199 %dir /etc/openvswitch
200 /etc/bash_completion.d/ovs-appctl-bashcomp.bash
201 /etc/bash_completion.d/ovs-vsctl-bashcomp.bash
202 /etc/init.d/openvswitch
203 %config(noreplace) /etc/logrotate.d/openvswitch
204 /etc/sysconfig/network-scripts/ifup-ovs
205 /etc/sysconfig/network-scripts/ifdown-ovs
206 /usr/bin/ovs-appctl
207 /usr/bin/ovs-dpctl
208 /usr/bin/ovs-dpctl-top
209 /usr/bin/ovs-docker
210 /usr/bin/ovs-ofctl
211 /usr/bin/ovs-parse-backtrace
212 /usr/bin/ovs-pcap
213 /usr/bin/ovs-pki
214 /usr/bin/ovs-tcpdump
215 /usr/bin/ovs-tcpundump
216 /usr/bin/ovs-vlan-test
217 /usr/bin/ovs-vsctl
218 /usr/bin/ovsdb-client
219 /usr/bin/ovsdb-tool
220 /usr/bin/vtep-ctl
221 %{_libdir}/lib*.so.*
222 /usr/sbin/ovs-bugtool
223 /usr/sbin/ovs-vswitchd
224 /usr/sbin/ovsdb-server
225 /usr/share/man/man1/ovs-pcap.1.gz
226 /usr/share/man/man1/ovs-tcpundump.1.gz
227 /usr/share/man/man1/ovsdb-client.1.gz
228 /usr/share/man/man1/ovsdb-server.1.gz
229 /usr/share/man/man1/ovsdb-tool.1.gz
230 /usr/share/man/man5/ovs-vswitchd.conf.db.5.gz
231 %{_mandir}/man5/ovsdb.5*
232 /usr/share/man/man5/vtep.5.gz
233 /usr/share/man/man7/ovs-fields.7.gz
234 %{_mandir}/man7/ovsdb.7*
235 %{_mandir}/man7/ovsdb-server.7*
236 /usr/share/man/man8/ovs-appctl.8.gz
237 /usr/share/man/man8/ovs-bugtool.8.gz
238 /usr/share/man/man8/ovs-ctl.8.gz
239 /usr/share/man/man8/ovs-dpctl.8.gz
240 /usr/share/man/man8/ovs-dpctl-top.8.gz
241 /usr/share/man/man8/ovs-ofctl.8.gz
242 /usr/share/man/man8/ovs-parse-backtrace.8.gz
243 /usr/share/man/man8/ovs-pki.8.gz
244 /usr/share/man/man8/ovs-tcpdump.8.gz
245 /usr/share/man/man8/ovs-vlan-test.8.gz
246 /usr/share/man/man8/ovs-vsctl.8.gz
247 /usr/share/man/man8/ovs-vswitchd.8.gz
248 /usr/share/man/man8/vtep-ctl.8.gz
249 /usr/share/openvswitch/bugtool-plugins/
250 /usr/share/openvswitch/python/
251 /usr/share/openvswitch/scripts/ovs-bugtool-*
252 /usr/share/openvswitch/scripts/ovs-check-dead-ifs
253 /usr/share/openvswitch/scripts/ovs-ctl
254 /usr/share/openvswitch/scripts/ovs-lib
255 /usr/share/openvswitch/scripts/ovs-save
256 /usr/share/openvswitch/scripts/ovs-vtep
257 /usr/share/openvswitch/scripts/sysconfig.template
258 /usr/share/openvswitch/vswitch.ovsschema
259 /usr/share/openvswitch/vtep.ovsschema
260 %doc COPYING NOTICE README.rst NEWS rhel/README.RHEL.rst
261 /var/lib/openvswitch
262 /var/log/openvswitch
263
264 %files devel
265 %{_libdir}/lib*.so
266 %{_libdir}/lib*.a
267 %{_libdir}/pkgconfig
268 %{_includedir}/openvswitch/*
269
270 %files selinux-policy
271 %defattr(-,root,root)
272 %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp