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 |
Thomas F Herbert | 20a29c7 | 2016-10-13 18:36:50 -0400 | [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 |
Padraig Connolly | 69915cb | 2017-01-10 17:10:39 +0000 | [diff] [blame] | 211 | install -p -m 644 %{_mu_build_dir}/../src/scripts/vppctl_completion %{buildroot}/etc/bash_completion.d |
| 212 | install -p -m 644 %{_mu_build_dir}/../src/scripts/vppctl-cmd-list %{buildroot}/usr/share/vpp |
Ed Warnicke | 406ab9d | 2016-08-31 18:48:47 -0700 | [diff] [blame] | 213 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 214 | # Lua bindings |
| 215 | mkdir -p -m755 %{buildroot}/usr/share/doc/vpp/examples/lua/examples/cli |
| 216 | 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] | 217 | # for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/vpp-api/lua && git ls-files .) |
| 218 | 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] | 219 | do |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 220 | ( cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/vpp-api/lua && install -p -m 644 $file \ |
| 221 | %{buildroot}/usr/share/doc/vpp/examples/lua/$file ) |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 222 | done |
| 223 | |
| 224 | # Java bindings |
| 225 | mkdir -p -m755 %{buildroot}/usr/share/java |
| 226 | for file in $(find %{_mu_build_dir}/%{_vpp_install_dir}/vpp/share/java -type f -name '*.jar' -print ) |
| 227 | do |
| 228 | install -p -m 644 $file %{buildroot}/usr/share/java |
| 229 | done |
| 230 | |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 231 | # Python bindings |
Ole Troan | c60f557 | 2017-03-17 09:54:51 +0100 | [diff] [blame] | 232 | cd %{_mu_build_dir}/../src/vpp-api/python && %py2_install |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 233 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 234 | # SELinux Policy |
| 235 | # Install SELinux interfaces |
| 236 | %_format INTERFACES %{_mu_build_dir}/../extras/selinux/$x.if |
| 237 | install -d %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype} |
| 238 | install -p -m 644 $INTERFACES \ |
| 239 | %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype} |
| 240 | |
| 241 | # Install policy modules |
| 242 | %_format MODULES %{_mu_build_dir}/../extras/selinux/$x.pp |
| 243 | install -d %{buildroot}%{_datadir}/selinux/packages |
| 244 | install -m 0644 $MODULES \ |
| 245 | %{buildroot}%{_datadir}/selinux/packages |
| 246 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 247 | # |
| 248 | # devel |
| 249 | # |
Thomas F Herbert | 20a29c7 | 2016-10-13 18:36:50 -0400 | [diff] [blame] | 250 | 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] | 251 | do |
| 252 | for subdir in $(cd ${dir} && find . -type d -print) |
| 253 | do |
| 254 | mkdir -p -m755 %{buildroot}/usr/include/${subdir} |
| 255 | done |
| 256 | for file in $(cd ${dir} && find . -type f -print) |
| 257 | do |
| 258 | install -p -m 644 $dir/$file %{buildroot}%{_includedir}/$file |
| 259 | done |
| 260 | done |
Ed Warnicke | 406ab9d | 2016-08-31 18:48:47 -0700 | [diff] [blame] | 261 | |
| 262 | mkdir -p -m755 %{buildroot}%{python2_sitelib}/jvppgen |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 263 | install -p -m755 %{_mu_build_dir}/../src/vpp-api/java/jvpp/gen/jvpp_gen.py %{buildroot}/usr/bin |
| 264 | for i in $(ls %{_mu_build_dir}/../src/vpp-api/java/jvpp/gen/jvppgen/*.py); do |
Ed Warnicke | 406ab9d | 2016-08-31 18:48:47 -0700 | [diff] [blame] | 265 | install -p -m666 ${i} %{buildroot}%{python2_sitelib}/jvppgen |
| 266 | done; |
| 267 | |
Jon Loeliger | 190282c | 2018-01-31 09:45:11 -0600 | [diff] [blame] | 268 | install -p -m 644 %{_mu_build_dir}/../src/tools/vppapigen/C.py %{buildroot}/usr/share/vpp |
| 269 | install -p -m 644 %{_mu_build_dir}/../src/tools/vppapigen/JSON.py %{buildroot}/usr/share/vpp |
| 270 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 271 | # sample plugin |
| 272 | 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] | 273 | #for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/examples/sample-plugin && git ls-files .) |
| 274 | 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] | 275 | do |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 276 | ( cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/examples/sample-plugin && install -p -m 644 $file \ |
| 277 | %{buildroot}/usr/share/doc/vpp/examples/sample-plugin/$file ) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 278 | done |
| 279 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 280 | # vppctl sockfile directory |
| 281 | mkdir -p -m755 %{buildroot}%{_localstatedir}/run/vpp |
| 282 | # vpp.log directory |
| 283 | mkdir -p -m755 %{buildroot}%{_localstatedir}/log/vpp |
Ed Warnicke | f5a1436 | 2016-09-12 20:40:24 +0000 | [diff] [blame] | 284 | |
| 285 | # |
| 286 | # vpp-plugins |
| 287 | # |
Ed Warnicke | e7637e7 | 2016-09-14 16:58:33 -0700 | [diff] [blame] | 288 | mkdir -p -m755 %{buildroot}/usr/lib/vpp_plugins |
| 289 | mkdir -p -m755 %{buildroot}/usr/lib/vpp_api_test_plugins |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 290 | for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib64/vpp_plugins && find -type f -print) |
| 291 | do |
| 292 | install -p -m 644 %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib64/vpp_plugins/$file \ |
| 293 | %{buildroot}/usr/lib/vpp_plugins/$file |
| 294 | done |
| 295 | |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 296 | for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib64/vpp_api_test_plugins && find -type f -print) |
| 297 | do |
| 298 | install -p -m 644 %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib64/vpp_api_test_plugins/$file \ |
| 299 | %{buildroot}/usr/lib/vpp_api_test_plugins/$file |
| 300 | done |
| 301 | |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 302 | for file in $(find %{_mu_build_dir}/%{_vpp_install_dir}/plugins -type f -name '*.api.json' -print ) |
| 303 | do |
| 304 | install -p -m 644 $file %{buildroot}/usr/share/vpp/api |
| 305 | done |
| 306 | |
Damjan Marion | a1bd023 | 2016-12-19 19:08:11 +0100 | [diff] [blame] | 307 | # |
| 308 | # remove RPATH from ELF binaries |
| 309 | # |
| 310 | %{_mu_build_dir}/scripts/remove-rpath %{buildroot} |
| 311 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 312 | %post |
Kristina Nevolnikova | 8ae1873 | 2017-06-21 14:20:42 +0200 | [diff] [blame] | 313 | if [ $1 -eq 1 ] ; then |
| 314 | sysctl --system |
| 315 | fi |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 316 | %systemd_post vpp.service |
| 317 | |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 318 | %preun |
| 319 | %systemd_preun vpp.service |
| 320 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 321 | %post selinux-policy |
| 322 | %_format MODULES %{_datadir}/selinux/packages/$x.pp |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 323 | if %{_sbindir}/selinuxenabled ; then |
Matthew Smith | 7c172cb | 2018-02-22 21:12:11 -0600 | [diff] [blame] | 324 | %{_sbindir}/semodule -n -X 400 -s %{selinuxtype} -i $MODULES |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 325 | %{_sbindir}/load_policy |
| 326 | %relabel_files |
| 327 | fi |
| 328 | |
| 329 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 330 | %postun |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 331 | %systemd_postun |
Kristina Nevolnikova | 8ae1873 | 2017-06-21 14:20:42 +0200 | [diff] [blame] | 332 | if [ $1 -eq 0 ] ; then |
| 333 | echo "Uninstalling, unbind user-mode PCI drivers" |
| 334 | # Unbind user-mode PCI drivers |
| 335 | removed= |
| 336 | pci_dirs=`find /sys/bus/pci/drivers -type d -name igb_uio -o -name uio_pci_generic -o -name vfio-pci` |
| 337 | for d in $pci_dirs; do |
| 338 | for f in ${d}/*; do |
| 339 | [ -e "${f}/config" ] || continue |
| 340 | echo ${f##*/} > ${d}/unbind |
| 341 | basename `dirname ${f}` | xargs echo -n "Removing driver"; echo " for PCI ID" `basename ${f}` |
| 342 | removed=y |
| 343 | done |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 344 | done |
Kristina Nevolnikova | 8ae1873 | 2017-06-21 14:20:42 +0200 | [diff] [blame] | 345 | if [ -n "${removed}" ]; then |
| 346 | echo "There are changes in PCI drivers, rescaning" |
| 347 | echo 1 > /sys/bus/pci/rescan |
| 348 | else |
| 349 | echo "There weren't PCI devices binded" |
| 350 | fi |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 351 | else |
Kristina Nevolnikova | 8ae1873 | 2017-06-21 14:20:42 +0200 | [diff] [blame] | 352 | echo "Upgrading package, dont' unbind interfaces" |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 353 | fi |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 354 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 355 | %postun selinux-policy |
| 356 | if [ $1 -eq 0 ]; then |
| 357 | %{_sbindir}/semodule -n -r %{modulenames} |
| 358 | if %{_sbindir}/selinuxenabled ; then |
| 359 | %{_sbindir}/load_policy |
| 360 | %relabel_files |
| 361 | fi |
| 362 | fi |
| 363 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 364 | %files |
| 365 | %defattr(-,bin,bin) |
| 366 | %{_unitdir}/vpp.service |
Damjan Marion | 08ff7e0 | 2016-01-20 13:45:36 +0100 | [diff] [blame] | 367 | /usr/bin/vpp* |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 368 | /usr/bin/svm* |
Dave Barach | 0e5e3c3 | 2016-01-25 08:28:22 -0500 | [diff] [blame] | 369 | /usr/bin/elftool |
Billy McFall | ce41a5c | 2017-09-08 20:11:58 +0000 | [diff] [blame] | 370 | %config(noreplace) /etc/sysctl.d/80-vpp.conf |
| 371 | %config(noreplace) /etc/vpp/startup.conf |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 372 | /usr/share/vpp/api/* |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 373 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 374 | %defattr(-,root,vpp) |
| 375 | %{_localstatedir}/run/vpp* |
| 376 | |
| 377 | %defattr(-,root,root) |
| 378 | %{_localstatedir}/log/vpp* |
| 379 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 380 | %files lib |
| 381 | %defattr(-,bin,bin) |
Igor Mikhailov (imichail) | 3b854a5 | 2018-05-18 20:08:26 -0700 | [diff] [blame] | 382 | %global __requires_exclude_from %{_libdir}/librte_pmd_mlx[45]_glue\\.so.*$ |
Ed Warnicke | f5a1436 | 2016-09-12 20:40:24 +0000 | [diff] [blame] | 383 | %exclude %{_libdir}/vpp_plugins |
| 384 | %exclude %{_libdir}/vpp_api_test_plugins |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 385 | %{_libdir}/* |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 386 | /usr/share/vpp/api/* |
Padraig Connolly | 69915cb | 2017-01-10 17:10:39 +0000 | [diff] [blame] | 387 | /etc/bash_completion.d/vppctl_completion |
| 388 | /usr/share/vpp/vppctl-cmd-list |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 389 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 390 | %files api-lua |
Gabriel Ganne | f3854e9 | 2017-01-17 10:00:54 +0100 | [diff] [blame] | 391 | %defattr(644,root,root,644) |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 392 | /usr/share/doc/vpp/examples/lua |
| 393 | |
| 394 | %files api-java |
| 395 | %defattr(644,root,root) |
| 396 | /usr/share/java/* |
| 397 | |
| 398 | %files api-python |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 399 | %defattr(644,root,root) |
Ole Trøan | 61debaa | 2018-06-18 18:30:09 +0000 | [diff] [blame^] | 400 | %{python2_sitelib}/vpp_papi* |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 401 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 402 | %files selinux-policy |
| 403 | %defattr(-,root,root,0755) |
| 404 | %attr(0644,root,root) %{_datadir}/selinux/packages/*.pp |
| 405 | %attr(0644,root,root) %{_datadir}/selinux/devel/include/%{moduletype}/*.if |
| 406 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 407 | %files devel |
| 408 | %defattr(-,bin,bin) |
| 409 | /usr/bin/vppapigen |
Ed Warnicke | 406ab9d | 2016-08-31 18:48:47 -0700 | [diff] [blame] | 410 | /usr/bin/jvpp_gen.py |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 411 | %{_includedir}/* |
Ed Warnicke | 406ab9d | 2016-08-31 18:48:47 -0700 | [diff] [blame] | 412 | %{python2_sitelib}/jvppgen/* |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 413 | /usr/share/doc/vpp/examples/sample-plugin |
Ole Troan | 9d42087 | 2017-10-12 13:06:35 +0200 | [diff] [blame] | 414 | /usr/share/vpp |
Ed Warnicke | 406ab9d | 2016-08-31 18:48:47 -0700 | [diff] [blame] | 415 | |
Ed Warnicke | f5a1436 | 2016-09-12 20:40:24 +0000 | [diff] [blame] | 416 | %files plugins |
| 417 | %defattr(-,bin,bin) |
Ed Warnicke | e7637e7 | 2016-09-14 16:58:33 -0700 | [diff] [blame] | 418 | /usr/lib/vpp_plugins/* |
| 419 | /usr/lib/vpp_api_test_plugins/* |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 420 | /usr/share/vpp/api/* |