3abd27
# Copyright (C) 2009, 2010, 2013, 2014 Nicira Networks, Inc.
3abd27
#
3abd27
# Copying and distribution of this file, with or without modification,
3abd27
# are permitted in any medium without royalty provided the copyright
3abd27
# notice and this notice are preserved.  This file is offered as-is,
3abd27
# without warranty of any kind.
3abd27
#
3abd27
# If tests have to be skipped while building, specify the '--without check'
3abd27
# option. For example:
3abd27
# rpmbuild -bb --without check rhel/openvswitch-fedora.spec
3abd27
3abd27
# This defines the base package name's version.
3abd27
3abd27
%define pkgname openvswitch3.1
3abd27
3abd27
3abd27
%if 0%{?commit:1}
3abd27
%global shortcommit %(c=%{commit}; echo ${c:0:7})
3abd27
%endif
3abd27
3abd27
# Enable PIE, bz#955181
3abd27
%global _hardened_build 1
3abd27
3abd27
# RHEL-7 doesn't define _rundir macro yet
3abd27
# Fedora 15 onwards uses /run as _rundir
3abd27
%if 0%{!?_rundir:1}
3abd27
%define _rundir /run
3abd27
%endif
3abd27
3abd27
# FIXME remove when fast-datapath-rhel-8 buildroot is updated to new RHEL 8 zstream
3abd27
# RHEL-8.0 doesn't define _smp_build_ncpus, but it uses the old _smp_mflags
3abd27
%if 0%{!?_smp_build_ncpus:1}
3abd27
%define _smp_build_ncpus %(c=%_smp_mflags; echo ${c:2})
3abd27
%endif
3abd27
3abd27
# FIXME Test "STP - flush the fdb and mdb when topology changed" fails on s390x
3abd27
# FIXME 2 tests fails on ppc64le. They will be hopefully fixed before official 2.11
3abd27
%ifarch %{ix86} x86_64 aarch64
3abd27
%bcond_without check
3abd27
%else
3abd27
%bcond_with check
3abd27
%endif
3abd27
# option to run kernel datapath tests, requires building as root!
3abd27
%bcond_with check_datapath_kernel
3abd27
# option to build with libcap-ng, needed for running OVS as regular user
3abd27
%bcond_without libcapng
3abd27
# option to build with ipsec support
3abd27
%bcond_without ipsec
3abd27
3abd27
# Build python2 (that provides python) and python3 subpackages on Fedora
3abd27
# Build only python3 (that provides python) subpackage on RHEL8
3abd27
# Build only python subpackage on RHEL7
3abd27
%if 0%{?rhel} > 7 || 0%{?fedora}
3abd27
# On RHEL8 Sphinx is included in buildroot
3abd27
%global external_sphinx 1
3abd27
%else
3abd27
# Don't use external sphinx (RHV doesn't have optional repositories enabled)
3abd27
%global external_sphinx 0
3abd27
%endif
3abd27
3abd27
Name: %{pkgname}
3abd27
Summary: Open vSwitch
3abd27
Group: System Environment/Daemons daemon/database/utilities
3abd27
URL: http://www.openvswitch.org/
3abd27
Version: 3.1.0
3abd27
Release: 2%{?dist}
3abd27
3abd27
# Nearly all of openvswitch is ASL 2.0.  The bugtool is LGPLv2+, and the
3abd27
# lib/sflow*.[ch] files are SISSL
3abd27
# datapath/ is GPLv2 (although not built into any of the binary packages)
3abd27
License: ASL 2.0 and LGPLv2+ and SISSL
3abd27
3abd27
%define dpdkver 22.11.1
3abd27
%define dpdkdir dpdk
3abd27
%define dpdksver %(echo %{dpdkver} | cut -d. -f-2)
3abd27
# NOTE: DPDK does not currently build for s390x
3abd27
# DPDK on aarch64 is not stable enough to be enabled in FDP
3abd27
%if 0%{?rhel} > 7 || 0%{?fedora}
3abd27
%define dpdkarches x86_64 ppc64le
3abd27
%else
3abd27
%define dpdkarches
3abd27
%endif
3abd27
3abd27
%if 0%{?commit:1}
3abd27
Source: https://github.com/openvswitch/ovs/archive/%{commit}.tar.gz#/openvswitch-%{commit}.tar.gz
3abd27
%else
3abd27
Source: https://github.com/openvswitch/ovs/archive/v%{version}.tar.gz#/openvswitch-%{version}.tar.gz
3abd27
%endif
3abd27
Source10: https://fast.dpdk.org/rel/dpdk-%{dpdkver}.tar.xz
3abd27
3abd27
%define docutilsver 0.12
3abd27
%define pygmentsver 1.4
3abd27
%define sphinxver   1.2.3
3abd27
%define pyelftoolsver 0.27
3abd27
Source100: https://pypi.io/packages/source/d/docutils/docutils-%{docutilsver}.tar.gz
3abd27
Source101: https://pypi.io/packages/source/P/Pygments/Pygments-%{pygmentsver}.tar.gz
3abd27
Source102: https://pypi.io/packages/source/S/Sphinx/Sphinx-%{sphinxver}.tar.gz
3abd27
Source103: https://pypi.io/packages/source/p/pyelftools/pyelftools-%{pyelftoolsver}.tar.gz
3abd27
3abd27
Patch0:    openvswitch-%{version}.patch
3abd27
3abd27
# The DPDK is designed to optimize througput of network traffic using, among
3abd27
# other techniques, carefully crafted assembly instructions.  As such it
3abd27
# needs extensive work to port it to other architectures.
3abd27
ExclusiveArch: x86_64 aarch64 ppc64le s390x
3abd27
3abd27
# Do not enable this otherwise YUM will break on any upgrade.
3abd27
# Provides: openvswitch
3abd27
Conflicts: openvswitch < 3.1
3abd27
Conflicts: openvswitch-dpdk < 3.1
3abd27
Conflicts: openvswitch2.10
3abd27
Conflicts: openvswitch2.11
3abd27
Conflicts: openvswitch2.12
3abd27
Conflicts: openvswitch2.13
3abd27
Conflicts: openvswitch2.14
3abd27
Conflicts: openvswitch2.15
3abd27
Conflicts: openvswitch2.16
3abd27
Conflicts: openvswitch2.17
3abd27
Conflicts: openvswitch3.0
3abd27
3abd27
# FIXME Sphinx is used to generate some manpages, unfortunately, on RHEL, it's
3abd27
# in the -optional repository and so we can't require it directly since RHV
3abd27
# doesn't have the -optional repository enabled and so TPS fails
3abd27
%if %{external_sphinx}
3abd27
BuildRequires: python3-sphinx
3abd27
%else
3abd27
# Sphinx dependencies
3abd27
BuildRequires: python-devel
3abd27
BuildRequires: python-setuptools
3abd27
#BuildRequires: python2-docutils
3abd27
BuildRequires: python-jinja2
3abd27
BuildRequires: python-nose
3abd27
#BuildRequires: python2-pygments
3abd27
# docutils dependencies
3abd27
BuildRequires: python-imaging
3abd27
# pygments dependencies
3abd27
BuildRequires: python-nose
3abd27
%endif
3abd27
3abd27
BuildRequires: gcc gcc-c++ make
3abd27
BuildRequires: autoconf automake libtool
3abd27
BuildRequires: systemd-units openssl openssl-devel
3abd27
BuildRequires: python3-devel python3-setuptools
3abd27
BuildRequires: desktop-file-utils
3abd27
BuildRequires: groff-base graphviz
3abd27
BuildRequires: unbound-devel
3abd27
BuildRequires: systemtap-sdt-devel
3abd27
# make check dependencies
3abd27
BuildRequires: procps-ng
3abd27
%if %{with check_datapath_kernel}
3abd27
BuildRequires: nmap-ncat
3abd27
# would be useful but not available in RHEL or EPEL
3abd27
#BuildRequires: pyftpdlib
3abd27
%endif
3abd27
3abd27
%if %{with libcapng}
3abd27
BuildRequires: libcap-ng libcap-ng-devel
3abd27
%endif
3abd27
3abd27
%ifarch %{dpdkarches}
3abd27
BuildRequires: meson
3abd27
%if 0%{?rhel} > 8 || 0%{?fedora}
3abd27
BuildRequires: python3-pyelftools
3abd27
%endif
3abd27
# DPDK driver dependencies
3abd27
BuildRequires: zlib-devel numactl-devel libarchive-devel
3abd27
%ifarch x86_64
3abd27
BuildRequires: rdma-core-devel >= 15 libmnl-devel
3abd27
%endif
3abd27
3abd27
# Required by packaging policy for the bundled DPDK
3abd27
Provides: bundled(dpdk) = %{dpdkver}
3abd27
%endif
3abd27
3abd27
Requires: openssl iproute module-init-tools
3abd27
#Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
3abd27
#Requires: kernel >= 3.15.0-0
3abd27
Requires: openvswitch-selinux-extra-policy
3abd27
3abd27
Requires(pre): shadow-utils
3abd27
Requires(post): /bin/sed
3abd27
Requires(post): /usr/sbin/usermod
3abd27
Requires(post): /usr/sbin/groupadd
3abd27
Requires(post): systemd-units
3abd27
Requires(preun): systemd-units
3abd27
Requires(postun): systemd-units
3abd27
Obsoletes: openvswitch-controller <= 0:2.1.0-1
3abd27
3abd27
%if 0%{?rhel}
3abd27
# sortedcontainers are not packaged on RHEL yet, but ovs includes it
3abd27
%global __requires_exclude ^python%{python3_version}dist\\(sortedcontainers\\)$
3abd27
%endif
3abd27
3abd27
%description
3abd27
Open vSwitch provides standard network bridging functions and
3abd27
support for the OpenFlow protocol for remote per-flow control of
3abd27
traffic.
3abd27
3abd27
%package -n python3-%{pkgname}
3abd27
Summary: Open vSwitch python3 bindings
3abd27
License: ASL 2.0
3abd27
Requires: %{pkgname} = %{?epoch:%{epoch}:}%{version}-%{release}
3abd27
Provides: python-%{pkgname} = %{?epoch:%{epoch}:}%{version}-%{release}
3abd27
3abd27
%description -n python3-%{pkgname}
3abd27
Python bindings for the Open vSwitch database
3abd27
3abd27
%package test
3abd27
Summary: Open vSwitch testing utilities
3abd27
License: ASL 2.0
3abd27
BuildArch: noarch
3abd27
Requires: python3-%{pkgname} = %{?epoch:%{epoch}:}%{version}-%{release}
3abd27
Requires: tcpdump
3abd27
3abd27
%description test
3abd27
Utilities that are useful to diagnose performance and connectivity
3abd27
issues in Open vSwitch setup.
3abd27
3abd27
%package devel
3abd27
Summary: Open vSwitch OpenFlow development package (library, headers)
3abd27
License: ASL 2.0
3abd27
Requires: %{pkgname} = %{?epoch:%{epoch}:}%{version}-%{release}
3abd27
3abd27
%description devel
3abd27
This provides shared library, libopenswitch.so and the openvswitch header
3abd27
files needed to build an external application.
3abd27
3abd27
%if 0%{?rhel} == 8 || 0%{?fedora} > 28
3abd27
%package -n network-scripts-%{name}
3abd27
Summary: Open vSwitch legacy network service support
3abd27
License: ASL 2.0
3abd27
Requires: network-scripts
3abd27
Supplements: (%{name} and network-scripts)
3abd27
3abd27
%description -n network-scripts-%{name}
3abd27
This provides the ifup and ifdown scripts for use with the legacy network
3abd27
service.
3abd27
%endif
3abd27
3abd27
%if %{with ipsec}
3abd27
%package ipsec
3abd27
Summary: Open vSwitch IPsec tunneling support
3abd27
License: ASL 2.0
3abd27
Requires: python3-%{pkgname} = %{?epoch:%{epoch}:}%{version}-%{release}
3abd27
Requires: libreswan
3abd27
3abd27
%description ipsec
3abd27
This package provides IPsec tunneling support for OVS tunnels.
3abd27
%endif
3abd27
3abd27
%prep
3abd27
%if 0%{?commit:1}
3abd27
%setup -q -n ovs-%{commit} -a 10
3abd27
%else
3abd27
%setup -q -n ovs-%{version} -a 10
3abd27
%endif
3abd27
%if ! %{external_sphinx}
3abd27
%if 0%{?commit:1}
3abd27
%setup -n ovs-%{commit} -q -D -T -a 100 -a 101 -a 102
3abd27
%else
3abd27
%setup -n ovs-%{version} -q -D -T -a 100 -a 101 -a 102
3abd27
%endif
3abd27
%endif
3abd27
%if 0%{?rhel} && 0%{?rhel} < 9
3abd27
%if 0%{?commit:1}
3abd27
%setup -n ovs-%{commit} -q -D -T -a 103
3abd27
%else
3abd27
%setup -n ovs-%{version} -q -D -T -a 103
3abd27
%endif
3abd27
%endif
3abd27
3abd27
mv dpdk-*/ %{dpdkdir}/
3abd27
3abd27
%patch0 -p1
3abd27
3abd27
%build
3abd27
%if 0%{?rhel} && 0%{?rhel} < 9
3abd27
export PYTHONPATH="${PWD}/pyelftools-%{pyelftoolsver}"
3abd27
%endif
3abd27
# Build Sphinx on RHEL
3abd27
%if ! %{external_sphinx}
3abd27
export PYTHONPATH="${PYTHONPATH:+$PYTHONPATH:}%{_builddir}/pytmp/lib/python"
3abd27
for x in docutils-%{docutilsver} Pygments-%{pygmentsver} Sphinx-%{sphinxver}; do
3abd27
    pushd "$x"
