diff options
author | Guido Günther <agx@sigxcpu.org> | 2013-03-27 16:58:47 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2013-03-27 17:07:16 +0100 |
commit | 59254996d740b8b8a0db306a7e04950a5f4e51b8 (patch) | |
tree | bacd18904064e1dd3c30bf577d979eed831df64c /gbp/deb/git.py | |
parent | 3b873f75ef32c500e69da22dcfc73155414bb6d0 (diff) | |
download | git-buildpackage-59254996d740b8b8a0db306a7e04950a5f4e51b8.tar.gz git-buildpackage-59254996d740b8b8a0db306a7e04950a5f4e51b8.tar.bz2 git-buildpackage-59254996d740b8b8a0db306a7e04950a5f4e51b8.zip |
Split out building a debian version from an upstream commit
based on a patch by Daniel Dehennin
Needed for #672954, #646684, #669171
Diffstat (limited to 'gbp/deb/git.py')
-rw-r--r-- | gbp/deb/git.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gbp/deb/git.py b/gbp/deb/git.py index c9004ef8..c7b6e776 100644 --- a/gbp/deb/git.py +++ b/gbp/deb/git.py @@ -62,6 +62,28 @@ class DebianGitRepository(GitRepository): return None return None + def debian_version_from_upstream(self, upstream_tag_format, commit='HEAD', + epoch=None): + """ + Build the Debian version that a package based on upstream commit + I{commit} would carry taking into account a possible epoch. + + @param upstream_tag_format; the tag format on the upstream branch + @type upstream_tag_format; C{str} + @param commit: the commit to search for the latest upstream version + @param epoch: an epoch to use + @returns: a new debian version + @raises: L{GitRepositoryError} if no upstream tag was found + """ + pattern = upstream_tag_format % dict(version='*') + tag = self.find_tag(commit, pattern=pattern) + version = self.tag_to_version(tag, upstream_tag_format) + + version += "-1" + if epoch: + version = "%s:%s" % (epoch, version) + return version + @staticmethod def _build_legacy_tag(format, version): """ |