2020-02-09 10:06:26 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Coverity scan script for https://scan.coverity.com/projects/etlegacy-etlegacy
|
|
|
|
# See https://scan.coverity.com/download
|
|
|
|
#
|
|
|
|
# Runs in the docker builder at etlegacy.com
|
|
|
|
#
|
|
|
|
# Folder structure:
|
2020-03-29 19:37:18 +00:00
|
|
|
# - coverity.sh
|
2020-02-09 10:06:26 +00:00
|
|
|
# - etlegacy
|
|
|
|
# ... built code
|
|
|
|
# - github.com
|
|
|
|
# - etlegacy
|
|
|
|
# - etlegacy
|
|
|
|
# ... source code
|
|
|
|
# - coverity
|
|
|
|
# - etlegacy-cov
|
|
|
|
# - cov-analysis-linux64-2019.03
|
|
|
|
# - cov-int
|
|
|
|
#
|
2020-03-29 19:37:18 +00:00
|
|
|
srcdir="$HOME/github.com/etlegacy/etlegacy"
|
|
|
|
covdir="$HOME/github.com/etlegacy/coverity/etlegacy-cov"
|
2020-02-09 10:06:26 +00:00
|
|
|
covver="linux64-2019.03"
|
|
|
|
|
|
|
|
# account
|
|
|
|
token=xxxxxxxxxxxxxxxxxxxxxx
|
|
|
|
email=xxxxxxxxxxxx@xxxxx.xxx
|
|
|
|
|
|
|
|
# ensure we are on master branch
|
|
|
|
cd $srcdir
|
|
|
|
git stash
|
|
|
|
git checkout master
|
|
|
|
git pull
|
2020-03-29 19:37:18 +00:00
|
|
|
git submodule update --init --recursive
|
2020-02-09 10:06:26 +00:00
|
|
|
|
|
|
|
# cleanup
|
|
|
|
[[ -e $srcdir/build ]] && rm -rf $srcdir/build
|
|
|
|
|
|
|
|
# build
|
|
|
|
[[ ! -e $srcdir/build ]] && mkdir -p $srcdir/build
|
|
|
|
cd "$srcdir/build"
|
|
|
|
|
|
|
|
cmake .. \
|
|
|
|
-DCMAKE_BUILD_TYPE='Debug' \
|
|
|
|
-DCMAKE_INSTALL_PREFIX= \
|
|
|
|
-DCMAKE_LIBRARY_PATH=/usr/lib \
|
|
|
|
-DCMAKE_INCLUDE_PATH=/usr/include \
|
|
|
|
-DCROSS_COMPILE32=0 \
|
|
|
|
-DINSTALL_DEFAULT_BASEDIR=. \
|
|
|
|
-DINSTALL_DEFAULT_BINDIR=. \
|
|
|
|
-DINSTALL_DEFAULT_MODDIR=. \
|
|
|
|
-DBUNDLED_LIBS=1 \
|
|
|
|
-DINSTALL_EXTRA=0
|
|
|
|
|
|
|
|
# version check
|
|
|
|
version=$(git describe --always | sed -r 's/^v//;s/-/./g;')
|
|
|
|
version=${version:${#version} - 7}
|
|
|
|
|
|
|
|
# build
|
|
|
|
$covdir/cov-analysis-${covver}/bin/cov-build --dir $covdir/cov-int make -j 4
|
|
|
|
|
|
|
|
cd $covdir
|
|
|
|
tar -czvf etlegacy-${version}.tgz cov-int
|
|
|
|
|
|
|
|
# upload
|
|
|
|
curl -k \
|
|
|
|
--form token=${token} \
|
|
|
|
--form email=${email} \
|
|
|
|
--form file=@etlegacy-${version}.tgz \
|
|
|
|
--form version="${version}" \
|
|
|
|
--form description="development" \
|
|
|
|
https://scan.coverity.com/builds?project=etlegacy%2Fetlegacy
|
|
|
|
|
|
|
|
# cleanup
|
|
|
|
rm ${covdir}/etlegacy-${version}.tgz
|
2020-03-29 19:37:18 +00:00
|
|
|
#[[ -e "$HOME/github.com/etlegacy/coverity/cov-int" ]] && rm -rf "${covdir}/cov-int"
|
2020-02-09 10:06:26 +00:00
|
|
|
|
|
|
|
# vim:set ts=4 sw=2 et:
|