3abd27
    python2 setup.py install --home %{_builddir}/pytmp
3abd27
    popd
3abd27
done
3abd27
3abd27
export PATH="$PATH:%{_builddir}/pytmp/bin"
3abd27
%endif
3abd27
3abd27
./boot.sh
3abd27
3abd27
%ifarch %{dpdkarches}    # build dpdk
3abd27
# Lets build DPDK first
3abd27
cd %{dpdkdir}
3abd27
3abd27
ENABLED_DRIVERS=(
3abd27
    bus/pci
3abd27
    bus/vdev
3abd27
    mempool/ring
3abd27
    net/failsafe
3abd27
    net/i40e
3abd27
    net/ring
3abd27
    net/vhost
3abd27
    net/virtio
3abd27
    net/tap
3abd27
)
3abd27
3abd27
%ifarch x86_64
3abd27
ENABLED_DRIVERS+=(
3abd27
    bus/auxiliary
3abd27
    bus/vmbus
3abd27
    common/iavf
3abd27
    common/mlx5
3abd27
    net/bnxt
3abd27
    net/enic
3abd27
    net/iavf
3abd27
    net/ice
3abd27
    net/mlx5
3abd27
    net/netvsc
3abd27
    net/nfp
3abd27
    net/qede
3abd27
    net/vdev_netvsc
3abd27
)
3abd27
%endif
3abd27
3abd27
%ifarch aarch64 x86_64
3abd27
ENABLED_DRIVERS+=(
3abd27
    net/e1000
3abd27
    net/ixgbe
3abd27
)
3abd27
%endif
3abd27
3abd27
for driver in "${ENABLED_DRIVERS[@]}"; do
3abd27
    enable_drivers="${enable_drivers:+$enable_drivers,}"$driver
