2007-07-02 18:20:24 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
from optparse import OptionParser
|
|
|
|
from datetime import datetime
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
|
|
|
|
o = OptionParser()
|
2008-01-14 15:24:19 +00:00
|
|
|
o.add_option("--buildid", dest="buildid")
|
2007-07-02 18:20:24 +00:00
|
|
|
o.add_option("--print-buildid", action="store_true", dest="print_buildid")
|
2009-02-16 13:32:39 +00:00
|
|
|
o.add_option("--sourcestamp", dest="sourcestamp")
|
|
|
|
o.add_option("--sourcerepo", dest="sourcerepo")
|
2007-07-02 18:20:24 +00:00
|
|
|
|
|
|
|
(options, args) = o.parse_args()
|
|
|
|
|
|
|
|
if options.print_buildid:
|
2008-08-07 18:10:47 +00:00
|
|
|
print datetime.now().strftime('%Y%m%d%H%M%S')
|
2007-07-02 18:20:24 +00:00
|
|
|
sys.exit(0)
|
|
|
|
|
2008-01-14 15:24:19 +00:00
|
|
|
if not options.buildid:
|
|
|
|
print >>sys.stderr, "--buildid is required"
|
|
|
|
sys.exit(1)
|
|
|
|
|
2007-07-02 18:20:24 +00:00
|
|
|
(milestoneFile,) = args
|
|
|
|
for line in open(milestoneFile, 'r'):
|
|
|
|
if line[0] == '#':
|
|
|
|
continue
|
|
|
|
|
|
|
|
line = line.strip()
|
|
|
|
if line == '':
|
|
|
|
continue
|
|
|
|
|
|
|
|
milestone = line
|
|
|
|
|
|
|
|
print """[Build]
|
|
|
|
BuildID=%s
|
2008-01-14 15:24:19 +00:00
|
|
|
Milestone=%s""" % (options.buildid, milestone)
|
2009-02-16 13:32:39 +00:00
|
|
|
if options.sourcestamp:
|
|
|
|
print "SourceStamp=%s" % options.sourcestamp
|
|
|
|
if options.sourcerepo:
|
|
|
|
print "SourceRepository=%s" % options.sourcerepo
|