incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [36/50] [abbrv] git commit: waf: Generate sccs-info file
Date Fri, 27 Jul 2012 21:01:32 GMT
waf: Generate sccs-info file

This has been broken for a long time right now, this is a quick fix to get the generation
working again.

This enables us to build the Debian packages again with:

$ dpkg-buildpackage

WAF still needs to go though :)


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/216a4488
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/216a4488
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/216a4488

Branch: refs/heads/vpc
Commit: 216a44882eaaa44a7bac3fefe063e172a4d5cb4d
Parents: 8ddb627
Author: Wido den Hollander <wido@widodh.nl>
Authored: Wed Jul 25 23:09:32 2012 +0200
Committer: Wido den Hollander <wido@widodh.nl>
Committed: Wed Jul 25 23:09:32 2012 +0200

----------------------------------------------------------------------
 wscript_build |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/216a4488/wscript_build
----------------------------------------------------------------------
diff --git a/wscript_build b/wscript_build
index 89e5903..a257122 100644
--- a/wscript_build
+++ b/wscript_build
@@ -10,6 +10,7 @@ import Utils,Node,Options,Logs,Scripting,Environment,Build,Configure
 from os import unlink as _unlink, makedirs as _makedirs, getcwd as _getcwd, chdir as _chdir
 from os.path import abspath as _abspath, basename as _basename, dirname as _dirname, exists
as _exists, isdir as _isdir, split as _split, join as _join, sep, pathsep, pardir, curdir
 from glob import glob as _glob
+from subprocess import Popen as _Popen,PIPE
 try: set([1,2,3])
 except Exception: from Sets import set
 import re
@@ -31,7 +32,49 @@ filelist = bld.path.ant_glob
 distdir = Utils.relpath(_join(sourcedir,"dist"))
 targetdir = Utils.relpath(_join(sourcedir,"target"))
 
+def gitinfo(dir=None):
+	if dir and not _isdir(dir): return ''
+	try: p = _Popen(['git','remote','show','-n','origin'],stdin=PIPE,stdout=PIPE,stderr=PIPE,cwd=dir)
+	except OSError,e:
+		if e.errno == 2: return '' # svn command is not installed
+		raise
+	stdout,stderr = p.communicate('')
+	retcode = p.wait()
+	# If the guess fails, just return nothing.
+	if retcode: return
+	stdout = [ s.strip() for s in stdout.splitlines() ]
+	try: url = [ s[11:] for s in stdout if s.startswith("Fetch URL") ][0]
+	except IndexError: url = [ s[5:] for s in stdout if s.startswith("URL") ][0]
+	assert url
+	
+	p = _Popen(['git','log','-1'],stdin=PIPE,stdout=PIPE,stderr=PIPE,cwd=dir)
+	stdout,stderr = p.communicate('')
+	retcode = p.wait()
+	if retcode: return
+	# If the guess fails, just return nothing.
+	stdout = [ s.strip() for s in stdout.splitlines() ]
+	commitid = [ s.split()[1] for s in stdout if s.startswith("commit") ][0]
+	assert commitid
+	
+	return "Git Revision: %s"%commitid + "\n" + "Git URL: %s"%url + "\n"
+
 def build_utils_docs ():
+	stdout = gitinfo()
+	if stdout:
+		f = file("sccs-info","w")
+		f.write(stdout)
+		f.flush()
+		f.close()
+	else:
+		if _exists("sccs-info"):
+			# If the file already existed, we preserve it
+			return
+		else:
+			f = file("sccs-info","w")
+			f.write("No revision control information could be detected when the source distribution
was built.")
+			f.flush()
+			f.close()
+
 	sccsinfo = _join(sourcedir,"sccs-info")
 	if _exists(sccsinfo): bld.install_files("${DOCDIR}","sccs-info")
 


Mime
View raw message