3abd27
done
3abd27
3abd27
# As of 21.11-rc3, following libraries can be disabled:
3abd27
# optional_libs = [
3abd27
#         'bitratestats',
3abd27
#         'gpudev',
3abd27
#         'gro',
3abd27
#         'gso',
3abd27
#         'kni',
3abd27
#         'jobstats',
3abd27
#         'latencystats',
3abd27
#         'metrics',
3abd27
#         'pdump',
3abd27
#         'power',
3abd27
#         'vhost',
3abd27
# ]
3abd27
# If doing any updates, this must be aligned with:
3abd27
# https://access.redhat.com/articles/3538141
3abd27
DISABLED_LIBS=(
3abd27
    gpudev
3abd27
    kni
3abd27
    jobstats
3abd27
    power
3abd27
)
3abd27
3abd27
for lib in "${DISABLED_LIBS[@]}"; do
3abd27
    disable_libs="${disable_libs:+$disable_libs,}"$lib
3abd27
done
3abd27
3abd27
%set_build_flags
3abd27
%__meson --prefix=%{_builddir}/dpdk-build \
3abd27
         --buildtype=plain \
3abd27
         -Ddisable_libs="$disable_libs" \
3abd27
         -Ddisable_apps="*" \
3abd27
         -Denable_drivers="$enable_drivers" \
