summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci/download-coverity-tarball.sh
blob: e2afc5d555648deaa2149af50265c34661eaabca (plain)
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
30
31
32
33
34
35
36
37
38
#!/usr/bin/bash

# We need a coverity token to fetch the tarball
if [ -x $COVERITY_TOKEN ]
then
  echo "No coverity token. Run this job from a protected branch."
  exit -1
fi

mkdir -p coverity

# Download and check MD5 first
curl https://scan.coverity.com/download/linux64 \
  --data "token=$COVERITY_TOKEN&project=GNOME+Shell&md5=1" \
  --output /tmp/coverity_tool.md5

diff /tmp/coverity_tool.md5 coverity/coverity_tool.md5 >/dev/null 2>&1

if [ $? -eq 0 -a -d coverity/cov-analysis* ]
then
  echo "Coverity tarball is up-to-date"
  exit 0
fi

# Download and extract coverity tarball
curl https://scan.coverity.com/download/linux64 \
  --data "token=$COVERITY_TOKEN&project=GNOME+Shell" \
  --output /tmp/coverity_tool.tgz

rm -rf ./coverity/cov-analysis*

tar zxf /tmp/coverity_tool.tgz -C coverity/
if [ $? -eq 0 ]
then
  mv /tmp/coverity_tool.md5 coverity/
fi

rm /tmp/coverity_tool.tgz