]> git.proxmox.com Git - mirror_ovs.git/blame - rhel/openvswitch.spec.in
doc: Move WHY-OVS
[mirror_ovs.git] / rhel / openvswitch.spec.in
CommitLineData
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
24Name: openvswitch
25Summary: Open vSwitch daemon/database/utilities
26Group: System Environment/Daemons
27URL: http://www.openvswitch.org/
e0edde6f 28Vendor: Nicira, Inc.
c434706a
BP
29Version: @VERSION@
30
31License: ASL 2.0
32Release: 1
33Source: openvswitch-%{version}.tar.gz
34Buildroot: /tmp/openvswitch-rpm
73eb682e 35Requires: logrotate, python >= 2.7, python-six
4f3f6904 36BuildRequires: python-six
4465062f 37BuildRequires: openssl-devel
d8bfab53 38BuildRequires: checkpolicy, selinux-policy-devel
c434706a 39
329cf232 40%bcond_without check
8ef22bb1 41%bcond_with check_datapath_kernel
329cf232 42
c434706a
BP
43%description
44Open vSwitch provides standard network bridging functions and
45support for the OpenFlow protocol for remote per-flow control of
46traffic.
47
4886d4d2
EC
48%package devel
49Summary: Open vSwitch development package
50Group: Development/Libraries
51
52%description devel
53This package provides openvswitch headers and libopenvswitch for developers.
54
d8bfab53
JS
55%package selinux-policy
56Summary: Open vSwitch SELinux policy
57License: ASL 2.0
58BuildArch: noarch
59Requires: selinux-policy-targeted
60
61%description selinux-policy
62Tailored 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 70make %{_smp_mflags}
d8bfab53
JS
71cd selinux
72make -f %{_datadir}/selinux/devel/Makefile
c434706a
BP
73
74%install
75rm -rf $RPM_BUILD_ROOT
76make install DESTDIR=$RPM_BUILD_ROOT
53755990
CW
77
78rhel_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}
84rhel_cp etc_init.d_openvswitch 0755
85rhel_cp etc_logrotate.d_openvswitch 0644
86rhel_cp etc_sysconfig_network-scripts_ifup-ovs 0755
87rhel_cp etc_sysconfig_network-scripts_ifdown-ovs 0755
88rhel_cp usr_share_openvswitch_scripts_sysconfig.template 0644
89
d8bfab53
JS
90install -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.
94rm \
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
BP
109
110install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
111
4886d4d2
EC
112copy_headers() {
113 src=$1
114 dst=$RPM_BUILD_ROOT/$2
115 install -d -m 0755 $dst
116 install -m 0644 $src/*.h $dst
117}
118copy_headers include %{_includedir}/openvswitch
119copy_headers include/openflow %{_includedir}/openvswitch/openflow
120copy_headers include/openvswitch %{_includedir}/openvswitch/openvswitch
121copy_headers include/sparse %{_includedir}/openvswitch/sparse
122copy_headers include/sparse/arpa %{_includedir}/openvswitch/sparse/arpa
123copy_headers include/sparse/netinet %{_includedir}/openvswitch/sparse/netinet
124copy_headers include/sparse/sys %{_includedir}/openvswitch/sparse/sys
125copy_headers lib %{_includedir}/openvswitch/lib
126
127install -D -m 0644 lib/.libs/libopenvswitch.a \
128 $RPM_BUILD_ROOT/%{_libdir}/libopenvswitch.a
129
329cf232
GS
130%check
131%if %{with check}
0d3f2152 132 if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :;
329cf232
GS
133 else
134 cat tests/testsuite.log
135 exit 1
136 fi
137%endif
8ef22bb1
LR
138%if %{with check_datapath_kernel}
139 if make check-kernel RECHECK=yes; then :;
140 else
141 cat tests/system-kmod-testsuite.log
142 exit 1
143 fi
144%endif
329cf232 145
c434706a
BP
146%clean
147rm -rf $RPM_BUILD_ROOT
148
149%post
150# Create default or update existing /etc/sysconfig/openvswitch.
151SYSCONFIG=/etc/sysconfig/openvswitch
152TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template
153if [ ! -e $SYSCONFIG ]; then
154 cp $TEMPLATE $SYSCONFIG
155else
156 for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE)
157 do
158 if ! grep $var $SYSCONFIG >/dev/null 2>&1; then
159 echo >> $SYSCONFIG
160 sed -n "/$var:/,/$var=/p" $TEMPLATE >> $SYSCONFIG
161 fi
162 done
163fi
164
165# Ensure all required services are set to run
166/sbin/chkconfig --add openvswitch
167/sbin/chkconfig openvswitch on
168
d8bfab53
JS
169%post selinux-policy
170/usr/sbin/semodule -i %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp &> /dev/null || :
171
c434706a
BP
172%preun
173if [ "$1" = "0" ]; then # $1 = 0 for uninstall
174 /sbin/service openvswitch stop
175 /sbin/chkconfig --del openvswitch
176fi
177
178%postun
179if [ "$1" = "0" ]; then # $1 = 0 for uninstall
180 rm -f /etc/openvswitch/conf.db
181 rm -f /etc/sysconfig/openvswitch
182 rm -f /etc/openvswitch/vswitchd.cacert
183fi
184
d8bfab53
JS
185%postun selinux-policy
186if [ $1 -eq 0 ] ; then
187 /usr/sbin/semodule -r openvswitch-custom &> /dev/null || :
188fi
189
c434706a
BP
190exit 0
191
192%files
193%defattr(-,root,root)
f0dc83b7 194%dir /etc/openvswitch
2c9907cd
AW
195/etc/bash_completion.d/ovs-appctl-bashcomp.bash
196/etc/bash_completion.d/ovs-vsctl-bashcomp.bash
c434706a 197/etc/init.d/openvswitch
53755990 198%config(noreplace) /etc/logrotate.d/openvswitch
0fb42626
AF
199/etc/sysconfig/network-scripts/ifup-ovs
200/etc/sysconfig/network-scripts/ifdown-ovs
c434706a
BP
201/usr/bin/ovs-appctl
202/usr/bin/ovs-dpctl
14b4c575 203/usr/bin/ovs-dpctl-top
ec8f0f0c 204/usr/bin/ovs-docker
c434706a 205/usr/bin/ovs-ofctl
013061cf 206/usr/bin/ovs-parse-backtrace
c434706a 207/usr/bin/ovs-pcap
def046d5 208/usr/bin/ovs-pki
f75fe487 209/usr/bin/ovs-tcpdump
c434706a
BP
210/usr/bin/ovs-tcpundump
211/usr/bin/ovs-vlan-test
212/usr/bin/ovs-vsctl
213/usr/bin/ovsdb-client
214/usr/bin/ovsdb-tool
dd2d06c3 215/usr/bin/vtep-ctl
4886d4d2 216%{_libdir}/lib*.so.*
51a5f442 217/usr/sbin/ovs-bugtool
c434706a
BP
218/usr/sbin/ovs-vswitchd
219/usr/sbin/ovsdb-server
220/usr/share/man/man1/ovs-pcap.1.gz
221/usr/share/man/man1/ovs-tcpundump.1.gz
222/usr/share/man/man1/ovsdb-client.1.gz
223/usr/share/man/man1/ovsdb-server.1.gz
224/usr/share/man/man1/ovsdb-tool.1.gz
225/usr/share/man/man5/ovs-vswitchd.conf.db.5.gz
dd2d06c3 226/usr/share/man/man5/vtep.5.gz
c434706a 227/usr/share/man/man8/ovs-appctl.8.gz
2ad7bf32 228/usr/share/man/man8/ovs-bugtool.8.gz
c434706a
BP
229/usr/share/man/man8/ovs-ctl.8.gz
230/usr/share/man/man8/ovs-dpctl.8.gz
14b4c575 231/usr/share/man/man8/ovs-dpctl-top.8.gz
c434706a 232/usr/share/man/man8/ovs-ofctl.8.gz
013061cf 233/usr/share/man/man8/ovs-parse-backtrace.8.gz
def046d5 234/usr/share/man/man8/ovs-pki.8.gz
f75fe487 235/usr/share/man/man8/ovs-tcpdump.8.gz
c434706a
BP
236/usr/share/man/man8/ovs-vlan-test.8.gz
237/usr/share/man/man8/ovs-vsctl.8.gz
238/usr/share/man/man8/ovs-vswitchd.8.gz
dd2d06c3 239/usr/share/man/man8/vtep-ctl.8.gz
4b38c153 240/usr/share/openvswitch/bugtool-plugins/
c434706a 241/usr/share/openvswitch/python/
b2df0225 242/usr/share/openvswitch/scripts/ovs-bugtool-*
2dc7590d 243/usr/share/openvswitch/scripts/ovs-check-dead-ifs
c434706a 244/usr/share/openvswitch/scripts/ovs-ctl
d422c118 245/usr/share/openvswitch/scripts/ovs-lib
c434706a 246/usr/share/openvswitch/scripts/ovs-save
dd2d06c3 247/usr/share/openvswitch/scripts/ovs-vtep
c434706a
BP
248/usr/share/openvswitch/scripts/sysconfig.template
249/usr/share/openvswitch/vswitch.ovsschema
dd2d06c3 250/usr/share/openvswitch/vtep.ovsschema
3c8a3b31 251%doc COPYING NOTICE README.rst FAQ.rst NEWS
43f317ff 252%doc rhel/README.RHEL.rst
c434706a 253/var/lib/openvswitch
c649fe54 254/var/log/openvswitch
4886d4d2
EC
255
256%files devel
257%{_libdir}/lib*.so
258%{_libdir}/lib*.a
259%{_libdir}/pkgconfig
260%{_includedir}/openvswitch/*
d8bfab53
JS
261
262%files selinux-policy
263%defattr(-,root,root)
264%{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp