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