2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from optparse
import OptionParser
8 from datetime
import datetime
14 o
.add_option("--buildid", dest
="buildid")
15 o
.add_option("--print-buildid", action
="store_true", dest
="print_buildid")
16 o
.add_option("--print-timestamp", action
="store_true", dest
="print_timestamp")
17 o
.add_option("--sourcestamp", dest
="sourcestamp")
18 o
.add_option("--sourcerepo", dest
="sourcerepo")
20 (options
, args
) = o
.parse_args()
22 if options
.print_timestamp
:
23 print int(time
.time())
26 if options
.print_buildid
:
27 print datetime
.utcnow().strftime('%Y%m%d%H%M%S')
30 if not options
.buildid
:
31 print >>sys
.stderr
, "--buildid is required"
34 (milestoneFile
,) = args
35 for line
in open(milestoneFile
, 'r'):
47 Milestone=%s""" % (options
.buildid
, milestone
)
48 if options
.sourcestamp
:
49 print "SourceStamp=%s" % options
.sourcestamp
50 if options
.sourcerepo
:
51 print "SourceRepository=%s" % options
.sourcerepo