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