debian: Pass Git count and hash to CMake

Signed-off-by: Vasilis Tsiligiannis <acinonyx@openwrt.gr>
This commit is contained in:
Vasilis Tsiligiannis 2019-09-11 01:47:41 +03:00 committed by Manolis Surligas
parent 3780102025
commit 35c50bce83
2 changed files with 4 additions and 3 deletions

View File

@ -10,7 +10,7 @@ debian:
script:
- mk-build-deps -i -r -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y"
- PACKAGE_VERSION="${CI_COMMIT_TAG#v}"
- PACKAGE_VERSION="${PACKAGE_VERSION:-$(git describe 2>/dev/null | tr '-' '+' | cut -c '2-' || true)}"
- PACKAGE_VERSION="${PACKAGE_VERSION:-$(git describe --abbrev=8 2>/dev/null | tr '-' '+' | cut -c '2-' || true)}"
- |
[ -z "$PACKAGE_VERSION" ] || {
dch -b -M -v "${PACKAGE_VERSION}-1" "Bump to version '${PACKAGE_VERSION}-1'"

5
debian/rules vendored
View File

@ -4,13 +4,14 @@ export DEB_HOST_MULTIARCH
DEB_DEBIAN_DIR=$(dir $(firstword $(MAKEFILE_LIST)))
VER=$(shell dpkg-parsechangelog -l$(DEB_DEBIAN_DIR)/changelog \
| sed -rne 's,^Version: ([^-]+).*,\1,p')
GITREV=$(shell echo $(VER) | sed -rne 's,^[0-9]{8}\.([0-f]{7})$$,\1,p' -e 's,^([0-9]+\.[0-9]+.*)$$,v\1,p')
GITREV=$(shell echo $(VER) | sed -rne 's,^[0-9]+\.[0-9]+.*\+[0-9]+\+g([0-f]{8})$$,\1,p' -e 's,^([0-9]+\.[0-9]+(\.[0-9]+)?)$$,v\1,p')
GITCOUNT=$(shell echo $(VER) | sed -rne 's,^[0-9]+\.[0-9]+.*\+([0-9]+)\+g[0-f]{8}$$,\1,p')
%:
dh $@ --with python2 --parallel
override_dh_auto_configure:
dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" -DPythonLibs_FIND_VERSION:STRING="2.7" -DPYTHON_EXECUTABLE:STRING="/usr/bin/python"
dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" -DPythonLibs_FIND_VERSION:STRING="2.7" -DPYTHON_EXECUTABLE:STRING="/usr/bin/python" -DGR_GIT_COUNT="$(GITCOUNT)" -DGR_GIT_HASH="$(GITREV)"
override_dh_auto_install:
dh_auto_install