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