summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-11-12 17:26:06 +0100
committerJelmer Vernooij <jelmer@samba.org>2010-11-12 17:42:13 +0000
commita0c2040ab698c8f053d12b4f53b0ac76a8f5ebac (patch)
tree9139f8b210a4293ad4f144cbc9031830b276c28f
parent45af495695a83636e79a810e212542d7c292a9ac (diff)
downloadsamba-a0c2040ab698c8f053d12b4f53b0ac76a8f5ebac.tar.gz
samba-a0c2040ab698c8f053d12b4f53b0ac76a8f5ebac.tar.bz2
samba-a0c2040ab698c8f053d12b4f53b0ac76a8f5ebac.zip
samba_version: Support retrieving snapshot identity from bzr.
-rw-r--r--buildtools/wafsamba/samba_version.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py
index bbd6439efc..e72e4ae6f0 100644
--- a/buildtools/wafsamba/samba_version.py
+++ b/buildtools/wafsamba/samba_version.py
@@ -1,6 +1,27 @@
import os
import Utils
+def bzr_version_summary():
+ vi = dict([l.split(":", 1) for l in Utils.cmd_output("bzr version-info").splitlines()])
+
+ ret = "BZR-%d" % (vi["revno"])
+
+ fields = {
+ "BZR_REVISION_ID": vi["revision-id"],
+ "BZR_REVNO": vi["revno"],
+ "BZR_DATE": vi["date"],
+ "BZR_BRANCH": vi["branch-nick"],
+ }
+
+ clean = Utils.cmd_output('bzr diff | wc -l', silent=True)
+ if clean == "0\n":
+ fields["BZR_COMMIT_IS_CLEAN"] = "1"
+ else:
+ fields["BZR_COMMIT_IS_CLEAN"] = "0"
+ ret += "+"
+ return (ret, fields)
+
+
def git_version_summary(have_git):
# Get version from GIT
if not have_git:
@@ -93,6 +114,8 @@ also accepted as dictionary entries here
if self.IS_SNAPSHOT:
if os.path.exists(".git"):
suffix, self.vcs_fields = git_version_summary(have_git)
+ elif os.path.exists(".bzr"):
+ suffix, self.vcs_fields = bzr_version_summary()
else:
suffix = "UNKNOWN"
self.vcs_fields = {}