]> git.proxmox.com Git - ovs.git/blame - rhel/openvswitch.spec.in
Merge tag 'v2.15.0' into master-dfsg
[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 39BuildRequires: autoconf, automake, libtool
ab451489 40BuildRequires: python3-sphinx
771680d9 41BuildRequires: unbound-devel
bdd58e62 42BuildRequires: libunwind-devel
c434706a 43
329cf232 44%bcond_without check
8ef22bb1 45%bcond_with check_datapath_kernel
329cf232 46
c434706a
BP
47%description
48Open vSwitch provides standard network bridging functions and
49support for the OpenFlow protocol for remote per-flow control of
50traffic.
51
4886d4d2
EC
52%package devel
53Summary: Open vSwitch development package
54Group: Development/Libraries
55
56%description devel
57This package provides openvswitch headers and libopenvswitch for developers.
58
d8bfab53
JS
59%package selinux-policy
60Summary: Open vSwitch SELinux policy
61License: ASL 2.0
62BuildArch: noarch
63Requires: selinux-policy-targeted
64
65%description selinux-policy
66Tailored Open vSwitch SELinux policy
67
c434706a
BP
68%prep
69%setup -q
70
71%build
4886d4d2
EC
72./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} \
73 --libdir=%{_libdir} --enable-ssl --enable-shared
c434706a 74make %{_smp_mflags}
ee29e9fe 75make selinux-policy
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 \
36e5d97f 103 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8
4886d4d2 104(cd "$RPM_BUILD_ROOT" && rm -rf usr/%{_lib}/*.la)
2fd84d5e 105(cd "$RPM_BUILD_ROOT" && rm -rf usr/include)
c434706a 106
b9b56b27
JS
107install -d -m 0755 $RPM_BUILD_ROOT%{_rundir}/openvswitch
108install -d -m 0755 $RPM_BUILD_ROOT%{_localstatedir}/log/openvswitch
109install -d -m 0755 $RPM_BUILD_ROOT/var/lib/openvswitch
c434706a 110
4886d4d2
EC
111copy_headers() {
112 src=$1
113 dst=$RPM_BUILD_ROOT/$2
114 install -d -m 0755 $dst
115 install -m 0644 $src/*.h $dst
116}
117copy_headers include %{_includedir}/openvswitch
118copy_headers include/openflow %{_includedir}/openvswitch/openflow
119copy_headers include/openvswitch %{_includedir}/openvswitch/openvswitch
120copy_headers include/sparse %{_includedir}/openvswitch/sparse
121copy_headers include/sparse/arpa %{_includedir}/openvswitch/sparse/arpa
122copy_headers include/sparse/netinet %{_includedir}/openvswitch/sparse/netinet
123copy_headers include/sparse/sys %{_includedir}/openvswitch/sparse/sys
124copy_headers lib %{_includedir}/openvswitch/lib
125
126install -D -m 0644 lib/.libs/libopenvswitch.a \
127 $RPM_BUILD_ROOT/%{_libdir}/libopenvswitch.a
128
329cf232
GS
129%check
130%if %{with check}
0d3f2152 131 if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :;
329cf232
GS
132 else
133 cat tests/testsuite.log
134 exit 1
135 fi
136%endif
8ef22bb1
LR
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
329cf232 144
c434706a
BP
145%clean
146rm -rf $RPM_BUILD_ROOT
147
148%post
149# Create default or update existing /etc/sysconfig/openvswitch.
150SYSCONFIG=/etc/sysconfig/openvswitch
151TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template
152if [ ! -e $SYSCONFIG ]; then
153 cp $TEMPLATE $SYSCONFIG
154else
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
162fi
163
164# Ensure all required services are set to run
165/sbin/chkconfig --add openvswitch
166/sbin/chkconfig openvswitch on
167
21aade70
AC
168%pre selinux-policy
169%selinux_relabel_pre -s targeted
170
d8bfab53 171%post selinux-policy
21aade70 172%selinux_modules_install -s targeted %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp
d8bfab53 173
c434706a
BP
174%preun
175if [ "$1" = "0" ]; then # $1 = 0 for uninstall
176 /sbin/service openvswitch stop
177 /sbin/chkconfig --del openvswitch
178fi
179
180%postun
181if [ "$1" = "0" ]; then # $1 = 0 for uninstall
182 rm -f /etc/openvswitch/conf.db
183 rm -f /etc/sysconfig/openvswitch
184 rm -f /etc/openvswitch/vswitchd.cacert
185fi
186
d8bfab53
JS
187%postun selinux-policy
188if [ $1 -eq 0 ] ; then
21aade70 189 %selinux_modules_uninstall -s targeted openvswitch-custom
d8bfab53
JS
190fi
191
c434706a
BP
192exit 0
193
21aade70
AC
194%posttrans selinux-policy
195%selinux_relabel_post -s targeted
196
c434706a
BP
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
6bb9b060 230/usr/share/man/man5/ovsdb-server.5.gz
c434706a 231/usr/share/man/man5/ovs-vswitchd.conf.db.5.gz
76c0528f 232%{_mandir}/man5/ovsdb.5*
dd2d06c3 233/usr/share/man/man5/vtep.5.gz
96edaf5f 234/usr/share/man/man7/ovs-actions.7.gz
b81dc9a3 235/usr/share/man/man7/ovs-fields.7.gz
76c0528f
AA
236%{_mandir}/man7/ovsdb.7*
237%{_mandir}/man7/ovsdb-server.7*
c434706a 238/usr/share/man/man8/ovs-appctl.8.gz
2ad7bf32 239/usr/share/man/man8/ovs-bugtool.8.gz
c434706a
BP
240/usr/share/man/man8/ovs-ctl.8.gz
241/usr/share/man/man8/ovs-dpctl.8.gz
14b4c575 242/usr/share/man/man8/ovs-dpctl-top.8.gz
15117123 243/usr/share/man/man8/ovs-kmod-ctl.8.gz
c434706a 244/usr/share/man/man8/ovs-ofctl.8.gz
013061cf 245/usr/share/man/man8/ovs-parse-backtrace.8.gz
def046d5 246/usr/share/man/man8/ovs-pki.8.gz
f75fe487 247/usr/share/man/man8/ovs-tcpdump.8.gz
c434706a
BP
248/usr/share/man/man8/ovs-vlan-test.8.gz
249/usr/share/man/man8/ovs-vsctl.8.gz
250/usr/share/man/man8/ovs-vswitchd.8.gz
dd2d06c3 251/usr/share/man/man8/vtep-ctl.8.gz
4b38c153 252/usr/share/openvswitch/bugtool-plugins/
c434706a 253/usr/share/openvswitch/python/
b2df0225 254/usr/share/openvswitch/scripts/ovs-bugtool-*
2dc7590d 255/usr/share/openvswitch/scripts/ovs-check-dead-ifs
c434706a 256/usr/share/openvswitch/scripts/ovs-ctl
15117123 257/usr/share/openvswitch/scripts/ovs-kmod-ctl
d422c118 258/usr/share/openvswitch/scripts/ovs-lib
c434706a 259/usr/share/openvswitch/scripts/ovs-save
dd2d06c3 260/usr/share/openvswitch/scripts/ovs-vtep
c434706a 261/usr/share/openvswitch/scripts/sysconfig.template
8c93a1ad 262/usr/share/openvswitch/scripts/ovs-monitor-ipsec
c434706a 263/usr/share/openvswitch/vswitch.ovsschema
dd2d06c3 264/usr/share/openvswitch/vtep.ovsschema
888cf44d 265%doc NOTICE README.rst NEWS rhel/README.RHEL.rst
c434706a 266/var/lib/openvswitch
c649fe54 267/var/log/openvswitch
4886d4d2
EC
268
269%files devel
270%{_libdir}/lib*.so
271%{_libdir}/lib*.a
272%{_libdir}/pkgconfig
273%{_includedir}/openvswitch/*
d8bfab53
JS
274
275%files selinux-policy
276%defattr(-,root,root)
277%{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp