Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | #!/usr/bin/python |
michael@0 | 2 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | from optparse import OptionParser |
michael@0 | 8 | import sys |
michael@0 | 9 | import re |
michael@0 | 10 | |
michael@0 | 11 | o = OptionParser() |
michael@0 | 12 | o.add_option("--buildid", dest="buildid") |
michael@0 | 13 | o.add_option("--version", dest="version") |
michael@0 | 14 | |
michael@0 | 15 | (options, args) = o.parse_args() |
michael@0 | 16 | |
michael@0 | 17 | if not options.buildid: |
michael@0 | 18 | print >>sys.stderr, "--buildid is required" |
michael@0 | 19 | sys.exit(1) |
michael@0 | 20 | |
michael@0 | 21 | if not options.version: |
michael@0 | 22 | print >>sys.stderr, "--version is required" |
michael@0 | 23 | sys.exit(1) |
michael@0 | 24 | |
michael@0 | 25 | # We want to build a version number that matches the format allowed for |
michael@0 | 26 | # CFBundleVersion (nnnnn[.nn[.nn]]). We'll incorporate both the version |
michael@0 | 27 | # number as well as the date, so that it changes at least daily (for nightly |
michael@0 | 28 | # builds), but also so that newly-built older versions (e.g. beta build) aren't |
michael@0 | 29 | # considered "newer" than previously-built newer versions (e.g. a trunk nightly) |
michael@0 | 30 | |
michael@0 | 31 | buildid = open(options.buildid, 'r').read() |
michael@0 | 32 | |
michael@0 | 33 | # extract only the major version (i.e. "14" from "14.0b1") |
michael@0 | 34 | majorVersion = re.match(r'^(\d+)[^\d].*', options.version).group(1) |
michael@0 | 35 | # last two digits of the year |
michael@0 | 36 | twodigityear = buildid[2:4] |
michael@0 | 37 | month = buildid[4:6] |
michael@0 | 38 | if month[0] == '0': |
michael@0 | 39 | month = month[1] |
michael@0 | 40 | day = buildid[6:8] |
michael@0 | 41 | if day[0] == '0': |
michael@0 | 42 | day = day[1] |
michael@0 | 43 | |
michael@0 | 44 | print '%s.%s.%s' % (majorVersion + twodigityear, month, day) |