toolkit/xre/make-platformini.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/xre/make-platformini.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +#!/usr/bin/python
     1.5 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 +
     1.9 +
    1.10 +from optparse import OptionParser
    1.11 +from datetime import datetime
    1.12 +import time
    1.13 +import sys
    1.14 +import os
    1.15 +
    1.16 +o = OptionParser()
    1.17 +o.add_option("--buildid", dest="buildid")
    1.18 +o.add_option("--print-buildid", action="store_true", dest="print_buildid")
    1.19 +o.add_option("--print-timestamp", action="store_true", dest="print_timestamp")
    1.20 +o.add_option("--sourcestamp", dest="sourcestamp")
    1.21 +o.add_option("--sourcerepo", dest="sourcerepo")
    1.22 +
    1.23 +(options, args) = o.parse_args()
    1.24 +
    1.25 +if options.print_timestamp:
    1.26 +    print int(time.time())
    1.27 +    sys.exit(0)
    1.28 +
    1.29 +if options.print_buildid:
    1.30 +    print datetime.now().strftime('%Y%m%d%H%M%S')
    1.31 +    sys.exit(0)
    1.32 +
    1.33 +if not options.buildid:
    1.34 +    print >>sys.stderr, "--buildid is required"
    1.35 +    sys.exit(1)
    1.36 +
    1.37 +(milestoneFile,) = args
    1.38 +for line in open(milestoneFile, 'r'):
    1.39 +    if line[0] == '#':
    1.40 +        continue
    1.41 +
    1.42 +    line = line.strip()
    1.43 +    if line == '':
    1.44 +        continue
    1.45 +
    1.46 +    milestone = line
    1.47 +
    1.48 +print """[Build]
    1.49 +BuildID=%s
    1.50 +Milestone=%s""" % (options.buildid, milestone)
    1.51 +if options.sourcestamp:
    1.52 +    print "SourceStamp=%s" % options.sourcestamp
    1.53 +if options.sourcerepo:
    1.54 +    print "SourceRepository=%s" % options.sourcerepo

mercurial