2021-12-13 03:27:04 +08:00
|
|
|
#!/usr/bin/env bash
|
2021-01-27 20:37:10 +08:00
|
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
2018-01-11 18:41:35 +08:00
|
|
|
|
|
|
|
# Download and extract coverity tool
|
|
|
|
|
2021-09-30 03:28:55 +08:00
|
|
|
set -e
|
|
|
|
set -o pipefail
|
|
|
|
|
2018-01-11 18:41:35 +08:00
|
|
|
# Environment check
|
2021-09-30 03:28:55 +08:00
|
|
|
if [ -z "$COVERITY_SCAN_TOKEN" ]; then
|
|
|
|
echo >&2 'ERROR: COVERITY_SCAN_TOKEN must be set'
|
|
|
|
exit 1
|
|
|
|
fi
|
2018-01-11 18:41:35 +08:00
|
|
|
|
|
|
|
# Use default values if not set
|
2021-09-30 03:28:55 +08:00
|
|
|
PLATFORM="$(uname)"
|
|
|
|
TOOL_BASE="${TOOL_BASE:-/tmp/coverity-scan-analysis}"
|
|
|
|
TOOL_ARCHIVE="${TOOL_ARCHIVE:-/tmp/cov-analysis-${PLATFORM}.tgz}"
|
2018-01-11 18:41:35 +08:00
|
|
|
TOOL_URL="https://scan.coverity.com/download/${PLATFORM}"
|
|
|
|
|
|
|
|
# Make sure wget is installed
|
|
|
|
sudo apt-get update && sudo apt-get -y install wget
|
|
|
|
|
|
|
|
# Get coverity tool
|
2021-09-30 03:28:55 +08:00
|
|
|
if [ ! -d "$TOOL_BASE" ]; then
|
scripts: use 4 space indentation
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)
Also remove the few vim config lines that were left. We should either have them
on all files, or none.
Also remove some strange stuff like '#!/bin/env bash', yikes.
2019-04-04 20:10:42 +08:00
|
|
|
# Download Coverity Scan Analysis Tool
|
2021-09-30 03:28:55 +08:00
|
|
|
if [ ! -e "$TOOL_ARCHIVE" ]; then
|
|
|
|
echo -e "\033[33;1mDownloading Coverity Scan Analysis Tool...\033[0m"
|
|
|
|
wget -nv -O "$TOOL_ARCHIVE" "$TOOL_URL" --post-data "project=$COVERITY_SCAN_PROJECT_NAME&token=$COVERITY_SCAN_TOKEN"
|
scripts: use 4 space indentation
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)
Also remove the few vim config lines that were left. We should either have them
on all files, or none.
Also remove some strange stuff like '#!/bin/env bash', yikes.
2019-04-04 20:10:42 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Extract Coverity Scan Analysis Tool
|
|
|
|
echo -e "\033[33;1mExtracting Coverity Scan Analysis Tool...\033[0m"
|
2021-09-30 03:28:55 +08:00
|
|
|
mkdir -p "$TOOL_BASE"
|
|
|
|
pushd "$TOOL_BASE"
|
|
|
|
tar xzf "$TOOL_ARCHIVE"
|
scripts: use 4 space indentation
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)
Also remove the few vim config lines that were left. We should either have them
on all files, or none.
Also remove some strange stuff like '#!/bin/env bash', yikes.
2019-04-04 20:10:42 +08:00
|
|
|
popd
|
2018-01-11 18:41:35 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "\033[33;1mCoverity Scan Analysis Tool can be found at $TOOL_BASE ...\033[0m"
|