diff options
author | 2017-03-29 01:15:02 -0400 | |
---|---|---|
committer | 2017-03-29 02:23:59 -0400 | |
commit | a23197980e40d4d9414bcfaf59005a1dc2a89251 (patch) | |
tree | da3fc5410a9cda99e05d2e0f6dae06072a0c50b8 /vpp/build-root/scripts | |
parent | 746b57564deede624261ab8a96c94f562f24d22c (diff) |
Added vpp intial source code from master branch 17.01.1
Change-Id: I81bdace6f330825a1746a853766779dfb24765fd
Signed-off-by: sreejith <sreejith.surendrannair@linaro.org>
Diffstat (limited to 'vpp/build-root/scripts')
-rwxr-xr-x | vpp/build-root/scripts/checkstyle.sh | 92 | ||||
-rwxr-xr-x | vpp/build-root/scripts/csit-test-branch | 2 | ||||
-rwxr-xr-x | vpp/build-root/scripts/find-api-core-contents | 9 | ||||
-rwxr-xr-x | vpp/build-root/scripts/find-api-lib-contents | 6 | ||||
-rwxr-xr-x | vpp/build-root/scripts/find-dev-contents | 31 | ||||
-rwxr-xr-x | vpp/build-root/scripts/find-dpdk-contents | 29 | ||||
-rwxr-xr-x | vpp/build-root/scripts/find-plugins-contents | 15 | ||||
-rwxr-xr-x | vpp/build-root/scripts/find-python-api-contents | 8 | ||||
-rwxr-xr-x | vpp/build-root/scripts/generate-deb-changelog | 37 | ||||
-rwxr-xr-x | vpp/build-root/scripts/lsnet | 20 | ||||
-rwxr-xr-x | vpp/build-root/scripts/make-plugin-toolkit | 40 | ||||
-rwxr-xr-x | vpp/build-root/scripts/pci-nic-bind | 94 | ||||
-rwxr-xr-x | vpp/build-root/scripts/pci-nic-bind-to-kernel | 19 | ||||
-rwxr-xr-x | vpp/build-root/scripts/remove-rpath | 24 | ||||
-rwxr-xr-x | vpp/build-root/scripts/verdist | 31 | ||||
-rwxr-xr-x | vpp/build-root/scripts/version | 54 |
16 files changed, 511 insertions, 0 deletions
diff --git a/vpp/build-root/scripts/checkstyle.sh b/vpp/build-root/scripts/checkstyle.sh new file mode 100755 index 00000000..60129676 --- /dev/null +++ b/vpp/build-root/scripts/checkstyle.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +VPP_DIR=`dirname $0`/../../ +EXIT_CODE=0 +FIX="0" +FULL="0" +CHECKSTYLED_FILES="" +UNCHECKSTYLED_FILES="" + +# If the user provides --fix, then actually fix things +# Note: this is meant for use outside of the CI Jobs, by users cleaning things up + +while true; do + case ${1} in + --fix) + FIX="1" + ;; + --full) + FULL="1" + ;; + esac + shift || break +done + +if [ "${FULL}" == "1" ]; then + FILELIST=$(git ls-tree -r HEAD --name-only) +else + FILELIST=$((git diff HEAD~1.. --name-only; git ls-files -m ) | sort -u) +fi + +# Check to make sure we have indent. Exit if we don't with an error message, but +# don't *fail*. +command -v indent > /dev/null +if [ $? != 0 ]; then + echo "Cound not find required commend \"indent\". Checkstyle aborted" + exit ${EXIT_CODE} +fi +indent --version + +cd ${VPP_DIR} +git status +for i in ${FILELIST}; do + if [ -f ${i} ] && [ ${i} != "build-root/scripts/checkstyle.sh" ] && [ ${i} != "build-root/emacs-lisp/fix-coding-style.el" ]; then + grep -q "fd.io coding-style-patch-verification: ON" ${i} + if [ $? == 0 ]; then + CHECKSTYLED_FILES="${CHECKSTYLED_FILES} ${i}" + if [ ${FIX} == 0 ]; then + indent ${i} -o ${i}.out1 > /dev/null 2>&1 + indent ${i}.out1 -o ${i}.out2 > /dev/null 2>&1 + # Remove trailing whitespace + sed -i -e 's/[[:space:]]*$//' ${i}.out2 + diff -q ${i} ${i}.out2 + else + indent ${i} + indent ${i} + # Remove trailing whitespace + sed -i -e 's/[[:space:]]*$//' ${i} + fi + if [ $? != 0 ]; then + EXIT_CODE=1 + echo + echo "Checkstyle failed for ${i}." + echo "Run indent (twice!) as shown to fix the problem:" + echo "indent ${VPP_DIR}${i}" + echo "indent ${VPP_DIR}${i}" + fi + if [ -f ${i}.out1 ]; then + rm ${i}.out1 + fi + if [ -f ${i}.out2 ]; then + rm ${i}.out2 + fi + else + UNCHECKSTYLED_FILES="${UNCHECKSTYLED_FILES} ${i}" + fi + else + UNCHECKSTYLED_FILES="${UNCHECKSTYLED_FILES} ${i}" + fi +done + +if [ ${EXIT_CODE} == 0 ]; then + echo "*******************************************************************" + echo "* VPP CHECKSTYLE SUCCESSFULLY COMPLETED" + echo "*******************************************************************" +else + echo "*******************************************************************" + echo "* VPP CHECKSTYLE FAILED" + echo "* CONSULT FAILURE LOG ABOVE" + echo "* NOTE: Running 'build-root/scripts/checkstyle.sh --fix' *MAY* fix the issue" + echo "*******************************************************************" +fi +exit ${EXIT_CODE} diff --git a/vpp/build-root/scripts/csit-test-branch b/vpp/build-root/scripts/csit-test-branch new file mode 100755 index 00000000..ede63372 --- /dev/null +++ b/vpp/build-root/scripts/csit-test-branch @@ -0,0 +1,2 @@ +#!/bin/sh +echo oper-rls1701-170115 diff --git a/vpp/build-root/scripts/find-api-core-contents b/vpp/build-root/scripts/find-api-core-contents new file mode 100755 index 00000000..f1f96f1f --- /dev/null +++ b/vpp/build-root/scripts/find-api-core-contents @@ -0,0 +1,9 @@ +#!/bin/bash + +for i in $(find ${1}/vpp -name *.api.json -type f -print); do + echo ../${i} /usr/share/vpp/api/ >> ${2} +done +for i in $(find ${1}/vlib-api -name *.api.json -type f -print); do + echo ../${i} /usr/share/vpp/api/ >> ${2} +done + diff --git a/vpp/build-root/scripts/find-api-lib-contents b/vpp/build-root/scripts/find-api-lib-contents new file mode 100755 index 00000000..562db7b8 --- /dev/null +++ b/vpp/build-root/scripts/find-api-lib-contents @@ -0,0 +1,6 @@ +#!/bin/bash + +for i in $(find ${1}/vnet -name *.api.json -type f -print); do + echo ../${i} /usr/share/vpp/api/ >> ${2} +done + diff --git a/vpp/build-root/scripts/find-dev-contents b/vpp/build-root/scripts/find-dev-contents new file mode 100755 index 00000000..2dc6cc4d --- /dev/null +++ b/vpp/build-root/scripts/find-dev-contents @@ -0,0 +1,31 @@ +#!/bin/bash + +# includes +paths=`find $1/*/include -type f -print | grep -v '/dpdk/include/'` +rm -f $2 + +for path in $paths +do + relpath=`echo $path | sed -e 's:.*/include/::'` + dir=`dirname $relpath` + if [ $dir = "." ] ; then + echo ../$path /usr/include >> $2 + else + echo ../$path /usr/include/$dir >> $2 + fi +done + +# sample plugin +paths=`(cd ..; find plugins/sample-plugin -type f -print | grep -v autom4te)` + +for path in $paths +do + relpath=`echo $path | sed -e 's:.*plugins/::'` + dir=`dirname $relpath` + if [ $dir = "sample-plugin" ] ; then + echo ../../$path /usr/share/doc/vpp/examples/plugins/sample-plugin >> $2 + else + echo ../../$path \ + /usr/share/doc/vpp/examples/plugins/$dir >> $2 + fi +done diff --git a/vpp/build-root/scripts/find-dpdk-contents b/vpp/build-root/scripts/find-dpdk-contents new file mode 100755 index 00000000..c7065139 --- /dev/null +++ b/vpp/build-root/scripts/find-dpdk-contents @@ -0,0 +1,29 @@ +#!/bin/bash + +# includes +rm -rf dpdk-includes +mkdir dpdk-includes +(cd $1/dpdk/include; tar cfh - . | (cd ../../../dpdk-includes; tar xf -)) + +# If CDPATH is set, the "Change Directory" builtin (cd) will output the +# destination directory when a relative path is passed as an argument. +# In this case, this has the negative side effect of polluting the "paths" +# variable with the destination directory, breaking the package generation. +# +# Patient: Doctor! Doctor! It hurts when I do this... +# Doctor: Don't do that! +# +unset CDPATH +paths=`cd dpdk-includes; find . -type f -print` +rm -f $2 + +for path in $paths +do + dir=`dirname $path` + if [ $dir = "." ] ; then + echo ../dpdk-includes/$path /usr/include/vpp-dpdk >> $2 + else + echo ../dpdk-includes/$path /usr/include/vpp-dpdk/$dir >> $2 + fi +done + diff --git a/vpp/build-root/scripts/find-plugins-contents b/vpp/build-root/scripts/find-plugins-contents new file mode 100755 index 00000000..a5a52acf --- /dev/null +++ b/vpp/build-root/scripts/find-plugins-contents @@ -0,0 +1,15 @@ +#!/bin/bash + +rm -f $2 + +for i in ${1}/plugins/lib64/vpp_plugins/*.so; do + echo ../${i} /usr/lib/vpp_plugins >> ${2} +done + +for i in ${1}/plugins/lib64/vpp_api_test_plugins/*.so; do + echo ../${i} /usr/lib/vpp_api_test_plugins >> ${2} +done + +for i in $(find ${1}/plugins -name *.api.json -type f -print); do + echo ../${i} /usr/share/vpp/api/ >> ${2} +done diff --git a/vpp/build-root/scripts/find-python-api-contents b/vpp/build-root/scripts/find-python-api-contents new file mode 100755 index 00000000..9b390e75 --- /dev/null +++ b/vpp/build-root/scripts/find-python-api-contents @@ -0,0 +1,8 @@ +#!/bin/bash + +rm -f $2 + +for i in $(find ${1}/vpp-api/lib/python2.7/site-packages/ -type f -print); do + echo ../${i} /usr/lib/python2.7/site-packages/vpp_papi >> ${2} +done + diff --git a/vpp/build-root/scripts/generate-deb-changelog b/vpp/build-root/scripts/generate-deb-changelog new file mode 100755 index 00000000..7bdc6337 --- /dev/null +++ b/vpp/build-root/scripts/generate-deb-changelog @@ -0,0 +1,37 @@ +#!/bin/bash + +CHANGELOG=deb/debian/changelog +DIST=unstable +FIRST=1 + +print_changelog_item() { + DATE=$(git log -1 --format=%cD ${TAG}) + DEBFULLNAME=$(git log -1 --format=%an ${TAG}) + DEBEMAIL=$(git log -1 --format=%ae ${TAG}) + + if [ ${FIRST} = 0 ]; then echo >> ${CHANGELOG}; fi + FIRST=0 + + echo "vpp (${VER}) ${DIST}; urgency=low" >> ${CHANGELOG} + echo >> ${CHANGELOG} + echo "${DESC}" >> ${CHANGELOG} + echo >> ${CHANGELOG} + echo " -- ${DEBFULLNAME} <${DEBEMAIL}> ${DATE}" >> ${CHANGELOG} +} + +VER=$(scripts/version) +TAG=HEAD +ADDS=$(echo ${VER} | sed -e 's/~.*//'| cut -s -d- -f2) + +rm -f ${CHANGELOG} + +if [ -n "${ADDS}" ]; then + DESC=" * includes ${ADDS} commits after $(echo ${VER}| cut -d- -f1) release" + print_changelog_item +fi + +for TAG in $(git tag -l 'v[0-9][0-9].[0-9][0-9]' | sort -r ); do + VER=$(echo ${TAG}| sed -e 's/^v//') + DESC=$(git tag -l -n20 ${TAG} | tail -n+2 | sed -e 's/^ */ /') + print_changelog_item +done diff --git a/vpp/build-root/scripts/lsnet b/vpp/build-root/scripts/lsnet new file mode 100755 index 00000000..ed590e53 --- /dev/null +++ b/vpp/build-root/scripts/lsnet @@ -0,0 +1,20 @@ +#!/bin/bash + +echo "PCI Address MAC address Device Name Driver State Speed Port Type" +echo "============ ================= ============== ========== ======== ========== ====================" + +for f in /sys/class/net/*; do + dev=$(basename ${f}) + if [ -e $f/device ] ; then + dev=$(basename ${f}) + pci_addr=$(basename $(readlink $f/device)) + mac=$(cat $f/address) + driver=$(basename $(readlink $f/device/driver)) + oper=$(cat $f/operstate) + speed=$(sudo ethtool $dev | grep Speed | cut -d" " -f2) + port=$(ethtool $dev 2> /dev/null | sed -ne 's/.*Port: \(.*\)/\1/p') + printf "%-12s %-14s %-14s %-10s %-8s %-10s %-20s\n" $pci_addr $mac $dev $driver $oper $speed "$port" + # ethtool $dev | grep Port: + fi +done + diff --git a/vpp/build-root/scripts/make-plugin-toolkit b/vpp/build-root/scripts/make-plugin-toolkit new file mode 100755 index 00000000..e1d6fcfb --- /dev/null +++ b/vpp/build-root/scripts/make-plugin-toolkit @@ -0,0 +1,40 @@ +#!/bin/bash + +set -eux + +build_tarball() { + for dir in vppinfra dpdk svm vlib-api vlib vnet vpp vpp-api-test + do + tar -C install-$1/$dir/include -cf - . | tar -C $tmp_dir/include -xf - + done + tar -C ../sample-plugin -cf - . \ + | tar -C $tmp_dir/src/sample-plugin -xf - + cp tools/bin/vppapigen $tmp_dir/tools/bin + echo Created by `id -u -n` on `hostname` at `date` > \ + $tmp_dir/toolkit-version-stamp + cp scripts/vpp-plugin-toolkit-readme $tmp_dir/README + tar -C $tmp_dir -zcf $PWD/vpp-plugin-toolkit-$1.tar.gz . +} + +if [ `basename $PWD` != "build-root" ] ; then + echo Please run this script from build-root + exit 1 +fi + +echo Pull additional tookit repos +make PLATFORM=vpp sample-plugin-find-source + +make PLATFORM=vpp TAG=vpp wipe-all +echo Build vpp forwarder production package +make PLATFORM=vpp TAG=vpp strip_sumbols=yes install-packages + +tmp_dir="`mktemp -d /tmp/plugin-XXXXXX`" +trap "rm -rf $tmp_dir" err + +echo Create vpp forwarder production plugin toolkit tarball +mkdir -p $tmp_dir/tools/bin $tmp_dir/include $tmp_dir/lib64 \ + $tmp_dir/src/sample-plugin +build_tarball vpp-native +rm -rf $tmp_dir + +exit 0 diff --git a/vpp/build-root/scripts/pci-nic-bind b/vpp/build-root/scripts/pci-nic-bind new file mode 100755 index 00000000..f3a0c264 --- /dev/null +++ b/vpp/build-root/scripts/pci-nic-bind @@ -0,0 +1,94 @@ +#!/bin/bash + +uio_drivers="igb_uio uio_pci_generic vfio-pci" +tmpfile=$(mktemp) + + +function bind_drv() { + addr=$1 + modalias=$(cat $selection/modalias) + native_drv=$(modprobe -R $modalias) + array=() + + for drv in $native_drv $uio_drivers; do + if [ -e /sys/bus/pci/drivers/$drv ]; then + echo driver $drv + drv_desc=$(modinfo $drv | grep description: | sed -e 's/.*:[[:space:]]\+//' ) + array+=("${drv}") + array+=("${drv_desc}") + fi + done + dialog --backtitle "PCI NIC Bind Utility" \ + --clear \ + --menu "Select kernel driver" 18 100 12 \ + "${array[@]}" 2> $tmpfile + retval=$? + selection=$(cat $tmpfile) + rm $tmpfile + if [ $retval -ne 0 ]; then + return + fi + vd=$(cat /sys/bus/pci/devices/${addr}/vendor /sys/bus/pci/devices/${addr}/device) + echo $addr | tee /sys/bus/pci/devices/${addr}/driver/unbind > /dev/null 2> /dev/null + echo $vd | tee /sys/bus/pci/drivers/${selection}/new_id > /dev/null 2> /dev/null + echo $addr | tee /sys/bus/pci/drivers/${selection}/bind > /dev/null 2> /dev/null +} + +function find_pci_slot() { + addr=$1 + [ ! "$(ls -A /sys/bus/pci/slots )" ] && echo "No PCI slot data" && return + for slot in $(find /sys/bus/pci/slots/* -maxdepth 0 -exec basename {} \;); do + slot_addr=$(cat /sys/bus/pci/slots/$slot/address) + if [[ "${addr}" == *"${slot_addr}"* ]]; then + echo "PCI slot: ${slot}" + return + fi + done + echo "Unknown PCI slot" +} + +! type -ap dialog > /dev/null && echo "Please install dialog (apt-get install dialog)" && exit +if [ $USER != "root" ] ; then +echo "Restarting script with sudo..." + sudo $0 ${*} + exit +fi + +cd /sys/bus/pci/devices + +while true; do + array=() + for addr in *; do + class=$(cat ${addr}/class) + if [ "$class" = "0x020000" ]; then + name=$(lspci -s $addr | sed -e 's/.*: //') + if [ -e "/sys/bus/pci/devices/$addr/driver" ]; then + drv=$(basename $(readlink -f /sys/bus/pci/devices/$addr/driver)) + else + drv=" " + fi + slot=$(find_pci_slot ${addr}) + array+=("${addr}") + array+=("${drv}|${name}") + array+=("${slot}") + fi + done + + dialog --backtitle "PCI NIC Bind Utility" \ + --item-help \ + --clear \ + --column-separator '|' \ + --menu "Select NIC" 18 100 12 \ + "${array[@]}" 2> $tmpfile + + retval=$? + selection=$(cat $tmpfile) + rm $tmpfile + if [ $retval -ne 0 ]; then + exit + fi + bind_drv $selection +done + + + diff --git a/vpp/build-root/scripts/pci-nic-bind-to-kernel b/vpp/build-root/scripts/pci-nic-bind-to-kernel new file mode 100755 index 00000000..3d8559e3 --- /dev/null +++ b/vpp/build-root/scripts/pci-nic-bind-to-kernel @@ -0,0 +1,19 @@ +#!/bin/bash + +# Bind all unused PCI devices bound to uio drivers +# back to default kernel driver + +if [ $USER != "root" ] ; then + echo "Restarting script with sudo..." + sudo $0 ${*} + exit +fi + +for f in /sys/bus/pci/drivers/{igb_uio,uio_pci_generic,vfio-pci}/*; do + [ -e ${f}/config ] || continue + fuser -s ${f}/config && continue + echo 1 > ${f}/remove + removed=y +done + +[ -n ${removed} ] && echo 1 > /sys/bus/pci/rescan diff --git a/vpp/build-root/scripts/remove-rpath b/vpp/build-root/scripts/remove-rpath new file mode 100755 index 00000000..bda3d60d --- /dev/null +++ b/vpp/build-root/scripts/remove-rpath @@ -0,0 +1,24 @@ +#!/bin/bash + +if [ -z $1 ]; then + echo "Please specify path" + exit 1 +fi + +which chrpath &> /dev/null + +if [ $? -ne 0 ] ; then + echo "Please install chrpath tool" + exit 1 +fi + +libs=$(find $1 -type f -name \*.so) +execs=$(find $1 -type f -path \*/bin/\* ) + +for i in $libs $execs; do + chrpath $i 2> /dev/null | grep -q build-root + if [ $? -eq 0 ] ; then + chrpath $i + fi +done + diff --git a/vpp/build-root/scripts/verdist b/vpp/build-root/scripts/verdist new file mode 100755 index 00000000..9d1f1b5a --- /dev/null +++ b/vpp/build-root/scripts/verdist @@ -0,0 +1,31 @@ +#!/bin/bash + +# +# Add version to dist tarball. +# +BR=$1 +prefix=$2 +verstring=$3 +BASE=`pwd` + +git rev-parse 2> /dev/null +if [ $? == 0 ]; then + git archive --prefix=${prefix}/ HEAD | gzip -9 > ${verstring}.tar.gz +else + cd .. + tar -c ${prefix} | gzip -9 > ${verstring}.tar.gz + cp ${verstring}.tar.gz $BASE + cd $BASE +fi + +mkdir ${BASE}/tmp +cd ${BASE}/tmp +tar -xzf ${BASE}/${verstring}.tar.gz +rm ${BASE}/${verstring}.tar.gz + +cp ${BR}/scripts/.version ${BASE}/tmp/${prefix}/build-root/scripts +tar -c ${prefix} | gzip -9 > ${verstring}.tar.gz +mv ${verstring}.tar.gz ${BASE} + +cd ${BASE} +rm -rf tmp diff --git a/vpp/build-root/scripts/version b/vpp/build-root/scripts/version new file mode 100755 index 00000000..d92eb8b7 --- /dev/null +++ b/vpp/build-root/scripts/version @@ -0,0 +1,54 @@ +#!/bin/bash + +path=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P ) + +cd "$path" + +git rev-parse 2> /dev/null +if [ $? == 0 ]; then + vstring=$(git describe) +elif [ -f .version ]; then + vstring=$(cat .version) +else + if [ -f ../rpm/*.gz ]; then + vstring=$(ls ../rpm/*.gz) + else + exit 1 + fi +fi + +TAG=$(echo ${vstring} | cut -d- -f1 | sed -e 's/^v//') +ADD=$(echo ${vstring} | cut -s -d- -f2) + +git rev-parse 2> /dev/null +if [ $? == 0 ]; then + CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4) +else + CMT=$(echo ${vstring} | cut -s -d- -f3,4) +fi +CMTR=$(echo $CMT | sed 's/-/_/') + +if [ -n "${BUILD_NUMBER}" ]; then + BLD="~b${BUILD_NUMBER}" +fi + +if [ "$1" = "rpm-version" ]; then + echo ${TAG} + exit +fi + +if [ "$1" = "rpm-release" ]; then + [ -z "${ADD}" ] && echo release && exit + echo ${ADD}${CMTR:+~${CMTR}}${BLD} + exit +fi + + if [ -n "${ADD}" ]; then + if [ "$1" = "rpm-string" ]; then + echo ${TAG}-${ADD}${CMTR:+~${CMTR}}${BLD} + else + echo ${TAG}-${ADD}${CMT:+~${CMT}}${BLD} + fi + else + echo ${TAG}-release +fi |