Package: git-buildpackage Version: 0.8.6 Severity: wishlist Tags: patch Hello,
While migrating the cryptsetup packaging workflow to gbp, and playing around with several possible layouts and workflows, we decided that we'd prefer to use the upstream signed Git release tags as basis for creating the upstream tarball instead of using the upstream provided release tarballs. Problem is, that the format for upstream Git release tags is 'v1_2_3', which is not supported by git-buildpackage until now. In order to support tags that contain the release version in a different format than 1.2.3 [%(version)s] or 1-2-3 [%(hversion)s], at least basic version mangling for '--git-upstream-tag' is required. See attached patch which implements basic version mangling for '--git-upstream-tag' in a simple substitute fashion: if the provided format contains the syntax '%(version%OLD%NEW)s', then the version used for '%(version)s' has 'OLD' replaced by 'NEW'. This allows us to let gbp create the upstream tarball from upstream Git release tag for new releases: $ gbp buildpackage --git-upstream-tag="v%(version%.%_)s" In case that you like the approach and agree to add this feature to gbp, I could write a few corresponding words for the related paragraphs of gbp documentation. If you're not happy with the way it's implmented, just let me know why and we can search for a better solution :) Cheers, jonas -- System Information: Debian Release: stretch/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 4.7.0-1-amd64 (SMP w/4 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages git-buildpackage depends on: ii devscripts 2.16.8 ii git 1:2.10.1-1 ii man-db 2.7.5-1 ii python-dateutil 2.5.3-2 ii python-pkg-resources 28.0.0-1 ii python-six 1.10.0-3 pn python:any <none> Versions of packages git-buildpackage recommends: ii pristine-tar 1.37 ii python-requests 2.11.1-1 ii sbuild 0.71.0-2 Versions of packages git-buildpackage suggests: pn python-notify <none> ii sudo 1.8.17p1-2 ii unzip 6.0-20 -- no debconf information
commit f6a7e8f83935d74dc0cd67a5afa26b243357d04f Author: Jonas Meurer <jo...@freesources.org> Date: Sun Oct 30 23:44:34 2016 +0100 gbp/deb/git.py: add basic version mangling to version_to_tag() diff --git a/gbp/deb/git.py b/gbp/deb/git.py index 64cd321..3070d93 100644 --- a/gbp/deb/git.py +++ b/gbp/deb/git.py @@ -142,12 +142,18 @@ class DebianGitRepository(GitRepository): hversion is useful for upstreams with tagging policies that prohibit . characters. + %(version%A%B)s provides %(version)s with 'A' replaced by 'B'. + >>> 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' """ + r = re.search(r"\%\(version\%([^%s]+)\%([^\%]+)\)s", format) + if r: + format = re.sub(r"\%\(version\%[^%s]+\%[^\%]+\)s", "%(version)s", format) + version = version.replace(r.group(1), r.group(2)) return format_str(format, dict(version=DebianGitRepository._sanitize_version(version), hversion=DebianGitRepository._sanitize_version(version).replace('.', '-')))