author Sebastian Hengst <>
Mon, 22 May 2017 16:20:56 +0200
changeset 582577 c36497319158aaaf1ba7e28754e9b59b9cf3c441
parent 330557 9f791573855763afbb8455d9ddf150e4503166f3
child 585516 8cc969aa0d37a0688b8bbf2c52050ab1844473d2
child 798273 2b9035148a8b55bdd0ab2fc7738286317e034114
permissions -rw-r--r--
Backed out changeset 78e8b1f01c25 (bug 1361661) for flake8 linting failures in gen-process-{data,enum}.py and build bustage in TelemetryProcessData.h on OS X, at least. r=backout on a CLOSED TREE

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at

from optparse import OptionParser
import sys
import re

o = OptionParser()
o.add_option("--buildid", dest="buildid")
o.add_option("--version", dest="version")

(options, args) = o.parse_args()

if not options.buildid:
    print >>sys.stderr, "--buildid is required"

if not options.version:
    print >>sys.stderr, "--version is required"

# We want to build a version number that matches the format allowed for
# CFBundleVersion (nnnnn[.nn[.nn]]). We'll incorporate both the version
# number as well as the date, so that it changes at least daily (for nightly
# builds), but also so that newly-built older versions (e.g. beta build) aren't
# considered "newer" than previously-built newer versions (e.g. a trunk nightly)

define, MOZ_BUILDID, buildid = open(options.buildid, 'r').read().split()

# extract only the major version (i.e. "14" from "14.0b1")
majorVersion = re.match(r'^(\d+)[^\d].*', options.version).group(1)
# last two digits of the year
twodigityear = buildid[2:4]
month = buildid[4:6]
if month[0] == '0':
  month = month[1]
day = buildid[6:8]
if day[0] == '0':
  day = day[1]

print '%s.%s.%s' % (majorVersion + twodigityear, month, day)