aboutsummaryrefslogtreecommitdiffstats
path: root/build-root/scripts
diff options
context:
space:
mode:
authorSachin Saxena <sachin.saxena@freescale.com>2018-02-28 20:28:52 +0530
committerSachin Saxena <sachin.saxena@nxp.com>2018-02-28 20:34:56 +0530
commit0689fce93ba269c48f83a2f70f971b3976d04c90 (patch)
tree4cc2908df3598507cc1828ac19d8c43b22450ffa /build-root/scripts
parent746b57564deede624261ab8a96c94f562f24d22c (diff)
parentd594711a5d79859a7d0bde83a516f7ab52051d9b (diff)
Merge branch 'stable/1710' of https://gerrit.fd.io/r/vpp into 17101710
Diffstat (limited to 'build-root/scripts')
-rwxr-xr-xbuild-root/scripts/checkstyle.sh137
-rwxr-xr-xbuild-root/scripts/csit-test-branch2
-rwxr-xr-xbuild-root/scripts/find-api-core-contents9
-rwxr-xr-xbuild-root/scripts/find-api-lib-contents6
-rwxr-xr-xbuild-root/scripts/find-dev-contents31
-rwxr-xr-xbuild-root/scripts/find-plugins-contents15
-rwxr-xr-xbuild-root/scripts/find-vpp-api-java-contents8
-rwxr-xr-xbuild-root/scripts/find-vpp-api-lua-contents6
-rwxr-xr-xbuild-root/scripts/find-vpp-api-python-contents8
-rwxr-xr-xbuild-root/scripts/generate-deb-changelog37
-rwxr-xr-xbuild-root/scripts/remove-rpath24
l---------build-root/scripts/version1
12 files changed, 284 insertions, 0 deletions
diff --git a/build-root/scripts/checkstyle.sh b/build-root/scripts/checkstyle.sh
new file mode 100755
index 00000000..6b760b3a
--- /dev/null
+++ b/build-root/scripts/checkstyle.sh
@@ -0,0 +1,137 @@
+#!/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 command \"indent\". Checkstyle aborted"
+ exit ${EXIT_CODE}
+fi
+indent --version
+
+# Check to make sure we have clang-format. Exit if we don't with an error message, but
+# don't *fail*.
+command -v clang-format > /dev/null
+HAVE_CLANG_FORMAT=0
+if [ $? != 0 ]; then
+ echo "Could not find command \"clang-format\". Checking C++ files will cause abort"
+else
+ clang-format --version
+ x=$(echo "" | clang-format 2>&1)
+ if [[ "$x" == "" ]]; then
+ HAVE_CLANG_FORMAT=1
+ else
+ echo "Output produced while formatting empty file (expected empty string):"
+ echo "$x"
+ echo "Could not find working \"clang-format\". Checking C++ files will cause abort"
+ fi
+fi
+
+cd ${VPP_DIR}
+git status
+for i in ${FILELIST}; do
+ if [ -f ${i} ] && [ ${i} != "build-root/scripts/checkstyle.sh" ] && [ ${i} != "extras/emacs/fix-coding-style.el" ]; then
+ grep -q "fd.io coding-style-patch-verification: ON" ${i}
+ if [ $? == 0 ]; then
+ EXTENSION=`basename ${i} | sed 's/^\w\+.//'`
+ case ${EXTENSION} in
+ hpp|cpp|cc|hh)
+ CMD="clang-format"
+ if [ ${HAVE_CLANG_FORMAT} == 0 ]; then
+ echo "C++ file detected. Abort. (missing clang-format)"
+ exit ${EXIT_CODE}
+ fi
+ ;;
+ *)
+ CMD="indent"
+ ;;
+ esac
+ CHECKSTYLED_FILES="${CHECKSTYLED_FILES} ${i}"
+ if [ ${FIX} == 0 ]; then
+ if [ "${CMD}" == "clang-format" ]
+ then
+ clang-format ${i} > ${i}.out2
+ else
+ indent ${i} -o ${i}.out1 > /dev/null 2>&1
+ indent ${i}.out1 -o ${i}.out2 > /dev/null 2>&1
+ fi
+ # Remove trailing whitespace
+ sed -i -e 's/[[:space:]]*$//' ${i}.out2
+ diff -q ${i} ${i}.out2
+ else
+ if [ "${CMD}" == "clang-format" ]; then
+ clang-format -i ${i} > /dev/null 2>&1
+ else
+ indent ${i}
+ indent ${i}
+ fi
+ # Remove trailing whitespace
+ sed -i -e 's/[[:space:]]*$//' ${i}
+ fi
+ if [ $? != 0 ]; then
+ EXIT_CODE=1
+ echo
+ echo "Checkstyle failed for ${i}."
+ if [ "${CMD}" == "clang-format" ]; then
+ echo "Run clang-format as shown to fix the problem:"
+ echo "clang-format -i ${VPP_DIR}${i}"
+ else
+ echo "Run indent (twice!) as shown to fix the problem:"
+ echo "indent ${VPP_DIR}${i}"
+ echo "indent ${VPP_DIR}${i}"
+ fi
+ 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/build-root/scripts/csit-test-branch b/build-root/scripts/csit-test-branch
new file mode 100755
index 00000000..e0764023
--- /dev/null
+++ b/build-root/scripts/csit-test-branch
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo oper-rls1710-171011
diff --git a/build-root/scripts/find-api-core-contents b/build-root/scripts/find-api-core-contents
new file mode 100755
index 00000000..c1af69db
--- /dev/null
+++ b/build-root/scripts/find-api-core-contents
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+for i in $(find ${1}/vpp/share/vpp/api/core -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/build-root/scripts/find-api-lib-contents b/build-root/scripts/find-api-lib-contents
new file mode 100755
index 00000000..562db7b8
--- /dev/null
+++ b/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/build-root/scripts/find-dev-contents b/build-root/scripts/find-dev-contents
new file mode 100755
index 00000000..d4f7b63f
--- /dev/null
+++ b/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 src/examples/sample-plugin -type f -print | grep -v autom4te)`
+
+for path in $paths
+do
+ relpath=`echo $path | sed -e 's:.*src/examples/::'`
+ dir=`dirname $relpath`
+ if [ $dir = "sample-plugin" ] ; then
+ echo ../../$path /usr/share/doc/vpp/examples/sample-plugin/ >> $2
+ else
+ echo ../../$path \
+ /usr/share/doc/vpp/examples/$dir >> $2
+ fi
+done
diff --git a/build-root/scripts/find-plugins-contents b/build-root/scripts/find-plugins-contents
new file mode 100755
index 00000000..ae2a4271
--- /dev/null
+++ b/build-root/scripts/find-plugins-contents
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+rm -f $2
+
+for i in ${1}/vpp/lib64/vpp_plugins/*.so; do
+ echo ../${i} /usr/lib/vpp_plugins >> ${2}
+done
+
+for i in ${1}/vpp/lib64/vpp_api_test_plugins/*.so; do
+ echo ../${i} /usr/lib/vpp_api_test_plugins >> ${2}
+done
+
+for i in $(find ${1}/plugins ${1}/vpp/share/vpp/api/plugins/ -name *.api.json -type f -print); do
+ echo ../${i} /usr/share/vpp/api/ >> ${2}
+done
diff --git a/build-root/scripts/find-vpp-api-java-contents b/build-root/scripts/find-vpp-api-java-contents
new file mode 100755
index 00000000..5f1bf197
--- /dev/null
+++ b/build-root/scripts/find-vpp-api-java-contents
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+rm -f $2
+
+for i in $(find ${1}/vpp/share/java/ -type f -print); do
+ echo ../${i} /usr/share/java >> ${2}
+done
+
diff --git a/build-root/scripts/find-vpp-api-lua-contents b/build-root/scripts/find-vpp-api-lua-contents
new file mode 100755
index 00000000..f1173db8
--- /dev/null
+++ b/build-root/scripts/find-vpp-api-lua-contents
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+#i for now put everything into examples directory
+
+echo ../../src/vpp-api/lua /usr/share/vpp/examples > ${2}
+
diff --git a/build-root/scripts/find-vpp-api-python-contents b/build-root/scripts/find-vpp-api-python-contents
new file mode 100755
index 00000000..819c9122
--- /dev/null
+++ b/build-root/scripts/find-vpp-api-python-contents
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+rm -f $2
+
+for i in $(find ${1}/vpp/lib/python2.7/site-packages/ -type f -print); do
+ echo ../${i} /usr/lib/python2.7/site-packages/vpp_papi >> ${2}
+done
+
diff --git a/build-root/scripts/generate-deb-changelog b/build-root/scripts/generate-deb-changelog
new file mode 100755
index 00000000..7bdc6337
--- /dev/null
+++ b/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/build-root/scripts/remove-rpath b/build-root/scripts/remove-rpath
new file mode 100755
index 00000000..3912b370
--- /dev/null
+++ b/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 -d $i
+ fi
+done
+
diff --git a/build-root/scripts/version b/build-root/scripts/version
new file mode 120000
index 00000000..8392c68b
--- /dev/null
+++ b/build-root/scripts/version
@@ -0,0 +1 @@
+../../src/scripts/version \ No newline at end of file