[Pkg-ganeti-devel] [ganeti] 162/165: d/rules: use upstream git tag for file generation

Apollon Oikonomopoulos apoikos at moszumanska.debian.org
Tue Aug 11 13:53:25 UTC 2015


This is an automated email from the git hooks/post-receive script.

apoikos pushed a commit to branch master
in repository ganeti.

commit 1981fcef00c54d358be3df203be77b4fa085beb8
Author: Apollon Oikonomopoulos <apoikos at debian.org>
Date:   Tue Aug 11 15:08:10 2015 +0300

    d/rules: use upstream git tag for file generation
    
    Do not rely on d/changelog's version to generate d/control and DH files,
    since d/changelog will usually be updated after the packaging has been
    updated. Since these targets will only be run from our packaging
    repository when preparing a new minor release, we can use the closest
    upstream tag for this purpose.
    
    As a safeguard the operation will error out if no upstream version can
    be obtained through a tag.
---
 debian/rules | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/debian/rules b/debian/rules
index 6679086..8ce732a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,27 +3,36 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+# Debian package major.minor version
 VER = $(shell dpkg-parsechangelog -Sversion | sed -r 's/([0-9]+\.[0-9]+)(\..*)/\1/')
 
+# Closest upstream VCS tag, used to generate debian/control and DH files
+VCS_VER = $(shell git describe --abbrev=0 --match="v*" 2>/dev/null | sed -r 's/v([0-9]+\.[0-9]+)(\..*)/\1/')
+
 GNT_USERGROUP_PREFIX="gnt-"
 
 %:
 	dh $@ --with python2,sphinxdoc,bash_completion,autoreconf
 
-debian/control: debian/control.in
-	sed -s 's/#VER#/$(VER)/g' debian/control.in > debian/control
+check-vcs-version:
+ifeq ($(VCS_VER),)
+	$(error Empty VCS version, the target must be run within the packaging git repository)
+endif
+
+debian/control: debian/control.in check-vcs-version
+	sed -s 's/#VER#/$(VCS_VER)/g' debian/control.in > debian/control
 
-genfiles:
+genfiles: check-vcs-version
 	for file in debian/templates/*-VER*; do \
-		fname="$$(echo $$file | sed -e 's#VER#$(VER)#' -e 's#templates/##')"; \
-		sed -e 's/@version@/$(VER)/g' $$file >"$$fname"; \
+		fname="$$(echo $$file | sed -e 's#VER#$(VCS_VER)#' -e 's#templates/##')"; \
+		sed -e 's/@version@/$(VCS_VER)/g' $$file >"$$fname"; \
 	done
 
-	for package in ganeti-haskell-$(VER) ganeti-htools-$(VER) ganeti-$(VER); do \
+	for package in ganeti-haskell-$(VCS_VER) ganeti-htools-$(VCS_VER) ganeti-$(VCS_VER); do \
 		for file in debian/templates/versioned.*; do \
 			kind="$$(echo $$file | sed -r 's#.*\.(.*)#\1#')"; \
 			sed -e "s/@package@/$$package/g" \
-			    -e 's/@version@/$(VER)/g' \
+			    -e 's/@version@/$(VCS_VER)/g' \
 			    "$$file" > "debian/$${package}.$${kind}"; \
 		done; \
 	done
@@ -143,4 +152,4 @@ override_dh_auto_test:
 .PHONY: override_dh_auto_configure override_dh_auto_clean override_dh_auto_build \
 	override_dh_installinit override_dh_install-indep override_dh_sphinxdoc-arch \
 	override_dh_auto_test override_dh_compress override_dh_python2 \
-	override_dh_link genfiles override_dh_autoreconf
+	override_dh_link genfiles override_dh_autoreconf check-vcs-version

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ganeti/ganeti.git



More information about the Pkg-ganeti-devel mailing list