From cb03293bd7e95e3e6a56947dff79c2afad8e3701 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Tue, 17 Mar 2015 14:55:06 -0400 Subject: Add %(hversion)s to version_to_tag to support some upstreams MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit enigmail upstream uses tags named enigmail-1-8 for 1.8. Other upstreams have used similar conventions, likely as holdovers from CVS (e.g. gnupg 1.4.2 was tagged with V1-4-2). This patch helps packagers work with these upstreams. Closes: #780679 Signed-off-by: Guido Günther --- gbp/deb/git.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'gbp') diff --git a/gbp/deb/git.py b/gbp/deb/git.py index 2a848d4..7746e86 100644 --- a/gbp/deb/git.py +++ b/gbp/deb/git.py @@ -102,10 +102,20 @@ class DebianGitRepository(GitRepository): def version_to_tag(format, version): """Generate a tag from a given format and a version + %(version)s provides a clean version that works as a git tag. + + %(hversion)s provides the same thing, but with '.' replaced + with '-'. hversion is useful for upstreams with tagging + policies that prohibit . characters. + >>> DebianGitRepository.version_to_tag("debian/%(version)s", "0:0~0") 'debian/0%0_0' + >>> DebianGitRepository.version_to_tag("libfoo-%(hversion)s", "1.8.1") + 'libfoo-1-8-1' + """ - return format_msg(format, dict(version=DebianGitRepository._sanitize_version(version))) + return format_msg(format, dict(version=DebianGitRepository._sanitize_version(version), + hversion=DebianGitRepository._sanitize_version(version).replace('.','-'))) @staticmethod def _sanitize_version(version): -- cgit v1.2.3