blob: f04eecc5c24902e54e77908b013490ec53e4711a [file] [log] [blame]
Thomas F Herbert4b0ac822017-08-29 16:07:51 -04001%bcond_without aesni
Renato Botelho do Coutoe266ea32017-11-30 15:41:22 -06002%{!?_topdir:%define _topdir %(pwd)}
Thomas F Herbert20a29c72016-10-13 18:36:50 -04003%define _vpp_build_dir build-tool-native
Ed Warnickecb9cada2015-12-08 15:45:58 -07004%define _unitdir /lib/systemd/system
Ed Warnickecb9cada2015-12-08 15:45:58 -07005%define _builddir %{_topdir}
Thomas F Herbertb42b77b2018-04-06 15:13:41 -04006%define _mu_build_dir %{_topdir}/%{name}-%{_version}/build-root
Igor Mikhailov (imichail)c442e612017-05-18 19:46:17 -07007%define _vpp_tag %{getenv:TAG}
8%if "%{_vpp_tag}" == ""
9%define _vpp_tag vpp
10%endif
11%define _vpp_install_dir install-%{_vpp_tag}-native
Ed Warnickecb9cada2015-12-08 15:45:58 -070012
Ian Wells13cef0c2019-08-09 17:27:19 -070013# Failsafe backport of Python2-macros for RHEL <= 6
14%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
15%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
16%{!?python_version: %global python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")}
17%{!?__python2: %global __python2 %{__python}}
18%{!?python2_sitelib: %global python2_sitelib %{python_sitelib}}
19%{!?python2_sitearch: %global python2_sitearch %{python_sitearch}}
20%{!?python2_version: %global python2_version %{python_version}}
21
22%{!?python2_minor_version: %define python2_minor_version %(%{__python} -c "import sys ; print sys.version[2:3]")}
23
Peter Ginchevdfa9c5b2016-10-11 15:34:24 +030024%{?systemd_requires}
25
Billy McFall28cf3b72018-01-15 17:54:52 -050026
27# SELinux Related definitions
28%global selinuxtype targeted
29%global moduletype services
30%global modulenames vpp-custom
31
32# Usage: _format var format
33# Expand 'modulenames' into various formats as needed
34# Format must contain '$x' somewhere to do anything useful
35%global _format() export %1=""; for x in %{modulenames}; do %1+=%2; %1+=" "; done;
36
37# Relabel files
38%global relabel_files() \ # ADD files in *.fc file
39
40# Version of distribution SELinux policy package
41%global selinux_policyver 3.13.1-128.6.fc22
42
43
Ed Warnickecb9cada2015-12-08 15:45:58 -070044Name: vpp
45Summary: Vector Packet Processing
Billy McFallf6e3ad02017-07-05 09:33:30 -040046License: ASL 2.0
Ed Warnickecb9cada2015-12-08 15:45:58 -070047Version: %{_version}
48Release: %{_release}
Damjan Mariona1bd0232016-12-19 19:08:11 +010049BuildRequires: systemd, chrpath
Thomas F Herberte4128912017-10-09 15:03:55 -040050BuildRequires: check, check-devel
Thomas F Herbertca3d38a2019-04-22 17:35:03 -040051BuildRequires: mbedtls-devel mbedtls
Thomas F Herbert6eb61632018-11-27 15:57:30 -050052%if 0%{?fedora}
Ian Wells13cef0c2019-08-09 17:27:19 -070053Requires: vpp-lib = %{_version}-%{_release}, vpp-selinux-policy = %{_version}-%{_release}, net-tools, pciutils
Thomas F Herbertca3d38a2019-04-22 17:35:03 -040054Requires: compat-openssl10
55Requires: boost-filesystem mbedtls libffi-devel
Thomas F Herbert66731782018-03-05 17:21:56 -050056BuildRequires: subunit, subunit-devel
Thomas F Herbert440751b2017-09-11 08:58:23 -040057BuildRequires: compat-openssl10-devel
Ian Wells13cef0c2019-08-09 17:27:19 -070058BuildRequires: python, python-devel, python-virtualenv, python-ply
59BuildRequires: python3, python36-devel, python3-virtualenv
Thomas F Herbert6eb61632018-11-27 15:57:30 -050060BuildRequires: cmake
Thomas F Herbertbd8e2422017-08-03 11:04:24 -040061%else
Renato Botelho do Coutoc0253292019-11-07 06:10:34 -060062%if 0%{rhel} >= 7
Thomas F Herbertca3d38a2019-04-22 17:35:03 -040063Requires: vpp-lib = %{_version}-%{_release}, vpp-selinux-policy = %{_version}-%{_release}, net-tools, pciutils, python36
64Requires: boost-filesystem mbedtls libffi-devel
65BuildRequires: epel-release
66BuildRequires: mbedtls-devel mbedtls
Thomas F Herbert440751b2017-09-11 08:58:23 -040067BuildREquires: openssl-devel
Thomas F Herbertca3d38a2019-04-22 17:35:03 -040068BuildRequires: python36-devel
Renato Botelho do Coutoc0253292019-11-07 06:10:34 -060069%if 0%{rhel} == 7
Damjan Marion162330f2020-04-29 21:28:15 +020070BuildRequires: devtoolset-9-toolchain
Thomas F Herbert6eb61632018-11-27 15:57:30 -050071BuildRequires: cmake3
Renato Botelho do Coutoc0253292019-11-07 06:10:34 -060072BuildRequires: glibc-static, yum-utils
73%else
74BuildRequires: cmake
75BuildRequires: dnf-utils
76%endif
Thomas F Herbertbd8e2422017-08-03 11:04:24 -040077%endif
78%endif
Thomas F Herbert440751b2017-09-11 08:58:23 -040079BuildRequires: libffi-devel
Renato Botelho do Coutoc0253292019-11-07 06:10:34 -060080BuildRequires: redhat-lsb
Thomas F Herbertbd8e2422017-08-03 11:04:24 -040081BuildRequires: apr-devel
Thomas F Herbertbd8e2422017-08-03 11:04:24 -040082BuildRequires: numactl-devel
83BuildRequires: autoconf automake libtool byacc bison flex
Neale Ranns2ea2e422017-11-07 05:20:16 -080084BuildRequires: boost boost-devel
Billy McFall28cf3b72018-01-15 17:54:52 -050085BuildRequires: selinux-policy selinux-policy-devel
Ed Warnickecb9cada2015-12-08 15:45:58 -070086
Thomas F Herbertb60f4962017-07-19 19:17:15 -040087Source: %{name}-%{_version}-%{_release}.tar.xz
88# Source: vpp-latest.tar.xz
Thomas F Herbert20a29c72016-10-13 18:36:50 -040089
Ed Warnickecb9cada2015-12-08 15:45:58 -070090%description
Damjan Marion08ff7e02016-01-20 13:45:36 +010091This package provides VPP executables: vpp, vpp_api_test, vpp_json_test
92vpp - the vector packet engine
93vpp_api_test - vector packet engine API test tool
94vpp_json_test - vector packet engine JSON test tool
Ed Warnickecb9cada2015-12-08 15:45:58 -070095
96%package lib
97Summary: VPP libraries
98Group: System Environment/Libraries
Billy McFall28cf3b72018-01-15 17:54:52 -050099Requires: vpp-selinux-policy = %{_version}-%{_release}
Ed Warnickecb9cada2015-12-08 15:45:58 -0700100
101%description lib
102This package contains the VPP shared libraries, including:
103vppinfra - foundation library supporting vectors, hashes, bitmaps, pools, and string formatting.
Ed Warnickecb9cada2015-12-08 15:45:58 -0700104svm - vm library
105vlib - vector processing library
106vlib-api - binary API library
107vnet - network stack library
108
109%package devel
110Summary: VPP header files, static libraries
111Group: Development/Libraries
112Requires: vpp-lib
113
114%description devel
Thomas F Herbert3977a212016-10-01 18:09:33 -0400115This package contains the header files for VPP.
116Install this package if you want to write a
117program for compilation and linking with vpp lib.
118vlib
119vlibmemory
120vnet - devices, classify, dhcp, ethernet flow, gre, ip, etc.
121vpp-api
122vppinfra
Ed Warnickecb9cada2015-12-08 15:45:58 -0700123
Ed Warnickef5a14362016-09-12 20:40:24 +0000124%package plugins
125Summary: Vector Packet Processing--runtime plugins
126Group: System Environment/Libraries
Gabriel Gannebf246df2018-01-18 11:00:17 +0100127Requires: vpp = %{_version}-%{_release} numactl-libs
Ed Warnickef5a14362016-09-12 20:40:24 +0000128%description plugins
129This package contains VPP plugins
130
Damjan Marioncb034b92016-12-28 18:38:59 +0100131%package api-lua
132Summary: VPP api lua bindings
133Group: Development/Libraries
134Requires: vpp = %{_version}-%{_release}, vpp-lib = %{_version}-%{_release}
135
136%description api-lua
137This package contains the lua bindings for the vpp api
138
Damjan Marioncb034b92016-12-28 18:38:59 +0100139%package api-python
Ole Troan57c3d662016-09-12 22:00:32 +0200140Summary: VPP api python bindings
141Group: Development/Libraries
Thomas F Herbertca3d38a2019-04-22 17:35:03 -0400142Requires: vpp = %{_version}-%{_release}, vpp-lib = %{_version}-%{_release}, libffi-devel
143Requires: python-setuptools
Ole Troan57c3d662016-09-12 22:00:32 +0200144
Damjan Marioncb034b92016-12-28 18:38:59 +0100145%description api-python
Ole Troan57c3d662016-09-12 22:00:32 +0200146This package contains the python bindings for the vpp api
147
Ian Wells13cef0c2019-08-09 17:27:19 -0700148%package api-python3
149Summary: VPP api python3 bindings
150Group: Development/Libraries
151Requires: vpp = %{_version}-%{_release}, vpp-lib = %{_version}-%{_release}, libffi-devel
Yichen Wang466872f2020-06-30 23:14:23 -0700152Requires: python3-setuptools
Ian Wells13cef0c2019-08-09 17:27:19 -0700153
154%description api-python3
155This package contains the python3 bindings for the vpp api
156
Billy McFall28cf3b72018-01-15 17:54:52 -0500157%package selinux-policy
158Summary: VPP Security-Enhanced Linux (SELinux) policy
159Group: System Environment/Base
Renato Botelho do Couto1d94ab52020-03-06 13:42:22 -0600160Requires(post): selinux-policy-base >= %{selinux_policyver}, selinux-policy-targeted >= %{selinux_policyver}, policycoreutils, libselinux-utils
161%if 0%{rhel} < 8
162Requires(post): policycoreutils-python
163%else
164Requires(post): python3-policycoreutils
165%endif
Billy McFall28cf3b72018-01-15 17:54:52 -0500166
167%description selinux-policy
168This package contains a tailored VPP SELinux policy
169
Thomas F Herbert20a29c72016-10-13 18:36:50 -0400170%prep
Dave Wallace27b50fe2020-09-16 21:04:24 +0000171%setup -q -c -T -n %{name}-%{_version}
172cd ..
173unxz --stdout ./SOURCES/%{name}-%{_version}-%{_release}.tar.xz | tar --extract --touch
174cd -
Thomas F Herbert20a29c72016-10-13 18:36:50 -0400175
Ed Warnickeec6290a2016-06-08 17:15:08 -0500176%pre
177# Add the vpp group
Ed Warnickeb10427e2016-06-08 19:49:40 -0500178groupadd -f -r vpp
Ed Warnickeec6290a2016-06-08 17:15:08 -0500179
Ole Troanc60f5572017-03-17 09:54:51 +0100180%build
Renato Botelho do Coutoc0253292019-11-07 06:10:34 -0600181%if 0%{rhel} < 8
Damjan Marion162330f2020-04-29 21:28:15 +0200182. /opt/rh/devtoolset-9/enable
Thomas F Herbert6eb61632018-11-27 15:57:30 -0500183%endif
Thomas F Herbert4b0ac822017-08-29 16:07:51 -0400184%if %{with aesni}
Dave Wallace27b50fe2020-09-16 21:04:24 +0000185 make install-dep
Thomas F Herbert4b0ac822017-08-29 16:07:51 -0400186 make -C build-root PLATFORM=vpp TAG=%{_vpp_tag} install-packages
187%else
188 make bootstrap AESNI=n
189 make -C build-root PLATFORM=vpp AESNI=n TAG=%{_vpp_tag} install-packages
190%endif
Ian Wells13cef0c2019-08-09 17:27:19 -0700191cd %{_mu_build_dir}/../src/vpp-api/python && %py2_build
Thomas F Herbertca3d38a2019-04-22 17:35:03 -0400192cd %{_mu_build_dir}/../src/vpp-api/python && %py3_build
Billy McFall28cf3b72018-01-15 17:54:52 -0500193cd %{_mu_build_dir}/../extras/selinux && make -f %{_datadir}/selinux/devel/Makefile
Ole Troanc60f5572017-03-17 09:54:51 +0100194
Ed Warnickecb9cada2015-12-08 15:45:58 -0700195%install
196#
197# binaries
198#
199mkdir -p -m755 %{buildroot}%{_bindir}
200mkdir -p -m755 %{buildroot}%{_unitdir}
Gabriel Ganne714968b2017-01-26 15:42:39 +0100201install -p -m 755 %{_mu_build_dir}/%{_vpp_install_dir}/vpp/bin/* %{buildroot}%{_bindir}
Ole Troanf14e3bf2016-12-01 21:49:03 +0100202
Damjan Marion7cd468a2016-12-19 23:05:39 +0100203# api
Ole Troanf14e3bf2016-12-01 21:49:03 +0100204mkdir -p -m755 %{buildroot}/usr/share/vpp/api
Ole Troanf14e3bf2016-12-01 21:49:03 +0100205
Ed Warnickecb9cada2015-12-08 15:45:58 -0700206#
207# configs
208#
209mkdir -p -m755 %{buildroot}/etc/vpp
Miroslav Miklus8e08e742016-10-11 13:35:26 +0200210mkdir -p -m755 %{buildroot}/etc/sysctl.d
Thomas F Herbert5b75b6b2017-07-23 17:21:46 -0400211install -p -m 644 %{_mu_build_dir}/../extras/rpm/vpp.service %{buildroot}%{_unitdir}
Damjan Mariond0f673e2017-01-31 17:29:33 +0100212install -p -m 644 %{_mu_build_dir}/../src/vpp/conf/startup.conf %{buildroot}/etc/vpp/startup.conf
Damjan Marion7cd468a2016-12-19 23:05:39 +0100213install -p -m 644 %{_mu_build_dir}/../src/vpp/conf/80-vpp.conf %{buildroot}/etc/sysctl.d
Ed Warnickecb9cada2015-12-08 15:45:58 -0700214#
215# libraries
216#
217mkdir -p -m755 %{buildroot}%{_libdir}
Padraig Connolly69915cb2017-01-10 17:10:39 +0000218mkdir -p -m755 %{buildroot}/etc/bash_completion.d
219mkdir -p -m755 %{buildroot}/usr/share/vpp
Matthew Smithd790c7e2018-09-06 10:59:49 -0500220for file in $(find %{_mu_build_dir}/%{_vpp_install_dir}/*/lib* -type f -name '*.so.*.*' -print )
Ed Warnickecb9cada2015-12-08 15:45:58 -0700221do
222 install -p -m 755 $file %{buildroot}%{_libdir}
223done
224for file in $(cd %{buildroot}%{_libdir} && find . -type f -print | sed -e 's/^\.\///')
225do
226 # make lib symlinks
227 ( cd %{buildroot}%{_libdir} &&
228 ln -fs $file $(echo $file | sed -e 's/\(\.so\.[0-9]\+\).*/\1/') )
Ed Warnickef5a0e732016-09-07 17:12:52 +0000229 ( cd %{buildroot}%{_libdir} &&
230 ln -fs $file $(echo $file | sed -e 's/\(\.so\)\.[0-9]\+.*/\1/') )
Ed Warnickecb9cada2015-12-08 15:45:58 -0700231done
Damjan Marion7cd468a2016-12-19 23:05:39 +0100232for file in $(find %{_mu_build_dir}/%{_vpp_install_dir}/vpp/share/vpp/api -type f -name '*.api.json' -print )
Ole Troanf14e3bf2016-12-01 21:49:03 +0100233do
234 install -p -m 644 $file %{buildroot}/usr/share/vpp/api
235done
Ed Warnicke406ab9d2016-08-31 18:48:47 -0700236
Damjan Marioncb034b92016-12-28 18:38:59 +0100237# Lua bindings
238mkdir -p -m755 %{buildroot}/usr/share/doc/vpp/examples/lua/examples/cli
239mkdir -p -m755 %{buildroot}/usr/share/doc/vpp/examples/lua/examples/lute
Thomas F Herbertbd8e2422017-08-03 11:04:24 -0400240# for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/vpp-api/lua && git ls-files .)
241for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/vpp-api/lua && find . -type f -regex '.*/*.[luteamd]' -print | sed -e 's/^\.\///')
Damjan Marioncb034b92016-12-28 18:38:59 +0100242do
Thomas F Herbertbd8e2422017-08-03 11:04:24 -0400243 ( cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/vpp-api/lua && install -p -m 644 $file \
244 %{buildroot}/usr/share/doc/vpp/examples/lua/$file )
Damjan Marioncb034b92016-12-28 18:38:59 +0100245done
246
Ole Troan57c3d662016-09-12 22:00:32 +0200247# Python bindings
Ian Wells13cef0c2019-08-09 17:27:19 -0700248cd %{_mu_build_dir}/../src/vpp-api/python && %py2_install
Thomas F Herbertca3d38a2019-04-22 17:35:03 -0400249cd %{_mu_build_dir}/../src/vpp-api/python && %py3_install
Ole Troan57c3d662016-09-12 22:00:32 +0200250
Billy McFall28cf3b72018-01-15 17:54:52 -0500251# SELinux Policy
252# Install SELinux interfaces
253%_format INTERFACES %{_mu_build_dir}/../extras/selinux/$x.if
254install -d %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}
255install -p -m 644 $INTERFACES \
256 %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}
257
258# Install policy modules
259%_format MODULES %{_mu_build_dir}/../extras/selinux/$x.pp
260install -d %{buildroot}%{_datadir}/selinux/packages
261install -m 0644 $MODULES \
262 %{buildroot}%{_datadir}/selinux/packages
263
Ed Warnickecb9cada2015-12-08 15:45:58 -0700264#
265# devel
266#
Damjan Marion8c1afb52020-10-16 15:28:47 +0200267for dir in %{_mu_build_dir}/%{_vpp_install_dir}/vpp/include/
Ed Warnickecb9cada2015-12-08 15:45:58 -0700268do
269 for subdir in $(cd ${dir} && find . -type d -print)
270 do
271 mkdir -p -m755 %{buildroot}/usr/include/${subdir}
272 done
273 for file in $(cd ${dir} && find . -type f -print)
274 do
275 install -p -m 644 $dir/$file %{buildroot}%{_includedir}/$file
276 done
277done
Ed Warnicke406ab9d2016-08-31 18:48:47 -0700278
Paul Vinciguerra9ce6a212018-09-12 13:40:13 -0700279install -p -m 644 %{_mu_build_dir}/../src/tools/vppapigen/vppapigen_c.py %{buildroot}/usr/share/vpp
280install -p -m 644 %{_mu_build_dir}/../src/tools/vppapigen/vppapigen_json.py %{buildroot}/usr/share/vpp
Jon Loeliger190282c2018-01-31 09:45:11 -0600281
Ed Warnickecb9cada2015-12-08 15:45:58 -0700282# sample plugin
283mkdir -p -m755 %{buildroot}/usr/share/doc/vpp/examples/sample-plugin/sample
Thomas F Herbertbd8e2422017-08-03 11:04:24 -0400284#for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/examples/sample-plugin && git ls-files .)
285for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/examples/sample-plugin && find . -type f -regex '.*/*.[acdhimp]' -print | sed -e 's/^\.\///')
Ed Warnickecb9cada2015-12-08 15:45:58 -0700286do
Thomas F Herbertbd8e2422017-08-03 11:04:24 -0400287 ( cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/examples/sample-plugin && install -p -m 644 $file \
288 %{buildroot}/usr/share/doc/vpp/examples/sample-plugin/$file )
Ed Warnickecb9cada2015-12-08 15:45:58 -0700289done
290
Billy McFall28cf3b72018-01-15 17:54:52 -0500291# vppctl sockfile directory
292mkdir -p -m755 %{buildroot}%{_localstatedir}/run/vpp
293# vpp.log directory
294mkdir -p -m755 %{buildroot}%{_localstatedir}/log/vpp
Ed Warnickef5a14362016-09-12 20:40:24 +0000295
296#
297# vpp-plugins
Damjan Marion79dcbc72018-09-12 14:01:10 +0200298#
Ed Warnickee7637e72016-09-14 16:58:33 -0700299mkdir -p -m755 %{buildroot}/usr/lib/vpp_plugins
300mkdir -p -m755 %{buildroot}/usr/lib/vpp_api_test_plugins
Damjan Marion79dcbc72018-09-12 14:01:10 +0200301for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib/vpp_plugins && find -type f -print)
Damjan Marion7cd468a2016-12-19 23:05:39 +0100302do
Matthew Smith4ed00392019-03-05 09:28:48 -0600303 install -p -m 755 %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib/vpp_plugins/$file \
Damjan Marion7cd468a2016-12-19 23:05:39 +0100304 %{buildroot}/usr/lib/vpp_plugins/$file
305done
306
Damjan Marion79dcbc72018-09-12 14:01:10 +0200307for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib/vpp_api_test_plugins && find -type f -print)
Damjan Marion7cd468a2016-12-19 23:05:39 +0100308do
Matthew Smith4ed00392019-03-05 09:28:48 -0600309 install -p -m 755 %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib/vpp_api_test_plugins/$file \
Damjan Marion7cd468a2016-12-19 23:05:39 +0100310 %{buildroot}/usr/lib/vpp_api_test_plugins/$file
311done
312
Mohsin Kazmi7b2017d2018-09-26 10:49:41 +0200313for file in $(find %{_mu_build_dir}/%{_vpp_install_dir}/vpp/share/vpp/api/plugins -type f -name '*.api.json' -print )
Ole Troanf14e3bf2016-12-01 21:49:03 +0100314do
Matthew Smith4ed00392019-03-05 09:28:48 -0600315 install -p -m 755 $file %{buildroot}/usr/share/vpp/api
Ole Troanf14e3bf2016-12-01 21:49:03 +0100316done
317
Damjan Mariona1bd0232016-12-19 19:08:11 +0100318#
319# remove RPATH from ELF binaries
320#
321%{_mu_build_dir}/scripts/remove-rpath %{buildroot}
322
Ed Warnickecb9cada2015-12-08 15:45:58 -0700323%post
Kristina Nevolnikova8ae18732017-06-21 14:20:42 +0200324if [ $1 -eq 1 ] ; then
325 sysctl --system
326fi
Ed Warnickecb9cada2015-12-08 15:45:58 -0700327%systemd_post vpp.service
328
Peter Ginchevdfa9c5b2016-10-11 15:34:24 +0300329%preun
330%systemd_preun vpp.service
331
Billy McFall28cf3b72018-01-15 17:54:52 -0500332%post selinux-policy
333%_format MODULES %{_datadir}/selinux/packages/$x.pp
Billy McFall28cf3b72018-01-15 17:54:52 -0500334if %{_sbindir}/selinuxenabled ; then
Matthew Smith7c172cb2018-02-22 21:12:11 -0600335 %{_sbindir}/semodule -n -X 400 -s %{selinuxtype} -i $MODULES
Billy McFall28cf3b72018-01-15 17:54:52 -0500336 %{_sbindir}/load_policy
337 %relabel_files
338fi
339
340
Ed Warnickecb9cada2015-12-08 15:45:58 -0700341%postun
Peter Ginchevdfa9c5b2016-10-11 15:34:24 +0300342%systemd_postun
Kristina Nevolnikova8ae18732017-06-21 14:20:42 +0200343if [ $1 -eq 0 ] ; then
344 echo "Uninstalling, unbind user-mode PCI drivers"
345 # Unbind user-mode PCI drivers
346 removed=
347 pci_dirs=`find /sys/bus/pci/drivers -type d -name igb_uio -o -name uio_pci_generic -o -name vfio-pci`
348 for d in $pci_dirs; do
349 for f in ${d}/*; do
350 [ -e "${f}/config" ] || continue
351 echo ${f##*/} > ${d}/unbind
352 basename `dirname ${f}` | xargs echo -n "Removing driver"; echo " for PCI ID" `basename ${f}`
353 removed=y
354 done
Peter Ginchevdfa9c5b2016-10-11 15:34:24 +0300355 done
Kristina Nevolnikova8ae18732017-06-21 14:20:42 +0200356 if [ -n "${removed}" ]; then
357 echo "There are changes in PCI drivers, rescaning"
358 echo 1 > /sys/bus/pci/rescan
359 else
360 echo "There weren't PCI devices binded"
361 fi
Peter Ginchevdfa9c5b2016-10-11 15:34:24 +0300362else
Kristina Nevolnikova8ae18732017-06-21 14:20:42 +0200363 echo "Upgrading package, dont' unbind interfaces"
Peter Ginchevdfa9c5b2016-10-11 15:34:24 +0300364fi
Ed Warnickecb9cada2015-12-08 15:45:58 -0700365
Billy McFall28cf3b72018-01-15 17:54:52 -0500366%postun selinux-policy
367if [ $1 -eq 0 ]; then
368 %{_sbindir}/semodule -n -r %{modulenames}
369 if %{_sbindir}/selinuxenabled ; then
370 %{_sbindir}/load_policy
371 %relabel_files
372 fi
373fi
374
Ed Warnickecb9cada2015-12-08 15:45:58 -0700375%files
376%defattr(-,bin,bin)
377%{_unitdir}/vpp.service
Damjan Marion08ff7e02016-01-20 13:45:36 +0100378/usr/bin/vpp*
Ed Warnickecb9cada2015-12-08 15:45:58 -0700379/usr/bin/svm*
Billy McFallce41a5c2017-09-08 20:11:58 +0000380%config(noreplace) /etc/sysctl.d/80-vpp.conf
381%config(noreplace) /etc/vpp/startup.conf
Ole Troanf14e3bf2016-12-01 21:49:03 +0100382/usr/share/vpp/api/*
Ed Warnickecb9cada2015-12-08 15:45:58 -0700383
Billy McFall28cf3b72018-01-15 17:54:52 -0500384%defattr(-,root,vpp)
385%{_localstatedir}/run/vpp*
386
387%defattr(-,root,root)
388%{_localstatedir}/log/vpp*
389
Ed Warnickecb9cada2015-12-08 15:45:58 -0700390%files lib
391%defattr(-,bin,bin)
Igor Mikhailov (imichail)3b854a52018-05-18 20:08:26 -0700392%global __requires_exclude_from %{_libdir}/librte_pmd_mlx[45]_glue\\.so.*$
Ed Warnickef5a14362016-09-12 20:40:24 +0000393%exclude %{_libdir}/vpp_plugins
394%exclude %{_libdir}/vpp_api_test_plugins
Ed Warnickecb9cada2015-12-08 15:45:58 -0700395%{_libdir}/*
Ole Troanf14e3bf2016-12-01 21:49:03 +0100396/usr/share/vpp/api/*
Ed Warnickecb9cada2015-12-08 15:45:58 -0700397
Damjan Marioncb034b92016-12-28 18:38:59 +0100398%files api-lua
Gabriel Gannef3854e92017-01-17 10:00:54 +0100399%defattr(644,root,root,644)
Damjan Marioncb034b92016-12-28 18:38:59 +0100400/usr/share/doc/vpp/examples/lua
401
Damjan Marioncb034b92016-12-28 18:38:59 +0100402%files api-python
Onong Tayeng9b0ce022018-11-23 15:33:41 +0530403%defattr(644,root,root,755)
Ian Wells13cef0c2019-08-09 17:27:19 -0700404%{python2_sitelib}/vpp_*
405
406%files api-python3
407%defattr(644,root,root,755)
Thomas F Herbertca3d38a2019-04-22 17:35:03 -0400408%{python3_sitelib}/vpp_*
Ole Troan57c3d662016-09-12 22:00:32 +0200409
Billy McFall28cf3b72018-01-15 17:54:52 -0500410%files selinux-policy
411%defattr(-,root,root,0755)
412%attr(0644,root,root) %{_datadir}/selinux/packages/*.pp
413%attr(0644,root,root) %{_datadir}/selinux/devel/include/%{moduletype}/*.if
414
Ed Warnickecb9cada2015-12-08 15:45:58 -0700415%files devel
416%defattr(-,bin,bin)
417/usr/bin/vppapigen
Oliver Gilesdc203712019-12-05 23:37:36 +0200418/usr/bin/vapi_c_gen.py
419/usr/bin/vapi_cpp_gen.py
420/usr/bin/vapi_json_parser.py
Ed Warnickecb9cada2015-12-08 15:45:58 -0700421%{_includedir}/*
422/usr/share/doc/vpp/examples/sample-plugin
Ole Troan9d420872017-10-12 13:06:35 +0200423/usr/share/vpp
Ed Warnicke406ab9d2016-08-31 18:48:47 -0700424
Ed Warnickef5a14362016-09-12 20:40:24 +0000425%files plugins
426%defattr(-,bin,bin)
Ed Warnickee7637e72016-09-14 16:58:33 -0700427/usr/lib/vpp_plugins/*
428/usr/lib/vpp_api_test_plugins/*
Ole Troanf14e3bf2016-12-01 21:49:03 +0100429/usr/share/vpp/api/*