Nicolas Bock has proposed merging ~nicolasbock/git-build-recipe:long into git-build-recipe:master.
Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~nicolasbock/git-build-recipe/+git/git-build-recipe/+merge/447167 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~nicolasbock/git-build-recipe:long into git-build-recipe:master.
diff --git a/gitbuildrecipe/deb_version.py b/gitbuildrecipe/deb_version.py index f70bc49..b0dc038 100644 --- a/gitbuildrecipe/deb_version.py +++ b/gitbuildrecipe/deb_version.py @@ -25,6 +25,7 @@ from gitbuildrecipe.recipe import ( FormattedError, GitCommitVariable, LatestTagVariable, + LatestTagLongVariable, RevdateVariable, RevnoVariable, RevtimeVariable, @@ -199,6 +200,9 @@ def substitute_branch_vars(base_branch, child_branch): base_branch.deb_version = git_commit_var.replace(base_branch.deb_version) latest_tag_var = LatestTagVariable(child_branch) base_branch.deb_version = latest_tag_var.replace(base_branch.deb_version) + latest_tag_long_var = LatestTagLongVariable(child_branch) + base_branch.deb_version = latest_tag_long_var.replace( + base_branch.deb_version) revdate_var = RevdateVariable(child_branch) base_branch.deb_version = revdate_var.replace(base_branch.deb_version) revtime_var = RevtimeVariable(child_branch) diff --git a/gitbuildrecipe/recipe.py b/gitbuildrecipe/recipe.py index f932ca7..ee29ae5 100644 --- a/gitbuildrecipe/recipe.py +++ b/gitbuildrecipe/recipe.py @@ -238,9 +238,24 @@ class LatestTagVariable(RevisionVariable): stderr=subprocess.STDOUT).rstrip("\n") +class LatestTagLongVariable(RevisionVariable): + + basename = "latest-tag-long" + + minimum_format = 0.4 + + def get(self): + # Capture stderr so that exceptions are useful. We know that git + # describe does not write to stderr on success. + return self.branch.git_output( + "describe", "--tags", "--abbrev=7", self.commit, + stderr=subprocess.STDOUT).rstrip("\n") + + branch_vars = [ GitCommitVariable, LatestTagVariable, + LatestTagLongVariable, RevdateVariable, RevtimeVariable, ]
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp