Skip to content

Commit 07addfe

Browse files
committed
If git build sccs file is present, catenate it to standard output with these brand new commands
1 parent 70a5299 commit 07addfe

5 files changed

Lines changed: 42 additions & 5 deletions

File tree

cloud.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ intelligent cloud implementation.
4444
%package utils
4545
Summary: Cloud.com utility library
4646
Requires: java >= 1.6.0
47+
Requires: python
4748
Group: System Environment/Libraries
4849
Obsoletes: vmops-utils < %{version}-%{release}
4950
%description utils

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Provides: vmops-utils
2222
Conflicts: vmops-utils
2323
Replaces: vmops-utils
2424
Architecture: any
25-
Depends: openjdk-6-jre
25+
Depends: openjdk-6-jre, python
2626
Description: Cloud.com utility library
2727
The Cloud.com utility libraries provide a set of Java classes used
2828
in the Cloud.com Cloud Stack.

utils/bindir/cloud-gitrevs.in

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env python
2+
3+
import os, sys
4+
5+
path = os.path.join("@DOCDIR@","sccs-info")
6+
try: text = file(path).read(-1)
7+
except IOError,e:
8+
if e.errno == 2:
9+
sys.stderr.write("error: SCCS info file %r cannot be found\n"%path)
10+
sys.exit(1)
11+
else: raise
12+
lines = [ s.strip() for s in text.split("\n") if s.startswith('Git Revision: ') ]
13+
print " ".join( [ s[14:] for s in lines ] )

utils/bindir/cloud-sccs.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python
2+
3+
import os, sys
4+
5+
path = os.path.join("@DOCDIR@","sccs-info")
6+
try: text = file(path).read(-1)
7+
except IOError,e:
8+
if e.errno == 2:
9+
sys.stderr.write("error: SCCS info file %r cannot be found\n"%path)
10+
sys.exit(1)
11+
else: raise
12+
print text

wscript

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ def svninfo(*args):
144144
else: url = "SVN " + url[0].strip()
145145
return rev + "\n" + url
146146

147-
def gitinfo(*args):
148-
try: p = _Popen(['git','remote','show','-n','origin']+list(args),stdin=PIPE,stdout=PIPE,stderr=PIPE)
147+
def gitinfo(dir=None):
148+
if dir and not _isdir(dir): return ''
149+
try: p = _Popen(['git','remote','show','-n','origin'],stdin=PIPE,stdout=PIPE,stderr=PIPE,cwd=dir)
149150
except OSError,e:
150151
if e.errno == 2: return '' # svn command is not installed
151152
raise
@@ -158,7 +159,7 @@ def gitinfo(*args):
158159
except IndexError: url = [ s[5:] for s in stdout if s.startswith("URL") ][0]
159160
assert url
160161

161-
p = _Popen(['git','log','-1']+list(args),stdin=PIPE,stdout=PIPE,stderr=PIPE)
162+
p = _Popen(['git','log','-1'],stdin=PIPE,stdout=PIPE,stderr=PIPE,cwd=dir)
162163
stdout,stderr = p.communicate('')
163164
retcode = p.wait()
164165
if retcode: return
@@ -169,6 +170,15 @@ def gitinfo(*args):
169170

170171
return "Git Revision: %s"%commitid + "\n" + "Git URL: %s"%url
171172

173+
def allgitinfo():
174+
t = gitinfo()
175+
if not t: return t
176+
177+
u = gitinfo(_join(pardir,"cloudstack-proprietary"))
178+
if not u: return t
179+
180+
return t + "\n\ncloustack-proprietary:\n" + u
181+
172182
def _getbuildnumber(): # FIXME implement for git
173183
n = Options.options.BUILDNUMBER
174184
if n:
@@ -230,6 +240,7 @@ def discover_ant_targets_and_properties(files):
230240
propsinpropfiles = [ l.strip().split("=",1) for f in files if f.endswith(".properties") for l in file(f).readlines() if "=" in l and not l.startswith("#") ]
231241
props = dict( propsinxml + propsinpropfiles )
232242
props["base.dir"] = '.'
243+
props["p.base.dir"] = '.'
233244

234245
result = []
235246
for name,target in targets.items():
@@ -528,7 +539,7 @@ def dist_hook():
528539
if Options.options.OSS:
529540
[ shutil.rmtree(f) for f in "cloudstack-proprietary".split() if _exists(f) ]
530541

531-
stdout = svninfo("..") or gitinfo()
542+
stdout = svninfo("..") or allgitinfo()
532543
if stdout:
533544
f = file("sccs-info","w")
534545
f.write(stdout)

0 commit comments

Comments
 (0)