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: matrix:
include: 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' - env: SUBSURFACE_PLATFORM='linux'
os: linux os: linux
dist: trusty dist: trusty
@ -46,39 +39,26 @@ matrix:
# Not a subsurface dependency, but a QtWebKit dependency # Not a subsurface dependency, but a QtWebKit dependency
- libhyphen-dev - libhyphen-dev
- libicu52 - libicu52
# For SmartTrak import coverity_scan:
- libglib2.0-dev project:
- mdbtools-dev name: "Subsurface-divelog/subsurface"
description: "Build submitted via Travis CI"
- env: SUBSURFACE_PLATFORM="android" notification_email: coverity@subsurface-divelog.org
# Currently hard coded to arm build_command: bash ${TRAVIS_BUILD_DIR}/scripts/${SUBSURFACE_PLATFORM}/travisbuild.sh -no-deps
os: linux branch_pattern: coverity_scan
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
before_install: 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}/before_install.sh
- source ${TRAVIS_BUILD_DIR}/scripts/${SUBSURFACE_PLATFORM}/travisbuild.sh -only-deps
script: 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: 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: branches:
except: 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 This is the README file for Subsurface 4.7.7

View File

@ -14,6 +14,13 @@
# create a log file of the build # create a log file of the build
exec 1> >(tee build.log) 2>&1 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) SRC=$(pwd)
PLATFORM=$(uname) PLATFORM=$(uname)
@ -59,6 +66,16 @@ while [[ $# -gt 0 ]] ; do
# hack for Travix Mac build # hack for Travix Mac build
SKIP_GOOGLEMAPS="1" 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" echo "Unknown command line argument $arg"
;; ;;
@ -304,25 +321,27 @@ if [[ $PLATFORM = Darwin || "$LIBGIT" < "24" ]] ; then
cd $SRC cd $SRC
if [ ! -d libgit2 ] ; then if [ -z "$NO_DEPS" ] ; then
if [[ $1 = local ]] ; then if [ ! -d libgit2 ] ; then
git clone $SRC/../libgit2 libgit2 if [[ $1 = local ]] ; then
else git clone $SRC/../libgit2 libgit2
git clone https://github.com/libgit2/libgit2.git else
git clone https://github.com/libgit2/libgit2.git
fi
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 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 if [ $PLATFORM = Darwin ] ; then
# in order for macdeployqt to do its job correctly, we need the full path in the dylib ID # 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 # build libdivecomputer
cd subsurface if [ -z "$ONLY_DEPS" ] ; then
cd subsurface
if [ ! -d libdivecomputer/src ] ; then if [ ! -d libdivecomputer/src ] ; then
git submodule init git submodule init
git submodule update --recursive 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 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 [ $PLATFORM = Darwin ] ; then
if [ -z "$CMAKE_PREFIX_PATH" ] ; then if [ -z "$CMAKE_PREFIX_PATH" ] ; then
libdir=`$QMAKE -query QT_INSTALL_LIBS` libdir=`$QMAKE -query QT_INSTALL_LIBS`
@ -401,28 +422,30 @@ if [ "$BUILDGRANTLEE" = "1" ] ; then
# build grantlee # build grantlee
PRINTING="-DNO_PRINTING=OFF" PRINTING="-DNO_PRINTING=OFF"
cd $SRC if [ -z "$NO_DEPS" ] ; then
cd $SRC
if [ ! -d grantlee ] ; then if [ ! -d grantlee ] ; then
if [[ $1 = local ]] ; then if [[ $1 = local ]] ; then
git clone $SRC/../grantlee grantlee git clone $SRC/../grantlee grantlee
else else
git clone https://github.com/steveire/grantlee.git git clone https://github.com/steveire/grantlee.git
fi
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 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 else
PRINTING="-DNO_PRINTING=ON" PRINTING="-DNO_PRINTING=ON"
fi fi
@ -430,78 +453,85 @@ fi
if [ "$SKIP_GOOGLEMAPS" != "1" ] ; then if [ "$SKIP_GOOGLEMAPS" != "1" ] ; then
# build the googlemaps map plugin # build the googlemaps map plugin
cd $SRC if [ -z "$NO_DEPS" ] ; then
if [ ! -d googlemaps ] ; then cd $SRC
if [[ $1 = local ]] ; then if [ ! -d googlemaps ] ; then
git clone $SRC/../googlemaps googlemaps if [[ $1 = local ]] ; then
else git clone $SRC/../googlemaps googlemaps
git clone https://github.com/Subsurface-divelog/googlemaps.git else
git clone https://github.com/Subsurface-divelog/googlemaps.git
fi
fi fi
fi cd googlemaps
cd googlemaps git checkout master
git checkout master git pull --rebase
git pull --rebase
mkdir -p build mkdir -p build
cd build cd build
$QMAKE -query $QMAKE -query
$QMAKE "INCLUDEPATH=$INSTALL_ROOT/include" ../googlemaps.pro $QMAKE "INCLUDEPATH=$INSTALL_ROOT/include" ../googlemaps.pro
# on Travis the compiler doesn't support c++1z, yet qmake adds that flag; # 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 # since things compile fine with c++11, let's just hack that away
# similarly, don't use -Wdata-time # similarly, don't use -Wdata-time
mv Makefile Makefile.bak mv Makefile Makefile.bak
cat Makefile.bak | sed -e 's/std=c++1z/std=c++11/g ; s/-Wdate-time//' > Makefile cat Makefile.bak | sed -e 's/std=c++1z/std=c++11/g ; s/-Wdate-time//' > Makefile
make -j4 make -j4
make install make install
fi
fi fi
# finally, build Subsurface # finally, build Subsurface
set -x set -x
cd $SRC/subsurface if [ -z "$ONLY_DEPS" ] ; then
for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do cd $SRC/subsurface
SUBSURFACE_EXECUTABLE=${BUILDS[$i]} for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
BUILDDIR=${BUILDDIRS[$i]} SUBSURFACE_EXECUTABLE=${BUILDS[$i]}
echo "build $SUBSURFACE_EXECUTABLE in $BUILDDIR" BUILDDIR=${BUILDDIRS[$i]}
echo "build $SUBSURFACE_EXECUTABLE in $BUILDDIR"
# pull the plasma-mobile components from upstream if building Subsurface-mobile # pull the plasma-mobile components from upstream if building Subsurface-mobile
if [ "$SUBSURFACE_EXECUTABLE" = "MobileExecutable" ] ; then if [ "$SUBSURFACE_EXECUTABLE" = "MobileExecutable" ] ; then
cd $SRC/subsurface cd $SRC/subsurface
bash ./scripts/mobilecomponents.sh bash ./scripts/mobilecomponents.sh
fi fi
mkdir -p $SRC/subsurface/$BUILDDIR mkdir -p $SRC/subsurface/$BUILDDIR
cd $SRC/subsurface/$BUILDDIR cd $SRC/subsurface/$BUILDDIR
export CMAKE_PREFIX_PATH="$INSTALL_ROOT/lib/cmake;${CMAKE_PREFIX_PATH}" export CMAKE_PREFIX_PATH="$INSTALL_ROOT/lib/cmake;${CMAKE_PREFIX_PATH}"
cmake -DCMAKE_BUILD_TYPE=Debug .. \ cmake -DCMAKE_BUILD_TYPE=Debug .. \
-DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \ -DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \
${LIBGIT_ARGS} \ ${LIBGIT_ARGS} \
-DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \ -DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \
-DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \ -DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \
-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH \ -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH \
-DBTSUPPORT=${BTSUPPORT} \ -DBTSUPPORT=${BTSUPPORT} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_ROOT} \ -DCMAKE_INSTALL_PREFIX=${INSTALL_ROOT} \
-DLIBGIT2_FROM_PKGCONFIG=ON \ -DLIBGIT2_FROM_PKGCONFIG=ON \
-DFORCE_LIBSSH=OFF \ -DFORCE_LIBSSH=OFF \
$PRINTING $EXTRA_OPTS $PRINTING $EXTRA_OPTS
if [ $PLATFORM = Darwin ] ; then if [ $PLATFORM = Darwin ] ; then
rm -rf Subsurface.app rm -rf Subsurface.app
rm -rf Subsurface-mobile.app rm -rf Subsurface-mobile.app
fi fi
LIBRARY_PATH=$INSTALL_ROOT/lib make -j4 LIBRARY_PATH=$INSTALL_ROOT/lib make -j4
LIBRARY_PATH=$INSTALL_ROOT/lib make install LIBRARY_PATH=$INSTALL_ROOT/lib make install
if [ "$CREATE_APPDIR" = "1" ] ; then if [ "$CREATE_APPDIR" = "1" ] ; then
# if we create an AppImage this makes gives us a sane starting point # if we create an AppImage this makes gives us a sane starting point
cd $SRC cd $SRC
mkdir -p ./appdir mkdir -p ./appdir
mkdir -p appdir/usr/share/metainfo mkdir -p appdir/usr/share/metainfo
mkdir -p appdir/usr/share/icons/hicolor/256x256/apps mkdir -p appdir/usr/share/icons/hicolor/256x256/apps
cp -r ./install-root/* ./appdir/usr cp -r ./install-root/* ./appdir/usr
cp subsurface/appdata/subsurface.appdata.xml appdir/usr/share/metainfo/ cp subsurface/appdata/subsurface.appdata.xml appdir/usr/share/metainfo/
cp subsurface/icons/subsurface-icon.png appdir/usr/share/icons/hicolor/256x256/apps/ cp subsurface/icons/subsurface-icon.png appdir/usr/share/icons/hicolor/256x256/apps/
fi fi
done 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 # 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 # webkit to make sure that still works, then with all components in order
# to create an AppImage # 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 rm -rf subsurface/build
bash -e -x ./subsurface/scripts/build.sh -both -create-appdir -build-with-webkit bash -e -x ${TRAVIS_BUILD_DIR}/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