summaryrefslogtreecommitdiffstats
path: root/coverity-install.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-04-17 17:57:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-04-17 17:57:35 +0000
commit3b95e5be69c199a2a195c57aba12d88c242225ac (patch)
tree137b72ffaefe7f34bf21e975ccc9cc9ec0474564 /coverity-install.sh
parentAdding upstream version 1.13.0. (diff)
downloadnetdata-3b95e5be69c199a2a195c57aba12d88c242225ac.tar.xz
netdata-3b95e5be69c199a2a195c57aba12d88c242225ac.zip
Adding upstream version 1.14.0~rc0.upstream/1.14.0_rc0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'coverity-install.sh')
-rwxr-xr-xcoverity-install.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/coverity-install.sh b/coverity-install.sh
new file mode 100755
index 000000000..99d2f2fea
--- /dev/null
+++ b/coverity-install.sh
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+# Coverity installation script
+#
+# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
+#
+# Author: Pavlos Emm. Katsoulakis (paul@netdata.cloud)
+
+token="${COVERITY_SCAN_TOKEN}"
+([ -z "${token}" ] && [ -f .coverity-token ]) && token="$(<.coverity-token)"
+if [ -z "${token}" ]; then
+ echo >&2 "Save the coverity token to .coverity-token or export it as COVERITY_SCAN_TOKEN."
+ exit 1
+fi
+
+covbuild="$(which cov-build 2>/dev/null || command -v cov-build 2>/dev/null)"
+([ -z "${covbuild}" ] && [ -f .coverity-build ]) && covbuild="$(<.coverity-build)"
+if [ ! -z "${covbuild}" ]; then
+ echo >&2 "Coverity already installed, nothing to do!"
+ exit 0
+fi
+
+echo >&2 "Installing coverity..."
+WORKDIR="/opt/coverity-source"
+mkdir -p "${WORKDIR}"
+
+curl -SL --data "token=${token}&project=${REPOSITORY}" https://scan.coverity.com/download/linux64 > "${WORKDIR}/coverity_tool.tar.gz"
+if [ -f "${WORKDIR}/coverity_tool.tar.gz" ]; then
+ tar -x -C "${WORKDIR}" -f "${WORKDIR}/coverity_tool.tar.gz"
+ sudo mv "${WORKDIR}/cov-analysis-linux64-2017.07" /opt/coverity
+ export PATH=${PATH}:/opt/coverity/bin/
+else
+ echo "Failed to download coverity tool tarball!"
+fi
+
+# Validate the installation
+covbuild="$(which cov-build 2>/dev/null || command -v cov-build 2>/dev/null)"
+if [ -z "$covbuild" ]; then
+ echo "Failed to install coverity!"
+ exit 1
+else
+ echo >&2 "Coverity scan installed!"
+fi