3abd27
         -Dplatform=generic \
3abd27
         -Dmax_ethports=1024 \
3abd27
         -Dmax_numa_nodes=8 \
3abd27
         -Dtests=false \
3abd27
         %{_vpath_builddir}
3abd27
%meson_build
3abd27
%__meson install -C %{_vpath_builddir} --no-rebuild
3abd27
3abd27
# FIXME currently with LTO enabled OVS tries to link with both static and shared libraries
3abd27
rm -v %{_builddir}/dpdk-build/%{_lib}/*.so*
3abd27
3abd27
# Generate a list of supported drivers, its hard to tell otherwise.
3abd27
cat << EOF > README.DPDK-PMDS
3abd27
DPDK drivers included in this package:
3abd27
3abd27
EOF
3abd27
3abd27
for f in %{_builddir}/dpdk-build/%{_lib}/librte_net_*.a; do
3abd27
    basename ${f} | cut -c12- | cut -d. -f1 | tr [:lower:] [:upper:]
3abd27
done >> README.DPDK-PMDS
3abd27
3abd27
cat << EOF >> README.DPDK-PMDS
3abd27
3abd27
For further information about the drivers, see
3abd27
http://dpdk.org/doc/guides-%{dpdksver}/nics/index.html
3abd27
EOF
3abd27
3abd27
cd -
3abd27
%endif    # build dpdk
3abd27
3abd27
# And now for OVS...
3abd27
mkdir build-shared build-static
3abd27
pushd build-shared
3abd27
ln -s ../configure
3abd27
%configure \
3abd27
%if %{with libcapng}
3abd27
        --enable-libcapng \
3abd27
%else
3abd27
        --disable-libcapng \
3abd27
%endif
3abd27
        --disable-static \
3abd27
        --enable-shared \
3abd27
        --enable-ssl \
3abd27
        --with-pkidir=%{_sharedstatedir}/openvswitch/pki \
3abd27
        --enable-usdt-probes \
3abd27
        --disable-afxdp
3abd27
make %{?_smp_mflags}
3abd27
popd
3abd27
pushd build-static
3abd27
ln -s ../configure
3abd27
%ifarch %{dpdkarches}
3abd27
PKG_CONFIG_PATH=%{_builddir}/dpdk-build/%{_lib}/pkgconfig \
3abd27
%endif
3abd27
%configure \
3abd27
%if %{with libcapng}
3abd27
        --enable-libcapng \
3abd27
%else
3abd27
        --disable-libcapng \
3abd27
%endif
3abd27
        --enable-ssl \
3abd27
%ifarch %{dpdkarches}
3abd27
        --with-dpdk=static \
3abd27
%endif
3abd27
        --with-pkidir=%{_sharedstatedir}/openvswitch/pki \
3abd27
        --enable-usdt-probes \
3abd27
        --disable-afxdp
3abd27
make %{?_smp_mflags}
3abd27
popd
3abd27
3abd27
/usr/bin/python3 build-aux/dpdkstrip.py \
3abd27
        --dpdk \
3abd27
        < rhel/usr_lib_systemd_system_ovs-vswitchd.service.in \
3abd27
        > rhel/usr_lib_systemd_system_ovs-vswitchd.service
3abd27
3abd27
%install
3abd27
rm -rf $RPM_BUILD_ROOT
3abd27
make -C build-shared install sbin_PROGRAMS=ovsdb/ovsdb-server DESTDIR=$RPM_BUILD_ROOT
3abd27
make -C build-static install bin_PROGRAMS= sbin_PROGRAMS=vswitchd/ovs-vswitchd DESTDIR=$RPM_BUILD_ROOT
3abd27
3abd27
install -d -m 0755 $RPM_BUILD_ROOT%{_rundir}/openvswitch
3abd27
install -d -m 0750 $RPM_BUILD_ROOT%{_localstatedir}/log/openvswitch
3abd27
install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch
3abd27
3abd27
install -p -D -m 0644 rhel/usr_lib_udev_rules.d_91-vfio.rules \
3abd27
        $RPM_BUILD_ROOT%{_udevrulesdir}/91-vfio.rules
3abd27
3abd27
install -p -D -m 0644 \
3abd27
        rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
3abd27
        $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/openvswitch
3abd27
3abd27
for service in openvswitch ovsdb-server ovs-vswitchd \
3abd27
               ovs-delete-transient-ports; do
3abd27
        install -p -D -m 0644 \
3abd27
                        rhel/usr_lib_systemd_system_${service}.service \
3abd27
                        $RPM_BUILD_ROOT%{_unitdir}/${service}.service
3abd27
done
3abd27
3abd27
%if %{with ipsec}
3abd27
install -p -D -m 0644 rhel/usr_lib_systemd_system_openvswitch-ipsec.service \
3abd27
                      $RPM_BUILD_ROOT%{_unitdir}/openvswitch-ipsec.service
3abd27
%endif
3abd27
3abd27
install -m 0755 rhel/etc_init.d_openvswitch \
3abd27
        $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/openvswitch.init
3abd27
3abd27
install -p -D -m 0644 rhel/etc_openvswitch_default.conf \
3abd27
        $RPM_BUILD_ROOT/%{_sysconfdir}/openvswitch/default.conf
3abd27
3abd27
install -p -D -m 0644 rhel/etc_logrotate.d_openvswitch \
3abd27
        $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/openvswitch
3abd27
3abd27
install -m 0644 vswitchd/vswitch.ovsschema \
3abd27
        $RPM_BUILD_ROOT/%{_datadir}/openvswitch/vswitch.ovsschema
3abd27
3abd27
%if 0%{?rhel} < 9
3abd27
install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/
3abd27
install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifdown-ovs \
3abd27
        $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
3abd27
install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \
3abd27
        $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
3abd27
%endif
3abd27
3abd27
install -d -m 0755 $RPM_BUILD_ROOT%{python3_sitelib}
3abd27
cp -a $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/ovstest \
3abd27
        $RPM_BUILD_ROOT%{python3_sitelib}
3abd27
3abd27
# Build the JSON C extension for the Python lib (#1417738)
3abd27
pushd python
3abd27
(
3abd27
export CPPFLAGS="-I ../include -I ../build-shared/include"
3abd27
export LDFLAGS="%{__global_ldflags} -L $RPM_BUILD_ROOT%{_libdir}"
3abd27
%py3_build
3abd27
%py3_install
3abd27
[ -f "$RPM_BUILD_ROOT/%{python3_sitearch}/ovs/_json$(python3-config --extension-suffix)" ]
3abd27
)
3abd27
popd
3abd27
3abd27
rm -rf $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
3abd27
3abd27
install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
3abd27
3abd27
install -d -m 0755 $RPM_BUILD_ROOT%{_prefix}/lib/firewalld/services/
3abd27
3abd27
install -p -D -m 0755 \
3abd27
        rhel/usr_share_openvswitch_scripts_ovs-systemd-reload \
3abd27
        $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/ovs-systemd-reload
3abd27
3abd27
touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
3abd27
# The db needs special permission as IPsec Pre-shared keys are stored in it.
3abd27
chmod 0640 $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
3abd27
3abd27
touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf
3abd27
3abd27
# remove unpackaged files
3abd27
rm -f $RPM_BUILD_ROOT/%{_bindir}/ovs-benchmark \
3abd27
        $RPM_BUILD_ROOT/%{_bindir}/ovs-docker \
3abd27
        $RPM_BUILD_ROOT/%{_bindir}/ovs-parse-backtrace \
3abd27
        $RPM_BUILD_ROOT/%{_bindir}/ovs-testcontroller \
3abd27
        $RPM_BUILD_ROOT/%{_sbindir}/ovs-vlan-bug-workaround \
3abd27
        $RPM_BUILD_ROOT/%{_mandir}/man1/ovs-benchmark.1* \
3abd27
        $RPM_BUILD_ROOT/%{_mandir}/man8/ovs-testcontroller.* \
3abd27
        $RPM_BUILD_ROOT/%{_mandir}/man8/ovs-vlan-bug-workaround.8*
3abd27
3abd27
%if ! %{with ipsec}
3abd27
rm -f $RPM_BUILD_ROOT/%{_datadir}/openvswitch/scripts/ovs-monitor-ipsec
3abd27
%endif
3abd27
3abd27
# remove ovn unpackages files
3abd27
rm -f $RPM_BUILD_ROOT%{_bindir}/ovn*
3abd27
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/ovn*
3abd27
rm -f $RPM_BUILD_ROOT%{_mandir}/man5/ovn*
3abd27
rm -f $RPM_BUILD_ROOT%{_mandir}/man7/ovn*
3abd27
rm -f $RPM_BUILD_ROOT%{_mandir}/man8/ovn*
3abd27
rm -f $RPM_BUILD_ROOT%{_datadir}/openvswitch/ovn*
3abd27
rm -f $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/ovn*
3abd27
rm -f $RPM_BUILD_ROOT%{_includedir}/ovn/*
3abd27
3abd27
%check
3abd27
%if %{with check}
3abd27
    pushd build-static
3abd27
    touch resolv.conf
3abd27
    export OVS_RESOLV_CONF=$(pwd)/resolv.conf
3abd27
    if make check TESTSUITEFLAGS='%{_smp_mflags}' ||
3abd27
       make check TESTSUITEFLAGS='--recheck'; then :;
3abd27
    else
3abd27
        cat tests/testsuite.log
3abd27
        exit 1
3abd27
    fi
3abd27
    popd
3abd27
%endif
3abd27
%if %{with check_datapath_kernel}
3abd27
    pushd build-static
3abd27
    if make check-kernel RECHECK=yes; then :;
3abd27
    else
3abd27
        cat tests/system-kmod-testsuite.log
3abd27
        exit 1
3abd27
    fi
3abd27
    popd
3abd27
%endif
3abd27
3abd27
%clean
3abd27
rm -rf $RPM_BUILD_ROOT
3abd27
3abd27
%preun
3abd27
%if 0%{?systemd_preun:1}
3abd27
    %systemd_preun openvswitch.service
3abd27
%else
3abd27
    if [ $1 -eq 0 ] ; then
3abd27
    # Package removal, not upgrade
3abd27
        /bin/systemctl --no-reload disable openvswitch.service >/dev/null 2>&1 || :
3abd27
        /bin/systemctl stop openvswitch.service >/dev/null 2>&1 || :
3abd27
    fi
3abd27
%endif
3abd27
3abd27
%pre
3abd27
getent group openvswitch >/dev/null || groupadd -r openvswitch
3abd27
getent passwd openvswitch >/dev/null || \
3abd27
    useradd -r -g openvswitch -d / -s /sbin/nologin \
3abd27
    -c "Open vSwitch Daemons" openvswitch
3abd27
3abd27
%ifarch %{dpdkarches}
3abd27
    getent group hugetlbfs >/dev/null || groupadd hugetlbfs
3abd27
    usermod -a -G hugetlbfs openvswitch
3abd27
%endif
3abd27
exit 0
3abd27
3abd27
%post
3abd27
if [ $1 -eq 1 ]; then
3abd27
    sed -i 's:^#OVS_USER_ID=:OVS_USER_ID=:' /etc/sysconfig/openvswitch
3abd27
3abd27
%ifarch %{dpdkarches}
3abd27
    sed -i \
3abd27
        's@OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:hugetlbfs"@'\
3abd27
        /etc/sysconfig/openvswitch
3abd27
%endif
3abd27
fi
3abd27
chown -R openvswitch:openvswitch /etc/openvswitch
3abd27
3abd27
%if 0%{?systemd_post:1}
3abd27
    %systemd_post openvswitch.service
3abd27
%else
3abd27
    # Package install, not upgrade
3abd27
    if [ $1 -eq 1 ]; then
3abd27
        /bin/systemctl daemon-reload >dev/null || :
3abd27
    fi
3abd27
%endif
3abd27
3abd27
%postun
3abd27
%if 0%{?systemd_postun:1}
3abd27
    %systemd_postun openvswitch.service
3abd27
%else
3abd27
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
3abd27
%endif
3abd27
3abd27
%triggerun -- openvswitch < 2.5.0-22.git20160727%{?dist}
3abd27
# old rpm versions restart the service in postun, but
3abd27
# due to systemd some preparation is needed.
3abd27
if systemctl is-active openvswitch >/dev/null 2>&1 ; then
3abd27
    /usr/share/openvswitch/scripts/ovs-ctl stop >/dev/null 2>&1 || :
3abd27
    systemctl daemon-reload >/dev/null 2>&1 || :
3abd27
    systemctl stop openvswitch ovsdb-server ovs-vswitchd >/dev/null 2>&1 || :
3abd27
    systemctl start openvswitch >/dev/null 2>&1 || :
3abd27
fi
3abd27
exit 0
3abd27
3abd27
%files -n python3-%{pkgname}
3abd27
%{python3_sitearch}/ovs
3abd27
%{python3_sitearch}/ovs-*.egg-info
3abd27
%doc LICENSE
3abd27
3abd27
%files test
3abd27
%{_bindir}/ovs-pcap
3abd27
%{_bindir}/ovs-tcpdump
3abd27
%{_bindir}/ovs-tcpundump
3abd27
%{_datadir}/openvswitch/scripts/usdt/*
3abd27
%{_mandir}/man1/ovs-pcap.1*
3abd27
%{_mandir}/man8/ovs-tcpdump.8*
3abd27
%{_mandir}/man1/ovs-tcpundump.1*
3abd27
%{_bindir}/ovs-test
3abd27
%{_bindir}/ovs-vlan-test
3abd27
%{_bindir}/ovs-l3ping
3abd27
%{_mandir}/man8/ovs-test.8*
3abd27
%{_mandir}/man8/ovs-vlan-test.8*
3abd27
%{_mandir}/man8/ovs-l3ping.8*
3abd27
%{python3_sitelib}/ovstest
3abd27
3abd27
%files devel
3abd27
%{_libdir}/*.so
3abd27
%{_libdir}/pkgconfig/*.pc
3abd27
%{_includedir}/openvswitch/*
3abd27
%{_includedir}/openflow/*
3abd27
%exclude %{_libdir}/*.a
3abd27
%exclude %{_libdir}/*.la
3abd27
3abd27
%if 0%{?rhel} == 8 || 0%{?fedora} > 28
3abd27
%files -n network-scripts-%{name}
3abd27
%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
3abd27
%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
3abd27
%endif
3abd27
3abd27
%files
3abd27
%defattr(-,openvswitch,openvswitch)
3abd27
%dir %{_sysconfdir}/openvswitch
3abd27
%{_sysconfdir}/openvswitch/default.conf
3abd27
%config %ghost %verify(not owner group md5 size mtime) %{_sysconfdir}/openvswitch/conf.db
3abd27
%ghost %attr(0600,-,-) %verify(not owner group md5 size mtime) %{_sysconfdir}/openvswitch/.conf.db.~lock~
3abd27
%config %ghost %{_sysconfdir}/openvswitch/system-id.conf
3abd27
%defattr(-,root,root)
3abd27
%config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/sysconfig/openvswitch
3abd27
%{_sysconfdir}/bash_completion.d/ovs-appctl-bashcomp.bash
3abd27
%{_sysconfdir}/bash_completion.d/ovs-vsctl-bashcomp.bash
3abd27
%config(noreplace) %{_sysconfdir}/logrotate.d/openvswitch
3abd27
%{_unitdir}/openvswitch.service
3abd27
%{_unitdir}/ovsdb-server.service
3abd27
%{_unitdir}/ovs-vswitchd.service
3abd27
%{_unitdir}/ovs-delete-transient-ports.service
3abd27
%{_datadir}/openvswitch/scripts/openvswitch.init
3abd27
%{_datadir}/openvswitch/scripts/ovs-check-dead-ifs
3abd27
%{_datadir}/openvswitch/scripts/ovs-lib
3abd27
%{_datadir}/openvswitch/scripts/ovs-save
3abd27
%{_datadir}/openvswitch/scripts/ovs-vtep
3abd27
%{_datadir}/openvswitch/scripts/ovs-ctl
3abd27
%{_datadir}/openvswitch/scripts/ovs-kmod-ctl
3abd27
%{_datadir}/openvswitch/scripts/ovs-systemd-reload
3abd27
%config %{_datadir}/openvswitch/local-config.ovsschema
3abd27
%config %{_datadir}/openvswitch/vswitch.ovsschema
3abd27
%config %{_datadir}/openvswitch/vtep.ovsschema
3abd27
%{_bindir}/ovs-appctl
3abd27
%{_bindir}/ovs-dpctl
3abd27
%{_bindir}/ovs-ofctl
3abd27
%{_bindir}/ovs-vsctl
3abd27
%{_bindir}/ovsdb-client
3abd27
%{_bindir}/ovsdb-tool
3abd27
%{_bindir}/ovs-pki
3abd27
%{_bindir}/vtep-ctl
3abd27
%{_libdir}/*.so.*
3abd27
%{_sbindir}/ovs-vswitchd
3abd27
%{_sbindir}/ovsdb-server
3abd27
%{_mandir}/man1/ovsdb-client.1*
3abd27
%{_mandir}/man1/ovsdb-server.1*
3abd27
%{_mandir}/man1/ovsdb-tool.1*
3abd27
%{_mandir}/man5/ovsdb.5*
3abd27
%{_mandir}/man5/ovsdb.local-config.5*
3abd27
%{_mandir}/man5/ovsdb-server.5.*
3abd27
%{_mandir}/man5/ovs-vswitchd.conf.db.5*
3abd27
%{_mandir}/man5/vtep.5*
3abd27
%{_mandir}/man7/ovsdb-server.7*
3abd27
%{_mandir}/man7/ovsdb.7*
3abd27
%{_mandir}/man7/ovs-actions.7*
3abd27
%{_mandir}/man7/ovs-fields.7*
3abd27
%{_mandir}/man8/vtep-ctl.8*
3abd27
%{_mandir}/man8/ovs-appctl.8*
3abd27
%{_mandir}/man8/ovs-ctl.8*
3abd27
%{_mandir}/man8/ovs-dpctl.8*
3abd27
%{_mandir}/man8/ovs-kmod-ctl.8.*
3abd27
%{_mandir}/man8/ovs-ofctl.8*
3abd27
%{_mandir}/man8/ovs-pki.8*
3abd27
%{_mandir}/man8/ovs-vsctl.8*
3abd27
%{_mandir}/man8/ovs-vswitchd.8*
3abd27
%{_mandir}/man8/ovs-parse-backtrace.8*
3abd27
%{_udevrulesdir}/91-vfio.rules
3abd27
%doc LICENSE NOTICE README.rst NEWS rhel/README.RHEL.rst
3abd27
%ifarch %{dpdkarches}
3abd27
%doc %{dpdkdir}/README.DPDK-PMDS
3abd27
%attr(750,openvswitch,hugetlbfs) %verify(not owner group) /var/log/openvswitch
3abd27
%else
3abd27
%attr(750,openvswitch,openvswitch) %verify(not owner group) /var/log/openvswitch
3abd27
%endif
3abd27
/var/lib/openvswitch
3abd27
%ghost %attr(755,root,root) %verify(not owner group) %{_rundir}/openvswitch
3abd27
%{_datadir}/openvswitch/bugtool-plugins/
3abd27
%{_datadir}/openvswitch/scripts/ovs-bugtool-*
3abd27
%{_bindir}/ovs-dpctl-top
3abd27
%{_sbindir}/ovs-bugtool
3abd27
%{_mandir}/man8/ovs-dpctl-top.8*
3abd27
%{_mandir}/man8/ovs-bugtool.8*
3abd27
%if (0%{?rhel} && 0%{?rhel} <= 7) || (0%{?fedora} && 0%{?fedora} < 29)
3abd27
%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
3abd27
%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
3abd27
%endif
3abd27
3abd27
%if %{with ipsec}
3abd27
%files ipsec
3abd27
%{_datadir}/openvswitch/scripts/ovs-monitor-ipsec
3abd27
%{_unitdir}/openvswitch-ipsec.service
3abd27
%endif
3abd27
3abd27
%changelog
3abd27
* Mon Feb 20 2023 Timothy Redaelli <tredaelli@redhat.com> - 3.1.0-2
3abd27
- redhat: add a workaround for meson [RH git: 4b77c5096a]
3abd27
    Currently, fast-datapath-rhel-8 is aligned to RHEL 8.0, with an
3abd27
    exception to use a newer meson version.
3abd27
    
3abd27
    The problem is that, in the meanwhile, _smp_build_ncpus macros was added
3abd27
    (and meson macros uses it).
3abd27
    
3abd27
    This commit just define, if needed, _smp_build_ncpus by stripping the first 2
3abd27
    characters (-j) from _smp_mflags that was present in RHEL 8.0.
3abd27
    
3abd27
    Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
3abd27
3abd27
3abd27
* Fri Feb 17 2023 Timothy Redaelli <tredaelli@redhat.com> - 3.1.0-1
3abd27
- redhat: Use official 3.1.0 tarball [RH git: 2cd8ef13fd]
3abd27
3abd27