Skip to content

Commit c5a25a2

Browse files
yadvrPrasanna Santhanam
authored andcommitted
waf: Fix how waf gets build id
Use git to output revision shortlen SHA Signed-off-by: Prasanna Santhanam <tsp@apache.org>
1 parent 465e046 commit c5a25a2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

wscript

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def svninfo(*args):
161161

162162
def gitinfo(dir=None):
163163
if dir and not _isdir(dir): return ''
164-
try: p = _Popen(['git','remote','show','-n','origin'],stdin=PIPE,stdout=PIPE,stderr=PIPE,cwd=dir)
164+
try: p = _Popen(['git','rev-parse', '--short', 'HEAD'],stdin=PIPE,stdout=PIPE,stderr=PIPE,cwd=dir)
165165
except OSError,e:
166166
if e.errno == 2: return '' # svn command is not installed
167167
raise
@@ -194,7 +194,7 @@ def allgitinfo():
194194

195195
return t + "\n\ncloustack-proprietary:\n" + u
196196

197-
def _getbuildnumber(): # FIXME implement for git
197+
def _getbuildnumber():
198198
n = Options.options.BUILDNUMBER
199199
if n:
200200
# luntbuild prepends "build-" to the build number. we work around this here:
@@ -203,8 +203,8 @@ def _getbuildnumber(): # FIXME implement for git
203203
if n.startswith("$Revision:"): n = n[11:-2].strip()
204204
return n
205205
else:
206-
# Try to guess the SVN revision number by calling SVN info.
207-
stdout = svninfo()
206+
# Try to guess the Git revision number
207+
stdout = gitinfo()
208208
if not stdout: return ''
209209
# Filter lines.
210210
rev = [ x for x in stdout.splitlines() if x.startswith('SVN Revision') ]

0 commit comments

Comments
 (0)