You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2012/07/26 23:05:06 UTC
[6/50] git commit: waf: Generate sccs-info file
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/rbd
Commit: 216a44882eaaa44a7bac3fefe063e172a4d5cb4d
Parents: 8ddb627
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Wed Jul 25 23:09:32 2012 +0200
Committer: Wido den Hollander <wi...@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")