Thomas F Herbert | 4b0ac82 | 2017-08-29 16:07:51 -0400 | [diff] [blame] | 1 | %bcond_without aesni |
Renato Botelho do Couto | e266ea3 | 2017-11-30 15:41:22 -0600 | [diff] [blame] | 2 | %{!?_topdir:%define _topdir %(pwd)} |
Thomas F Herbert | 20a29c7 | 2016-10-13 18:36:50 -0400 | [diff] [blame] | 3 | %define _vpp_build_dir build-tool-native |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 4 | %define _unitdir /lib/systemd/system |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 5 | %define _builddir %{_topdir} |
Thomas F Herbert | b42b77b | 2018-04-06 15:13:41 -0400 | [diff] [blame] | 6 | %define _mu_build_dir %{_topdir}/%{name}-%{_version}/build-root |
Igor Mikhailov (imichail) | c442e61 | 2017-05-18 19:46:17 -0700 | [diff] [blame] | 7 | %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 Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 12 | |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 13 | # 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 Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 24 | %{?systemd_requires} |
| 25 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 26 | |
| 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 Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 44 | Name: vpp |
| 45 | Summary: Vector Packet Processing |
Billy McFall | f6e3ad0 | 2017-07-05 09:33:30 -0400 | [diff] [blame] | 46 | License: ASL 2.0 |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 47 | Version: %{_version} |
| 48 | Release: %{_release} |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 49 | Requires: vpp-lib = %{_version}-%{_release}, vpp-selinux-policy = %{_version}-%{_release}, net-tools, pciutils, python |
Damjan Marion | a1bd023 | 2016-12-19 19:08:11 +0100 | [diff] [blame] | 50 | BuildRequires: systemd, chrpath |
Thomas F Herbert | e412891 | 2017-10-09 15:03:55 -0400 | [diff] [blame] | 51 | BuildRequires: check, check-devel |
Thomas F Herbert | 6eb6163 | 2018-11-27 15:57:30 -0500 | [diff] [blame] | 52 | %if 0%{?fedora} |
Thomas F Herbert | 6673178 | 2018-03-05 17:21:56 -0500 | [diff] [blame] | 53 | BuildRequires: subunit, subunit-devel |
Thomas F Herbert | 440751b | 2017-09-11 08:58:23 -0400 | [diff] [blame] | 54 | BuildRequires: compat-openssl10-devel |
Thomas F Herbert | 6168623 | 2018-05-03 19:17:13 -0400 | [diff] [blame] | 55 | BuildRequires: python2-devel, python2-virtualenv, python2-ply |
Thomas F Herbert | 5f56c09 | 2018-04-05 16:09:58 -0400 | [diff] [blame] | 56 | BuildRequires: mbedtls-devel |
Thomas F Herbert | 6eb6163 | 2018-11-27 15:57:30 -0500 | [diff] [blame] | 57 | BuildRequires: cmake |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 58 | %else |
Thomas F Herbert | 6eb6163 | 2018-11-27 15:57:30 -0500 | [diff] [blame] | 59 | %if 0%{rhel} == 7 |
| 60 | BuildRequires: devtoolset-7-toolchain |
Thomas F Herbert | 440751b | 2017-09-11 08:58:23 -0400 | [diff] [blame] | 61 | BuildREquires: openssl-devel |
Thomas F Herbert | 6168623 | 2018-05-03 19:17:13 -0400 | [diff] [blame] | 62 | BuildRequires: python-devel, python-virtualenv, python-ply |
Thomas F Herbert | 6eb6163 | 2018-11-27 15:57:30 -0500 | [diff] [blame] | 63 | BuildRequires: cmake3 |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 64 | %endif |
| 65 | %endif |
Thomas F Herbert | 440751b | 2017-09-11 08:58:23 -0400 | [diff] [blame] | 66 | BuildRequires: libffi-devel |
Michal Cmarada | 4e633e1 | 2019-01-31 10:57:40 +0100 | [diff] [blame^] | 67 | BuildRequires: glibc-static, yum-utils, redhat-lsb |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 68 | BuildRequires: apr-devel |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 69 | BuildRequires: numactl-devel |
| 70 | BuildRequires: autoconf automake libtool byacc bison flex |
Neale Ranns | 2ea2e42 | 2017-11-07 05:20:16 -0800 | [diff] [blame] | 71 | BuildRequires: boost boost-devel |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 72 | BuildRequires: selinux-policy selinux-policy-devel |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 73 | |
Thomas F Herbert | b60f496 | 2017-07-19 19:17:15 -0400 | [diff] [blame] | 74 | Source: %{name}-%{_version}-%{_release}.tar.xz |
| 75 | # Source: vpp-latest.tar.xz |
Thomas F Herbert | 20a29c7 | 2016-10-13 18:36:50 -0400 | [diff] [blame] | 76 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 77 | %description |
Damjan Marion | 08ff7e0 | 2016-01-20 13:45:36 +0100 | [diff] [blame] | 78 | This package provides VPP executables: vpp, vpp_api_test, vpp_json_test |
| 79 | vpp - the vector packet engine |
| 80 | vpp_api_test - vector packet engine API test tool |
| 81 | vpp_json_test - vector packet engine JSON test tool |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 82 | |
| 83 | %package lib |
| 84 | Summary: VPP libraries |
| 85 | Group: System Environment/Libraries |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 86 | Requires: vpp-selinux-policy = %{_version}-%{_release} |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 87 | |
| 88 | %description lib |
| 89 | This package contains the VPP shared libraries, including: |
| 90 | vppinfra - foundation library supporting vectors, hashes, bitmaps, pools, and string formatting. |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 91 | svm - vm library |
| 92 | vlib - vector processing library |
| 93 | vlib-api - binary API library |
| 94 | vnet - network stack library |
| 95 | |
| 96 | %package devel |
| 97 | Summary: VPP header files, static libraries |
| 98 | Group: Development/Libraries |
| 99 | Requires: vpp-lib |
| 100 | |
| 101 | %description devel |
Thomas F Herbert | 3977a21 | 2016-10-01 18:09:33 -0400 | [diff] [blame] | 102 | This package contains the header files for VPP. |
| 103 | Install this package if you want to write a |
| 104 | program for compilation and linking with vpp lib. |
| 105 | vlib |
| 106 | vlibmemory |
| 107 | vnet - devices, classify, dhcp, ethernet flow, gre, ip, etc. |
| 108 | vpp-api |
| 109 | vppinfra |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 110 | |
Ed Warnicke | f5a1436 | 2016-09-12 20:40:24 +0000 | [diff] [blame] | 111 | %package plugins |
| 112 | Summary: Vector Packet Processing--runtime plugins |
| 113 | Group: System Environment/Libraries |
Gabriel Ganne | bf246df | 2018-01-18 11:00:17 +0100 | [diff] [blame] | 114 | Requires: vpp = %{_version}-%{_release} numactl-libs |
Ed Warnicke | f5a1436 | 2016-09-12 20:40:24 +0000 | [diff] [blame] | 115 | %description plugins |
| 116 | This package contains VPP plugins |
| 117 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 118 | %package api-lua |
| 119 | Summary: VPP api lua bindings |
| 120 | Group: Development/Libraries |
| 121 | Requires: vpp = %{_version}-%{_release}, vpp-lib = %{_version}-%{_release} |
| 122 | |
| 123 | %description api-lua |
| 124 | This package contains the lua bindings for the vpp api |
| 125 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 126 | %package api-python |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 127 | Summary: VPP api python bindings |
| 128 | Group: Development/Libraries |
Ole Troan | c60f557 | 2017-03-17 09:54:51 +0100 | [diff] [blame] | 129 | Requires: vpp = %{_version}-%{_release}, vpp-lib = %{_version}-%{_release}, python-setuptools libffi-devel |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 130 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 131 | %description api-python |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 132 | This package contains the python bindings for the vpp api |
| 133 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 134 | %package selinux-policy |
| 135 | Summary: VPP Security-Enhanced Linux (SELinux) policy |
| 136 | Group: System Environment/Base |
| 137 | Requires(post): selinux-policy-base >= %{selinux_policyver}, selinux-policy-targeted >= %{selinux_policyver}, policycoreutils, policycoreutils-python libselinux-utils |
| 138 | |
| 139 | %description selinux-policy |
| 140 | This package contains a tailored VPP SELinux policy |
| 141 | |
Thomas F Herbert | 20a29c7 | 2016-10-13 18:36:50 -0400 | [diff] [blame] | 142 | %prep |
Thomas F Herbert | b42b77b | 2018-04-06 15:13:41 -0400 | [diff] [blame] | 143 | %setup -q -n %{name}-%{_version} |
Thomas F Herbert | 20a29c7 | 2016-10-13 18:36:50 -0400 | [diff] [blame] | 144 | |
Ed Warnicke | ec6290a | 2016-06-08 17:15:08 -0500 | [diff] [blame] | 145 | %pre |
| 146 | # Add the vpp group |
Ed Warnicke | b10427e | 2016-06-08 19:49:40 -0500 | [diff] [blame] | 147 | groupadd -f -r vpp |
Ed Warnicke | ec6290a | 2016-06-08 17:15:08 -0500 | [diff] [blame] | 148 | |
Ole Troan | c60f557 | 2017-03-17 09:54:51 +0100 | [diff] [blame] | 149 | %build |
Thomas F Herbert | 6eb6163 | 2018-11-27 15:57:30 -0500 | [diff] [blame] | 150 | %if 0%{?rhel} |
| 151 | . /opt/rh/devtoolset-7/enable |
| 152 | %endif |
Thomas F Herbert | 4b0ac82 | 2017-08-29 16:07:51 -0400 | [diff] [blame] | 153 | %if %{with aesni} |
| 154 | make bootstrap |
| 155 | make -C build-root PLATFORM=vpp TAG=%{_vpp_tag} install-packages |
| 156 | %else |
| 157 | make bootstrap AESNI=n |
| 158 | make -C build-root PLATFORM=vpp AESNI=n TAG=%{_vpp_tag} install-packages |
| 159 | %endif |
Ole Troan | c60f557 | 2017-03-17 09:54:51 +0100 | [diff] [blame] | 160 | cd %{_mu_build_dir}/../src/vpp-api/python && %py2_build |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 161 | cd %{_mu_build_dir}/../extras/selinux && make -f %{_datadir}/selinux/devel/Makefile |
Ole Troan | c60f557 | 2017-03-17 09:54:51 +0100 | [diff] [blame] | 162 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 163 | %install |
| 164 | # |
| 165 | # binaries |
| 166 | # |
| 167 | mkdir -p -m755 %{buildroot}%{_bindir} |
| 168 | mkdir -p -m755 %{buildroot}%{_unitdir} |
Gabriel Ganne | 714968b | 2017-01-26 15:42:39 +0100 | [diff] [blame] | 169 | install -p -m 755 %{_mu_build_dir}/%{_vpp_install_dir}/vpp/bin/* %{buildroot}%{_bindir} |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 170 | |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 171 | # api |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 172 | mkdir -p -m755 %{buildroot}/usr/share/vpp/api |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 173 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 174 | # |
| 175 | # configs |
| 176 | # |
| 177 | mkdir -p -m755 %{buildroot}/etc/vpp |
Miroslav Miklus | 8e08e74 | 2016-10-11 13:35:26 +0200 | [diff] [blame] | 178 | mkdir -p -m755 %{buildroot}/etc/sysctl.d |
Thomas F Herbert | 5b75b6b | 2017-07-23 17:21:46 -0400 | [diff] [blame] | 179 | install -p -m 644 %{_mu_build_dir}/../extras/rpm/vpp.service %{buildroot}%{_unitdir} |
Damjan Marion | d0f673e | 2017-01-31 17:29:33 +0100 | [diff] [blame] | 180 | install -p -m 644 %{_mu_build_dir}/../src/vpp/conf/startup.conf %{buildroot}/etc/vpp/startup.conf |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 181 | install -p -m 644 %{_mu_build_dir}/../src/vpp/conf/80-vpp.conf %{buildroot}/etc/sysctl.d |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 182 | # |
| 183 | # libraries |
| 184 | # |
| 185 | mkdir -p -m755 %{buildroot}%{_libdir} |
Padraig Connolly | 69915cb | 2017-01-10 17:10:39 +0000 | [diff] [blame] | 186 | mkdir -p -m755 %{buildroot}/etc/bash_completion.d |
| 187 | mkdir -p -m755 %{buildroot}/usr/share/vpp |
Matthew Smith | d790c7e | 2018-09-06 10:59:49 -0500 | [diff] [blame] | 188 | for file in $(find %{_mu_build_dir}/%{_vpp_install_dir}/*/lib* -type f -name '*.so.*.*' -print ) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 189 | do |
| 190 | install -p -m 755 $file %{buildroot}%{_libdir} |
| 191 | done |
| 192 | for file in $(cd %{buildroot}%{_libdir} && find . -type f -print | sed -e 's/^\.\///') |
| 193 | do |
| 194 | # make lib symlinks |
| 195 | ( cd %{buildroot}%{_libdir} && |
| 196 | ln -fs $file $(echo $file | sed -e 's/\(\.so\.[0-9]\+\).*/\1/') ) |
Ed Warnicke | f5a0e73 | 2016-09-07 17:12:52 +0000 | [diff] [blame] | 197 | ( cd %{buildroot}%{_libdir} && |
| 198 | ln -fs $file $(echo $file | sed -e 's/\(\.so\)\.[0-9]\+.*/\1/') ) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 199 | done |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 200 | for file in $(find %{_mu_build_dir}/%{_vpp_install_dir}/vpp/share/vpp/api -type f -name '*.api.json' -print ) |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 201 | do |
| 202 | install -p -m 644 $file %{buildroot}/usr/share/vpp/api |
| 203 | done |
Ed Warnicke | 406ab9d | 2016-08-31 18:48:47 -0700 | [diff] [blame] | 204 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 205 | # Lua bindings |
| 206 | mkdir -p -m755 %{buildroot}/usr/share/doc/vpp/examples/lua/examples/cli |
| 207 | mkdir -p -m755 %{buildroot}/usr/share/doc/vpp/examples/lua/examples/lute |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 208 | # for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/vpp-api/lua && git ls-files .) |
| 209 | for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/vpp-api/lua && find . -type f -regex '.*/*.[luteamd]' -print | sed -e 's/^\.\///') |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 210 | do |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 211 | ( cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/vpp-api/lua && install -p -m 644 $file \ |
| 212 | %{buildroot}/usr/share/doc/vpp/examples/lua/$file ) |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 213 | done |
| 214 | |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 215 | # Python bindings |
Ole Troan | c60f557 | 2017-03-17 09:54:51 +0100 | [diff] [blame] | 216 | cd %{_mu_build_dir}/../src/vpp-api/python && %py2_install |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 217 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 218 | # SELinux Policy |
| 219 | # Install SELinux interfaces |
| 220 | %_format INTERFACES %{_mu_build_dir}/../extras/selinux/$x.if |
| 221 | install -d %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype} |
| 222 | install -p -m 644 $INTERFACES \ |
| 223 | %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype} |
| 224 | |
| 225 | # Install policy modules |
| 226 | %_format MODULES %{_mu_build_dir}/../extras/selinux/$x.pp |
| 227 | install -d %{buildroot}%{_datadir}/selinux/packages |
| 228 | install -m 0644 $MODULES \ |
| 229 | %{buildroot}%{_datadir}/selinux/packages |
| 230 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 231 | # |
| 232 | # devel |
| 233 | # |
Thomas F Herbert | 20a29c7 | 2016-10-13 18:36:50 -0400 | [diff] [blame] | 234 | for dir in $(find %{_mu_build_dir}/%{_vpp_install_dir}/*/include/ -maxdepth 0 -type d -print | grep -v dpdk) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 235 | do |
| 236 | for subdir in $(cd ${dir} && find . -type d -print) |
| 237 | do |
| 238 | mkdir -p -m755 %{buildroot}/usr/include/${subdir} |
| 239 | done |
| 240 | for file in $(cd ${dir} && find . -type f -print) |
| 241 | do |
| 242 | install -p -m 644 $dir/$file %{buildroot}%{_includedir}/$file |
| 243 | done |
| 244 | done |
Ed Warnicke | 406ab9d | 2016-08-31 18:48:47 -0700 | [diff] [blame] | 245 | |
Paul Vinciguerra | 9ce6a21 | 2018-09-12 13:40:13 -0700 | [diff] [blame] | 246 | install -p -m 644 %{_mu_build_dir}/../src/tools/vppapigen/vppapigen_c.py %{buildroot}/usr/share/vpp |
| 247 | install -p -m 644 %{_mu_build_dir}/../src/tools/vppapigen/vppapigen_json.py %{buildroot}/usr/share/vpp |
Jon Loeliger | 190282c | 2018-01-31 09:45:11 -0600 | [diff] [blame] | 248 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 249 | # sample plugin |
| 250 | mkdir -p -m755 %{buildroot}/usr/share/doc/vpp/examples/sample-plugin/sample |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 251 | #for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/examples/sample-plugin && git ls-files .) |
| 252 | for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/examples/sample-plugin && find . -type f -regex '.*/*.[acdhimp]' -print | sed -e 's/^\.\///') |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 253 | do |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 254 | ( cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/examples/sample-plugin && install -p -m 644 $file \ |
| 255 | %{buildroot}/usr/share/doc/vpp/examples/sample-plugin/$file ) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 256 | done |
| 257 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 258 | # vppctl sockfile directory |
| 259 | mkdir -p -m755 %{buildroot}%{_localstatedir}/run/vpp |
| 260 | # vpp.log directory |
| 261 | mkdir -p -m755 %{buildroot}%{_localstatedir}/log/vpp |
Ed Warnicke | f5a1436 | 2016-09-12 20:40:24 +0000 | [diff] [blame] | 262 | |
| 263 | # |
| 264 | # vpp-plugins |
Damjan Marion | 79dcbc7 | 2018-09-12 14:01:10 +0200 | [diff] [blame] | 265 | # |
Ed Warnicke | e7637e7 | 2016-09-14 16:58:33 -0700 | [diff] [blame] | 266 | mkdir -p -m755 %{buildroot}/usr/lib/vpp_plugins |
| 267 | mkdir -p -m755 %{buildroot}/usr/lib/vpp_api_test_plugins |
Damjan Marion | 79dcbc7 | 2018-09-12 14:01:10 +0200 | [diff] [blame] | 268 | for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib/vpp_plugins && find -type f -print) |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 269 | do |
Damjan Marion | 79dcbc7 | 2018-09-12 14:01:10 +0200 | [diff] [blame] | 270 | install -p -m 644 %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib/vpp_plugins/$file \ |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 271 | %{buildroot}/usr/lib/vpp_plugins/$file |
| 272 | done |
| 273 | |
Damjan Marion | 79dcbc7 | 2018-09-12 14:01:10 +0200 | [diff] [blame] | 274 | for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib/vpp_api_test_plugins && find -type f -print) |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 275 | do |
Damjan Marion | 79dcbc7 | 2018-09-12 14:01:10 +0200 | [diff] [blame] | 276 | install -p -m 644 %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib/vpp_api_test_plugins/$file \ |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 277 | %{buildroot}/usr/lib/vpp_api_test_plugins/$file |
| 278 | done |
| 279 | |
Mohsin Kazmi | 7b2017d | 2018-09-26 10:49:41 +0200 | [diff] [blame] | 280 | for file in $(find %{_mu_build_dir}/%{_vpp_install_dir}/vpp/share/vpp/api/plugins -type f -name '*.api.json' -print ) |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 281 | do |
| 282 | install -p -m 644 $file %{buildroot}/usr/share/vpp/api |
| 283 | done |
| 284 | |
Damjan Marion | a1bd023 | 2016-12-19 19:08:11 +0100 | [diff] [blame] | 285 | # |
| 286 | # remove RPATH from ELF binaries |
| 287 | # |
| 288 | %{_mu_build_dir}/scripts/remove-rpath %{buildroot} |
| 289 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 290 | %post |
Kristina Nevolnikova | 8ae1873 | 2017-06-21 14:20:42 +0200 | [diff] [blame] | 291 | if [ $1 -eq 1 ] ; then |
| 292 | sysctl --system |
| 293 | fi |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 294 | %systemd_post vpp.service |
| 295 | |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 296 | %preun |
| 297 | %systemd_preun vpp.service |
| 298 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 299 | %post selinux-policy |
| 300 | %_format MODULES %{_datadir}/selinux/packages/$x.pp |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 301 | if %{_sbindir}/selinuxenabled ; then |
Matthew Smith | 7c172cb | 2018-02-22 21:12:11 -0600 | [diff] [blame] | 302 | %{_sbindir}/semodule -n -X 400 -s %{selinuxtype} -i $MODULES |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 303 | %{_sbindir}/load_policy |
| 304 | %relabel_files |
| 305 | fi |
| 306 | |
| 307 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 308 | %postun |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 309 | %systemd_postun |
Kristina Nevolnikova | 8ae1873 | 2017-06-21 14:20:42 +0200 | [diff] [blame] | 310 | if [ $1 -eq 0 ] ; then |
| 311 | echo "Uninstalling, unbind user-mode PCI drivers" |
| 312 | # Unbind user-mode PCI drivers |
| 313 | removed= |
| 314 | pci_dirs=`find /sys/bus/pci/drivers -type d -name igb_uio -o -name uio_pci_generic -o -name vfio-pci` |
| 315 | for d in $pci_dirs; do |
| 316 | for f in ${d}/*; do |
| 317 | [ -e "${f}/config" ] || continue |
| 318 | echo ${f##*/} > ${d}/unbind |
| 319 | basename `dirname ${f}` | xargs echo -n "Removing driver"; echo " for PCI ID" `basename ${f}` |
| 320 | removed=y |
| 321 | done |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 322 | done |
Kristina Nevolnikova | 8ae1873 | 2017-06-21 14:20:42 +0200 | [diff] [blame] | 323 | if [ -n "${removed}" ]; then |
| 324 | echo "There are changes in PCI drivers, rescaning" |
| 325 | echo 1 > /sys/bus/pci/rescan |
| 326 | else |
| 327 | echo "There weren't PCI devices binded" |
| 328 | fi |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 329 | else |
Kristina Nevolnikova | 8ae1873 | 2017-06-21 14:20:42 +0200 | [diff] [blame] | 330 | echo "Upgrading package, dont' unbind interfaces" |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 331 | fi |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 332 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 333 | %postun selinux-policy |
| 334 | if [ $1 -eq 0 ]; then |
| 335 | %{_sbindir}/semodule -n -r %{modulenames} |
| 336 | if %{_sbindir}/selinuxenabled ; then |
| 337 | %{_sbindir}/load_policy |
| 338 | %relabel_files |
| 339 | fi |
| 340 | fi |
| 341 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 342 | %files |
| 343 | %defattr(-,bin,bin) |
| 344 | %{_unitdir}/vpp.service |
Damjan Marion | 08ff7e0 | 2016-01-20 13:45:36 +0100 | [diff] [blame] | 345 | /usr/bin/vpp* |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 346 | /usr/bin/svm* |
Dave Barach | 0e5e3c3 | 2016-01-25 08:28:22 -0500 | [diff] [blame] | 347 | /usr/bin/elftool |
Billy McFall | ce41a5c | 2017-09-08 20:11:58 +0000 | [diff] [blame] | 348 | %config(noreplace) /etc/sysctl.d/80-vpp.conf |
| 349 | %config(noreplace) /etc/vpp/startup.conf |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 350 | /usr/share/vpp/api/* |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 351 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 352 | %defattr(-,root,vpp) |
| 353 | %{_localstatedir}/run/vpp* |
| 354 | |
| 355 | %defattr(-,root,root) |
| 356 | %{_localstatedir}/log/vpp* |
| 357 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 358 | %files lib |
| 359 | %defattr(-,bin,bin) |
Igor Mikhailov (imichail) | 3b854a5 | 2018-05-18 20:08:26 -0700 | [diff] [blame] | 360 | %global __requires_exclude_from %{_libdir}/librte_pmd_mlx[45]_glue\\.so.*$ |
Ed Warnicke | f5a1436 | 2016-09-12 20:40:24 +0000 | [diff] [blame] | 361 | %exclude %{_libdir}/vpp_plugins |
| 362 | %exclude %{_libdir}/vpp_api_test_plugins |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 363 | %{_libdir}/* |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 364 | /usr/share/vpp/api/* |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 365 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 366 | %files api-lua |
Gabriel Ganne | f3854e9 | 2017-01-17 10:00:54 +0100 | [diff] [blame] | 367 | %defattr(644,root,root,644) |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 368 | /usr/share/doc/vpp/examples/lua |
| 369 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 370 | %files api-python |
Onong Tayeng | 9b0ce02 | 2018-11-23 15:33:41 +0530 | [diff] [blame] | 371 | %defattr(644,root,root,755) |
Ole Troan | a7564e8 | 2018-06-12 21:06:44 +0200 | [diff] [blame] | 372 | %{python2_sitelib}/vpp_* |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 373 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 374 | %files selinux-policy |
| 375 | %defattr(-,root,root,0755) |
| 376 | %attr(0644,root,root) %{_datadir}/selinux/packages/*.pp |
| 377 | %attr(0644,root,root) %{_datadir}/selinux/devel/include/%{moduletype}/*.if |
| 378 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 379 | %files devel |
| 380 | %defattr(-,bin,bin) |
| 381 | /usr/bin/vppapigen |
| 382 | %{_includedir}/* |
| 383 | /usr/share/doc/vpp/examples/sample-plugin |
Ole Troan | 9d42087 | 2017-10-12 13:06:35 +0200 | [diff] [blame] | 384 | /usr/share/vpp |
Ed Warnicke | 406ab9d | 2016-08-31 18:48:47 -0700 | [diff] [blame] | 385 | |
Ed Warnicke | f5a1436 | 2016-09-12 20:40:24 +0000 | [diff] [blame] | 386 | %files plugins |
| 387 | %defattr(-,bin,bin) |
Ed Warnicke | e7637e7 | 2016-09-14 16:58:33 -0700 | [diff] [blame] | 388 | /usr/lib/vpp_plugins/* |
| 389 | /usr/lib/vpp_api_test_plugins/* |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 390 | /usr/share/vpp/api/* |