]> git.proxmox.com Git - mirror_ovs.git/blame - rhel/openvswitch.spec.in
Merge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEAD
[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
89ca9021 35Requires: logrotate, hostname, python >= 2.7, python-six
4f3f6904 36BuildRequires: python-six
4465062f 37BuildRequires: openssl-devel
d8bfab53 38BuildRequires: checkpolicy, selinux-policy-devel
2d2636a3
AA
39BuildRequires: autoconf, automake, libtool
40BuildRequires: python-sphinx
c434706a 41
329cf232 42%bcond_without check
8ef22bb1 43%bcond_with check_datapath_kernel
329cf232 44
c434706a
BP
45%description
46Open vSwitch provides standard network bridging functions and
47support for the OpenFlow protocol for remote per-flow control of
48traffic.
49
4886d4d2
EC
50%package devel
51Summary: Open vSwitch development package
52Group: Development/Libraries
53
54%description devel
55This package provides openvswitch headers and libopenvswitch for developers.
56
d8bfab53
JS
57%package selinux-policy
58Summary: Open vSwitch SELinux policy
59License: ASL 2.0
60BuildArch: noarch
61Requires: selinux-policy-targeted
62
63%description selinux-policy
64Tailored 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 72make %{_smp_mflags}
d4c7e5fc 73make selinux/openvswitch-custom.te
d8bfab53
JS
74cd selinux
75make -f %{_datadir}/selinux/devel/Makefile
c434706a
BP
76
77%install
78rm -rf $RPM_BUILD_ROOT
79make install DESTDIR=$RPM_BUILD_ROOT
53755990
CW
80
81rhel_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}
87rhel_cp etc_init.d_openvswitch 0755
88rhel_cp etc_logrotate.d_openvswitch 0644
89rhel_cp etc_sysconfig_network-scripts_ifup-ovs 0755
90rhel_cp etc_sysconfig_network-scripts_ifdown-ovs 0755
91rhel_cp usr_share_openvswitch_scripts_sysconfig.template 0644
92
d8bfab53
JS
93install -p -m 644 -D selinux/openvswitch-custom.pp \
94 $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp
95
c434706a
BP
96# Get rid of stuff we don't want to make RPM happy.
97rm \
0bc1b46a
BP
98 $RPM_BUILD_ROOT/usr/bin/ovs-testcontroller \
99 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-testcontroller.8 \
9d7c5643 100 $RPM_BUILD_ROOT/usr/bin/ovs-test \
2d8bdd8f 101 $RPM_BUILD_ROOT/usr/bin/ovs-l3ping \
9d7c5643 102 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8 \
2d8bdd8f 103 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \
c434706a 104 $RPM_BUILD_ROOT/usr/sbin/ovs-vlan-bug-workaround \
1247b5a7
PM
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-* \
db1f3866 109 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/ovn*
4886d4d2 110(cd "$RPM_BUILD_ROOT" && rm -rf usr/%{_lib}/*.la)
2fd84d5e 111(cd "$RPM_BUILD_ROOT" && rm -rf usr/include)
c434706a 112
b9b56b27
JS
113install -d -m 0755 $RPM_BUILD_ROOT%{_rundir}/openvswitch
114install -d -m 0755 $RPM_BUILD_ROOT%{_localstatedir}/log/openvswitch
115install -d -m 0755 $RPM_BUILD_ROOT/var/lib/openvswitch
c434706a 116
4886d4d2
EC
117copy_headers() {
118 src=$1
119 dst=$RPM_BUILD_ROOT/$2
120 install -d -m 0755 $dst
121 install -m 0644 $src/*.h $dst
122}
123copy_headers include %{_includedir}/openvswitch
124copy_headers include/openflow %{_includedir}/openvswitch/openflow
125copy_headers include/openvswitch %{_includedir}/openvswitch/openvswitch
126copy_headers include/sparse %{_includedir}/openvswitch/sparse
127copy_headers include/sparse/arpa %{_includedir}/openvswitch/sparse/arpa
128copy_headers include/sparse/netinet %{_includedir}/openvswitch/sparse/netinet
129copy_headers include/sparse/sys %{_includedir}/openvswitch/sparse/sys
130copy_headers lib %{_includedir}/openvswitch/lib
131
132install -D -m 0644 lib/.libs/libopenvswitch.a \
133 $RPM_BUILD_ROOT/%{_libdir}/libopenvswitch.a
134
329cf232
GS
135%check
136%if %{with check}
0d3f2152 137 if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :;
329cf232
GS
138 else
139 cat tests/testsuite.log
140 exit 1
141 fi
142%endif
8ef22bb1
LR
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
329cf232 150
c434706a
BP
151%clean
152rm -rf $RPM_BUILD_ROOT
153
154%post
155# Create default or update existing /etc/sysconfig/openvswitch.
156SYSCONFIG=/etc/sysconfig/openvswitch
157TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template
158if [ ! -e $SYSCONFIG ]; then
159 cp $TEMPLATE $SYSCONFIG
160else
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
168fi
169
170# Ensure all required services are set to run
171/sbin/chkconfig --add openvswitch
172/sbin/chkconfig openvswitch on
173
d8bfab53
JS
174%post selinux-policy
175/usr/sbin/semodule -i %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp &> /dev/null || :
176
c434706a
BP
177%preun
178if [ "$1" = "0" ]; then # $1 = 0 for uninstall
179 /sbin/service openvswitch stop
180 /sbin/chkconfig --del openvswitch
181fi
182
183%postun
184if [ "$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
188fi
189
d8bfab53
JS
190%postun selinux-policy
191if [ $1 -eq 0 ] ; then
192 /usr/sbin/semodule -r openvswitch-custom &> /dev/null || :
193fi
194
c434706a
BP
195exit 0
196
197%files
198%defattr(-,root,root)
f0dc83b7 199%dir /etc/openvswitch
2c9907cd
AW
200/etc/bash_completion.d/ovs-appctl-bashcomp.bash
201/etc/bash_completion.d/ovs-vsctl-bashcomp.bash
c434706a 202/etc/init.d/openvswitch
53755990 203%config(noreplace) /etc/logrotate.d/openvswitch
0fb42626
AF
204/etc/sysconfig/network-scripts/ifup-ovs
205/etc/sysconfig/network-scripts/ifdown-ovs
c434706a
BP
206/usr/bin/ovs-appctl
207/usr/bin/ovs-dpctl
14b4c575 208/usr/bin/ovs-dpctl-top
ec8f0f0c 209/usr/bin/ovs-docker
c434706a 210/usr/bin/ovs-ofctl
013061cf 211/usr/bin/ovs-parse-backtrace
c434706a 212/usr/bin/ovs-pcap
def046d5 213/usr/bin/ovs-pki
f75fe487 214/usr/bin/ovs-tcpdump
c434706a
BP
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
dd2d06c3 220/usr/bin/vtep-ctl
4886d4d2 221%{_libdir}/lib*.so.*
51a5f442 222/usr/sbin/ovs-bugtool
c434706a
BP
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
76c0528f 231%{_mandir}/man5/ovsdb.5*
dd2d06c3 232/usr/share/man/man5/vtep.5.gz
b81dc9a3 233/usr/share/man/man7/ovs-fields.7.gz
76c0528f
AA
234%{_mandir}/man7/ovsdb.7*
235%{_mandir}/man7/ovsdb-server.7*
c434706a 236/usr/share/man/man8/ovs-appctl.8.gz
2ad7bf32 237/usr/share/man/man8/ovs-bugtool.8.gz
c434706a
BP
238/usr/share/man/man8/ovs-ctl.8.gz
239/usr/share/man/man8/ovs-dpctl.8.gz
14b4c575 240/usr/share/man/man8/ovs-dpctl-top.8.gz
c434706a 241/usr/share/man/man8/ovs-ofctl.8.gz
013061cf 242/usr/share/man/man8/ovs-parse-backtrace.8.gz
def046d5 243/usr/share/man/man8/ovs-pki.8.gz
f75fe487 244/usr/share/man/man8/ovs-tcpdump.8.gz
c434706a
BP
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
dd2d06c3 248/usr/share/man/man8/vtep-ctl.8.gz
4b38c153 249/usr/share/openvswitch/bugtool-plugins/
c434706a 250/usr/share/openvswitch/python/
b2df0225 251/usr/share/openvswitch/scripts/ovs-bugtool-*
2dc7590d 252/usr/share/openvswitch/scripts/ovs-check-dead-ifs
c434706a 253/usr/share/openvswitch/scripts/ovs-ctl
d422c118 254/usr/share/openvswitch/scripts/ovs-lib
c434706a 255/usr/share/openvswitch/scripts/ovs-save
dd2d06c3 256/usr/share/openvswitch/scripts/ovs-vtep
c434706a
BP
257/usr/share/openvswitch/scripts/sysconfig.template
258/usr/share/openvswitch/vswitch.ovsschema
dd2d06c3 259/usr/share/openvswitch/vtep.ovsschema
11e02906 260%doc COPYING NOTICE README.rst NEWS rhel/README.RHEL.rst
c434706a 261/var/lib/openvswitch
c649fe54 262/var/log/openvswitch
4886d4d2
EC
263
264%files devel
265%{_libdir}/lib*.so
266%{_libdir}/lib*.a
267%{_libdir}/pkgconfig
268%{_includedir}/openvswitch/*
d8bfab53
JS
269
270%files selinux-policy
271%defattr(-,root,root)
272%{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp