Compare commits

...

7 Commits

Author SHA1 Message Date
Dirk Hohndel
15efc4e2c7 Travis/Coverity: try to only scan libdivecomputer and Subsurface
Build the dependencies outside the part that gets scanned.
And remove all the commented out noise.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-22 08:39:39 -07:00
Dirk Hohndel
40c6d9521e build.sh: add flags to only build / not build dependencies
This is mainly intended for use when creating Coverity builds. This
commit is easier to understand with git show -w as almost all changes
are whitespace.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-22 08:38:56 -07:00
Dirk Hohndel
55a3cd13cd Travis/Coverity: for now just trigger on branch name
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-22 08:38:56 -07:00
Dirk Hohndel
c9c43ecb65 Travis Coverity: this should give us the correct token
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-22 08:38:56 -07:00
Anton Lundin
18e4ecff90 Add a coverity status badge to README.md
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-03-22 08:38:12 -07:00
Anton Lundin
e64da6e219 Run coverty scan on cron triggers
This is so we can setup a weekly cron trigger of master, to run the
coverty scan.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-03-22 08:38:12 -07:00
Anton Lundin
de53455a75 Add automatic coverity scans
This instructs travis to run automatic coverity scans for us.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-03-22 08:38:07 -07:00
4 changed files with 175 additions and 212 deletions

View File

@ -1,18 +1,11 @@
env:
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "Cb8+XTvcKMccvabQXQR2F1F5PNl9dZoe98Q66awS2DEHQIisUllMwZnMXyGtb3sbzJcWkilTPamSc6WBXO748hjH1uHdu9yFo4oQKBtq73gx5sRX51XTZSO4OfJipRJxSVkShnEA+YklwQBugOEkxfeRafpM68tbz6pAMoR8eHDKLsNa0wHjRfh+BEUKxaNEPxhWg3+41FSvUUeBf3fbqa6PWK5UwKIFCFh419X4gDyxTOEtm5OiIwYokruRGHxG0rZaMDHFcgjHBZ47WUXR0xIejh5j+L/vNGkcEoG6+96Hh5TR0rg9PaKdcWOUMt8VIO1pBZ1IrfGVdqgM6Yypb6ZrbJi3EEnAM6AxbUyJRW6410ZwcU0yVuNKDe/fMvhAjVlhsd+xjXuk2jfYKdhs/A45LwyK1Qt1vCXL8gFn/Dzgq+NIw8YyX9vL70J0t2cGQEwGTFiuD+5KaO35hyQm740bdw3FUCmFpVOYtq4iJMBDa12F4S9IMI8OvAmCXh2Mg/u3XVx9imDyBjwS4UrX63ny6rMftajdzCFl3FUyAsKcYl54ve1jVQtpoiQdrYuzlbRYXH/MvQ84ZKNclsFt84XayuL+y6Ds8+lyuEPOnJhpmZS0pt54X4YQSK0Yw49poNYBQHGTRKqOWnWSFDeFRlqki6WFnzqDek3lKRIu8iw="
matrix:
include:
- env: SUBSURFACE_PLATFORM='mac'
os: osx
osx_image: xcode6.4
language: c++ ruby
- env: SUBSURFACE_PLATFORM='windows'
os: linux
dist: trusty
sudo: required
language: c++
- env: SUBSURFACE_PLATFORM='linux'
os: linux
dist: trusty
@ -46,39 +39,26 @@ matrix:
# Not a subsurface dependency, but a QtWebKit dependency
- libhyphen-dev
- libicu52
# For SmartTrak import
- libglib2.0-dev
- mdbtools-dev
- env: SUBSURFACE_PLATFORM="android"
# Currently hard coded to arm
os: linux
language: c++
filter_secrets: false
services:
- docker
# TODO: caching
# cache:
# timeout: 300
# directories:
# - 3pp
- env: SUBSURFACE_PLATFORM="qt55"
# Currently hard coded to arm
os: linux
language: c++
filter_secrets: false
services:
- docker
coverity_scan:
project:
name: "Subsurface-divelog/subsurface"
description: "Build submitted via Travis CI"
notification_email: coverity@subsurface-divelog.org
build_command: bash ${TRAVIS_BUILD_DIR}/scripts/${SUBSURFACE_PLATFORM}/travisbuild.sh -no-deps
branch_pattern: coverity_scan
before_install:
# When the build on this branch gets triggered by travis-cron, do a coverty scan.
- source ${TRAVIS_BUILD_DIR}/scripts/${SUBSURFACE_PLATFORM}/before_install.sh
- source ${TRAVIS_BUILD_DIR}/scripts/${SUBSURFACE_PLATFORM}/travisbuild.sh -only-deps
script:
- source ${TRAVIS_BUILD_DIR}/scripts/${SUBSURFACE_PLATFORM}/travisbuild.sh
echo "built in coverity_scan section"
# - source ${TRAVIS_BUILD_DIR}/scripts/${SUBSURFACE_PLATFORM}/travisbuild.sh
after_success:
- source ${TRAVIS_BUILD_DIR}/scripts/${SUBSURFACE_PLATFORM}/after_success.sh
echo "don't post binaries"
# - source ${TRAVIS_BUILD_DIR}/scripts/${SUBSURFACE_PLATFORM}/after_success.sh
branches:
except:

