conditionalize use of git on executability of /usr/bin/git binary
[fw/altos] / debian / rules
index 74cc078d889c5d015b0c4a7c43361e07866adda8..f6efe9900a96b5487086e75c0222585086425367 100755 (executable)
@@ -3,13 +3,16 @@
 
 export DH_VERBOSE=1
 PKG_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)/\1/p')
+DEB_VERSION := $(shell if [ -x /usr/bin/git ]; then git describe; else echo 0; fi | tr - +)
 
 # this target invoked by git-buildpackage using a clean hook, see .gbp.conf
 prebuild:
-       dch -v `git describe | tr - +` "build for Debian from git"
+       git-dch --release --new-version=$(DEB_VERSION)
        git log > ChangeLog
-       git commit ChangeLog debian/changelog \
+       git commit -n ChangeLog debian/changelog \
                -m "update changelogs for Debian build"
+       git tag debian/$(DEB_VERSION)
+       git push --tags origin master
 
 configure: configure-stamp
 configure-stamp: