- echo " -v : set version"
- echo " -V : version set by project"
- echo " -o : support old Debian 7 format"
-}
-
-function cmake_check {
- pushd ../build >/dev/null
- # do checks
- if [ -e debian/$paket.build ]
- then
- echo "cmake is not compatible with other builds. Remove $paket.build"
- exit 1
- fi
- if [ -e debian/$paket.prebuild ]
- then
- echo "cmake is not compatible with other builds. Remove $paket.prebuild"
- exit 2
- fi
-
- if [ -n "$cross" ]
- then
- # inject cross toolset
- echo "set (CMAKE_MODULE_PATH $cross)" > CMakeLists.txt
- echo "include(toolset)" >> CMakeLists.txt
- cat debian/$paket.cmake >> CMakeLists.txt
- else
- cp debian/$paket.cmake CMakeLists.txt
- fi
-
- echo "make" > debian/$paket.build
- chmod 755 debian/$paket.build
- cmake .
- popd >/dev/null
-}
-function check_unversioned {
- # has to be called in the projects base directory
- # result: "M" in stdout or nothing
- set -e
-
- # check if build is running in a sandbox
- if ! [ -f .cm.ignore ]
- then
- # we create one
- echo ".cm.ignore" > .cm.ignore
- echo "debian.*" >> .cm.ignore
- echo "up.*" >> .cm.ignore
- fi
-
- project=$(pwd)
- project=${project##*/}
- pushd .. >/dev/null
- mCM $project -b -an > /dev/null
- wc=$(wc $project.batch)
- rm $project.batch
- if [ "${wc:0:5}" != "0 0 0" ]
- then
- echo "M"
- fi
- popd >/dev/null
-}
-
-function set_build {
- set -e
- if [ -e .svn ]
- then
- version="0.0"
- build=$(svnversion)
- build=${build/:/-}
- build="$build$(check_unversioned)"
- elif [ -e .git ]
- then
- tag=$(git describe --tags --match "${paket}_*" 2>/dev/null) || true
- if test -z "$tag"
- then
- # try generic "v_" tag
- tag=$(git describe --tags --match "v_*" 2>/dev/null) || true
- fi
- if test -z "$tag"
- then
- tag="0.0-0TOP"
- fi
- changes=$(check_unversioned)
- tag="$tag$changes"
- version=${tag##*_}
- version=${version%%-*}
- build=${tag##*-}
- else
- echo "No configuration system found. Cannot determine version."
- exit 1
- fi
-}
-
-function check_version {
- set -e
-
- vline=$(head -1 debian/$paket.changelog)
- vline=${vline%-*}
- clversion=${vline#*(}
- if [ $version = "0.0" ]
- then
- version=$clversion
- return
- fi
-
- # do no check on a modified git repos
- if [ "${build: -1}" == "M" ]
- then
- return
- fi
-
- if [ "$clversion" != $version ]
- then
- echo "version mismatch: git: $version, changelog: $clversion"
- exit 1
- fi