View File

@ -1,4 +1,5 @@
# Subsurface [![Build Status](https://travis-ci.org/Subsurface-divelog/subsurface.svg?branch=master)](https://travis-ci.org/Subsurface-divelog/subsurface)
# Subsurface [![Build Status](https://travis-ci.org/Subsurface-divelog/subsurface.svg?branch=master)](https://travis-ci.org/Subsurface-divelog/subsurface) [![Coverity Scan Build Status](https://scan.coverity.com/projects/14405/badge.svg)](https://scan.coverity.com/projects/subsurface-divelog-subsurface)
This is the README file for Subsurface 4.7.7

View File

@ -14,6 +14,13 @@
# create a log file of the build
exec 1> >(tee build.log) 2>&1
CURRENTWD=$(pwd)
# if someone starts this script inside the subsurface directory, just go up a level
if [ "$(basename $(pwd))" = "subsurface" ] ; then
cd ..
fi
SRC=$(pwd)
PLATFORM=$(uname)
@ -59,6 +66,16 @@ while [[ $# -gt 0 ]] ; do
# hack for Travix Mac build
SKIP_GOOGLEMAPS="1"
;;
-only-deps)
# for Coverity build we want a mode to just build Subsurface and libdivecomputer (those will be analyzed),
# and build the rest, first.
ONLY_DEPS="1"
;;
-no-deps)
# for Coverity build we want a mode to just build Subsurface and libdivecomputer (those will be analyzed),
# and build the rest, first.
NO_DEPS="1"
;;
*)
echo "Unknown command line argument $arg"
;;
@ -304,25 +321,27 @@ if [[ $PLATFORM = Darwin || "$LIBGIT" < "24" ]] ; then
cd $SRC
if [ ! -d libgit2 ] ; then
if [[ $1 = local ]] ; then
git clone $SRC/../libgit2 libgit2
else
git clone https://github.com/libgit2/libgit2.git
if [ -z "$NO_DEPS" ] ; then
if [ ! -d libgit2 ] ; then
if [[ $1 = local ]] ; then
git clone $SRC/../libgit2 libgit2
else
git clone https://github.com/libgit2/libgit2.git
fi
fi
cd libgit2
# let's build with a recent enough version of master for the latest features
git fetch origin
if ! git checkout $CURRENT_LIBGIT2 ; then
echo "Can't find the right tag in libgit2 - giving up"
exit 1
fi
mkdir -p build
cd build
cmake $OLDER_MAC_CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF ..
make -j4
make install
fi
cd libgit2
# let's build with a recent enough version of master for the latest features
git fetch origin
if ! git checkout $CURRENT_LIBGIT2 ; then
echo "Can't find the right tag in libgit2 - giving up"
exit 1
fi
mkdir -p build
cd build
cmake $OLDER_MAC_CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF ..
make -j4
make install
if [ $PLATFORM = Darwin ] ; then
# in order for macdeployqt to do its job correctly, we need the full path in the dylib ID
@ -339,29 +358,31 @@ cd $SRC
# build libdivecomputer
cd subsurface
if [ -z "$ONLY_DEPS" ] ; then
cd subsurface
if [ ! -d libdivecomputer/src ] ; then
git submodule init
git submodule update --recursive
if [ ! -d libdivecomputer/src ] ; then
git submodule init
git submodule update --recursive
fi
cd libdivecomputer
mkdir -p build
cd build
if [ ! -f ../configure ] ; then
# this is not a typo
# in some scenarios it appears that autoreconf doesn't copy the
# ltmain.sh file; running it twice, however, fixes that problem
autoreconf --install ..
autoreconf --install ..
fi
CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" ../configure --prefix=$INSTALL_ROOT --disable-examples
make -j4
make install
fi
cd libdivecomputer
mkdir -p build
cd build
if [ ! -f ../configure ] ; then
# this is not a typo
# in some scenarios it appears that autoreconf doesn't copy the
# ltmain.sh file; running it twice, however, fixes that problem
autoreconf --install ..
autoreconf --install ..
fi
CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" ../configure --prefix=$INSTALL_ROOT --disable-examples
make -j4
make install
if [ $PLATFORM = Darwin ] ; then
if [ -z "$CMAKE_PREFIX_PATH" ] ; then
libdir=`$QMAKE -query QT_INSTALL_LIBS`
@ -401,28 +422,30 @@ if [ "$BUILDGRANTLEE" = "1" ] ; then
# build grantlee
PRINTING="-DNO_PRINTING=OFF"
cd $SRC
if [ -z "$NO_DEPS" ] ; then
cd $SRC
if [ ! -d grantlee ] ; then
if [[ $1 = local ]] ; then
git clone $SRC/../grantlee grantlee
else
git clone https://github.com/steveire/grantlee.git
if [ ! -d grantlee ] ; then
if [[ $1 = local ]] ; then
git clone $SRC/../grantlee grantlee
else
git clone https://github.com/steveire/grantlee.git
fi
fi
cd grantlee
if ! git checkout v5.0.0 ; then
echo "can't check out v5.0.0 of grantlee -- giving up"
exit 1
fi
mkdir -p build
cd build
cmake $OLDER_MAC_CMAKE -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT \
-DBUILD_TESTS=NO \
$SRC/grantlee
make -j4
make install
fi
cd grantlee
if ! git checkout v5.0.0 ; then
echo "can't check out v5.0.0 of grantlee -- giving up"
exit 1
fi
mkdir -p build
cd build
cmake $OLDER_MAC_CMAKE -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT \
-DBUILD_TESTS=NO \
$SRC/grantlee
make -j4
make install
else
PRINTING="-DNO_PRINTING=ON"
fi
@ -430,78 +453,85 @@ fi
if [ "$SKIP_GOOGLEMAPS" != "1" ] ; then
# build the googlemaps map plugin
cd $SRC
if [ ! -d googlemaps ] ; then
if [[ $1 = local ]] ; then
git clone $SRC/../googlemaps googlemaps
else
git clone https://github.com/Subsurface-divelog/googlemaps.git
if [ -z "$NO_DEPS" ] ; then
cd $SRC
if [ ! -d googlemaps ] ; then
if [[ $1 = local ]] ; then
git clone $SRC/../googlemaps googlemaps
else
git clone https://github.com/Subsurface-divelog/googlemaps.git
fi
fi
fi
cd googlemaps
git checkout master
git pull --rebase
cd googlemaps
git checkout master
git pull --rebase
mkdir -p build
cd build
$QMAKE -query
$QMAKE "INCLUDEPATH=$INSTALL_ROOT/include" ../googlemaps.pro
# on Travis the compiler doesn't support c++1z, yet qmake adds that flag;
# since things compile fine with c++11, let's just hack that away
# similarly, don't use -Wdata-time
mv Makefile Makefile.bak
cat Makefile.bak | sed -e 's/std=c++1z/std=c++11/g ; s/-Wdate-time//' > Makefile
make -j4
make install
mkdir -p build
cd build
$QMAKE -query
$QMAKE "INCLUDEPATH=$INSTALL_ROOT/include" ../googlemaps.pro
# on Travis the compiler doesn't support c++1z, yet qmake adds that flag;
# since things compile fine with c++11, let's just hack that away
# similarly, don't use -Wdata-time
mv Makefile Makefile.bak
cat Makefile.bak | sed -e 's/std=c++1z/std=c++11/g ; s/-Wdate-time//' > Makefile
make -j4
make install
fi
fi
# finally, build Subsurface
set -x
cd $SRC/subsurface
for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
SUBSURFACE_EXECUTABLE=${BUILDS[$i]}
BUILDDIR=${BUILDDIRS[$i]}
echo "build $SUBSURFACE_EXECUTABLE in $BUILDDIR"
if [ -z "$ONLY_DEPS" ] ; then
cd $SRC/subsurface
for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
SUBSURFACE_EXECUTABLE=${BUILDS[$i]}
BUILDDIR=${BUILDDIRS[$i]}
echo "build $SUBSURFACE_EXECUTABLE in $BUILDDIR"
# pull the plasma-mobile components from upstream if building Subsurface-mobile
if [ "$SUBSURFACE_EXECUTABLE" = "MobileExecutable" ] ; then
cd $SRC/subsurface
bash ./scripts/mobilecomponents.sh
fi
# pull the plasma-mobile components from upstream if building Subsurface-mobile
if [ "$SUBSURFACE_EXECUTABLE" = "MobileExecutable" ] ; then
cd $SRC/subsurface
bash ./scripts/mobilecomponents.sh
fi
mkdir -p $SRC/subsurface/$BUILDDIR
cd $SRC/subsurface/$BUILDDIR
export CMAKE_PREFIX_PATH="$INSTALL_ROOT/lib/cmake;${CMAKE_PREFIX_PATH}"
cmake -DCMAKE_BUILD_TYPE=Debug .. \
-DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \
${LIBGIT_ARGS} \
-DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \
-DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \
-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH \
-DBTSUPPORT=${BTSUPPORT} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_ROOT} \
-DLIBGIT2_FROM_PKGCONFIG=ON \
-DFORCE_LIBSSH=OFF \
$PRINTING $EXTRA_OPTS
mkdir -p $SRC/subsurface/$BUILDDIR
cd $SRC/subsurface/$BUILDDIR
export CMAKE_PREFIX_PATH="$INSTALL_ROOT/lib/cmake;${CMAKE_PREFIX_PATH}"
cmake -DCMAKE_BUILD_TYPE=Debug .. \
-DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \
${LIBGIT_ARGS} \
-DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \
-DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \
-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH \
-DBTSUPPORT=${BTSUPPORT} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_ROOT} \
-DLIBGIT2_FROM_PKGCONFIG=ON \
-DFORCE_LIBSSH=OFF \
$PRINTING $EXTRA_OPTS
if [ $PLATFORM = Darwin ] ; then
rm -rf Subsurface.app
rm -rf Subsurface-mobile.app
fi
if [ $PLATFORM = Darwin ] ; then
rm -rf Subsurface.app
rm -rf Subsurface-mobile.app
fi
LIBRARY_PATH=$INSTALL_ROOT/lib make -j4
LIBRARY_PATH=$INSTALL_ROOT/lib make install
LIBRARY_PATH=$INSTALL_ROOT/lib make -j4
LIBRARY_PATH=$INSTALL_ROOT/lib make install
if [ "$CREATE_APPDIR" = "1" ] ; then
# if we create an AppImage this makes gives us a sane starting point
cd $SRC
mkdir -p ./appdir
mkdir -p appdir/usr/share/metainfo
mkdir -p appdir/usr/share/icons/hicolor/256x256/apps
cp -r ./install-root/* ./appdir/usr
cp subsurface/appdata/subsurface.appdata.xml appdir/usr/share/metainfo/
cp subsurface/icons/subsurface-icon.png appdir/usr/share/icons/hicolor/256x256/apps/
fi
done
if [ "$CREATE_APPDIR" = "1" ] ; then
# if we create an AppImage this makes gives us a sane starting point
cd $SRC
mkdir -p ./appdir
mkdir -p appdir/usr/share/metainfo
mkdir -p appdir/usr/share/icons/hicolor/256x256/apps
cp -r ./install-root/* ./appdir/usr
cp subsurface/appdata/subsurface.appdata.xml appdir/usr/share/metainfo/
cp subsurface/icons/subsurface-icon.png appdir/usr/share/icons/hicolor/256x256/apps/
fi
done
else
echo "Done building the dependencies, did not build libdivecomputer and Subsurface"
fi
cd $CURRENTWD

View File

@ -13,60 +13,12 @@ export CMAKE_PREFIX_PATH=$QT_ROOT/lib/cmake
# build both desktop and mobile - first desktop without BT support and without
# webkit to make sure that still works, then with all components in order
# to create an AppImage
cd ..
bash -e -x ./subsurface/scripts/build.sh -desktop -no-bt
bash -e -x ${TRAVIS_BUILD_DIR}/scripts/build.sh -desktop -no-bt $@
if [ "$1" = "-onlydeps" ] ; then
exit 0
fi
rm -rf subsurface/build
bash -e -x ./subsurface/scripts/build.sh -both -create-appdir -build-with-webkit
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_DEBUG_PLUGINS=1
# for debugging: find $QT_ROOT/plugins
env CTEST_OUTPUT_ON_FAILURE=1 make -C subsurface/build check
# set up the appdir
mkdir -p appdir/usr/plugins/
# mv googlemaps and Grantlee plugins into place
mv appdir/usr/usr/local/Qt*/plugins/* appdir/usr/plugins # the usr/usr is not a typo - that's where it ends up
mv appdir/usr/lib/grantlee/ appdir/usr/plugins/
rm -rf appdir/usr/home/ appdir/usr/include/ appdir/usr/share/man/ # No need to ship developer and man files as part of the AppImage
rm -rf appdir/usr/usr appdir/usr/lib/cmake appdir/usr/lib/pkgconfig
# get the linuxdeployqt tool and run it to collect the libraries
wget -q -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
chmod a+x linuxdeployqt*.AppImage
unset QTDIR
unset QT_PLUGIN_PATH
unset LD_LIBRARY_PATH
./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -bundle-non-qt-libs -qmldir=./subsurface/map-widget/ -verbose=2
# create the AppImage
export VERSION=$(cd ${TRAVIS_BUILD_DIR}/scripts ; ./get-version linux) # linuxdeployqt uses this for naming the file
./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -appimage -qmldir=./subsurface/map-widget/ -verbose=2
find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
# SmartTrak import tool
bash -e -x ./subsurface/scripts/smtk2ssrf-build.sh
# Create AppImage for smtk2ssrf
mkdir -p ./smtk2ssrf_appdir/usr/share
mkdir -p ./smtk2ssrf_appdir/usr/plugins
mkdir -p ./smtk2ssrf_appdir/usr/bin
mkdir -p ./smtk2ssrf_appdir/usr/lib
cp -f subsurface/icons/subsurface-icon.svg smtk2ssrf_appdir/
cp -f subsurface/smtk-import/smtk2ssrf.desktop smtk2ssrf_appdir/
cp -f install-root/bin/smtk2ssrf smtk2ssrf_appdir/usr/bin/
cp -f install-root/lib/libdivecomputer.so.0 smtk2ssrf_appdir/usr/lib/
cp -f install-root/lib/libgit2* smtk2ssrf_appdir/usr/lib/
# Why is Grantlee needed? We have built subsurface without printing support!!!
cp -f install-root/lib/libGrantlee* smtk2ssrf_appdir/usr/lib/
cp -rf appdir/usr/plugins/{bearer,iconengines,imageformats,platforms,xcbglintegrations} smtk2ssrf_appdir/usr/plugins
./linuxdeployqt*.AppImage ./smtk2ssrf_appdir/smtk2ssrf.desktop -bundle-non-qt-libs -verbose=2
./linuxdeployqt*.AppImage ./smtk2ssrf_appdir/smtk2ssrf.desktop -appimage -verbose=2
find ./smtk2ssrf_appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
bash -e -x ${TRAVIS_BUILD_DIR}/scripts/build.sh -both -create-appdir -build-with-webkit $@