~rcr/rirc

ref: c902a4fe604ba9f3427aed29ed82f630e843dc4b rirc/scripts/sa_coverity_get.sh -rwxr-xr-x 699 bytes
c902a4fe — Richard Robbins Merge branch 'dev' into static_analysis a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash

set -e

fail() { >&2 printf "%s\n" "$*"; exit 1; }

if [[ -z $1 ]]; then
	fail "Usage: '$0 dir'"
fi

if [[ -z "${COVERITY_TOKEN}" ]]; then
	fail "missing env COVERITY_TOKEN"
fi

DIR="$1"

COVERITY_MD5="$DIR/coverity_tool.md5"
COVERITY_TGZ="$DIR/coverity_tool.tgz"

mkdir -p "$DIR"

echo "*" > "$DIR/.gitignore"

curl -fsS https://scan.coverity.com/download/linux64 -o "$COVERITY_MD5" --data "token=$COVERITY_TOKEN&project=rcr%2Frirc&md5=1"
curl -fsS https://scan.coverity.com/download/linux64 -o "$COVERITY_TGZ" --data "token=$COVERITY_TOKEN&project=rcr%2Frirc"

printf "%s\t$COVERITY_TGZ" "$(cat "$COVERITY_MD5")" | md5sum -c -

tar -xzf "$COVERITY_TGZ" -C "$DIR" --strip-components 1