Bug 1904609 - Provide a function to get the build id r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D214841
This commit is contained in:
@@ -10,6 +10,14 @@ from datetime import datetime
|
||||
SOURCESTAMP_FILENAME = "sourcestamp.txt"
|
||||
|
||||
|
||||
def get_buildid():
|
||||
import buildconfig
|
||||
|
||||
path = os.path.join(buildconfig.topobjdir, "buildid.h")
|
||||
_define, _MOZ_BUILDID, buildid = open(path, "r", encoding="utf-8").read().split()
|
||||
return buildid
|
||||
|
||||
|
||||
def buildid_header(output):
|
||||
buildid = os.environ.get("MOZ_BUILD_DATE")
|
||||
if buildid and len(buildid) != 14:
|
||||
@@ -17,6 +25,7 @@ def buildid_header(output):
|
||||
buildid = None
|
||||
if not buildid:
|
||||
buildid = datetime.now().strftime("%Y%m%d%H%M%S")
|
||||
# If this output changes, be sure to update `get_buildid()`.
|
||||
output.write("#define MOZ_BUILDID %s\n" % buildid)
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ from datetime import datetime
|
||||
|
||||
import buildconfig
|
||||
from mozbuild.preprocessor import Preprocessor
|
||||
from variables import get_buildid
|
||||
|
||||
TEMPLATE = """
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
@@ -95,12 +96,6 @@ def parse_module_ver(path, defines):
|
||||
return result
|
||||
|
||||
|
||||
def get_buildid():
|
||||
path = os.path.join(buildconfig.topobjdir, "buildid.h")
|
||||
define, MOZ_BUILDID, buildid = io.open(path, "r", encoding="utf-8").read().split()
|
||||
return buildid
|
||||
|
||||
|
||||
def last_winversion_segment(buildid, app_version_display):
|
||||
"""
|
||||
The last segment needs to fit into a 16 bit number. We also need to
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
import ctypes
|
||||
import errno
|
||||
import io
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
@@ -45,6 +44,7 @@ from mozbuild.util import memoize
|
||||
from mozpack import executables
|
||||
from mozpack.copier import FileRegistry
|
||||
from mozpack.manifests import InstallManifest, UnreadableInstallManifest
|
||||
from variables import get_buildid
|
||||
|
||||
# Utility classes
|
||||
|
||||
@@ -591,9 +591,8 @@ class Dumper:
|
||||
)
|
||||
|
||||
# Add the build ID if it's present
|
||||
path = os.path.join(buildconfig.topobjdir, "buildid.h")
|
||||
try:
|
||||
buildid = io.open(path, "r", encoding="utf-8").read().split()[2]
|
||||
buildid = get_buildid()
|
||||
cmdline.extend(
|
||||
[
|
||||
"--extra-info",
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
|
||||
|
||||
import os
|
||||
from io import StringIO
|
||||
|
||||
import buildconfig
|
||||
from mozbuild.preprocessor import Preprocessor
|
||||
from variables import get_buildid
|
||||
|
||||
|
||||
def main(output, input_file):
|
||||
@@ -34,11 +33,7 @@ def tests(output, buildid):
|
||||
|
||||
|
||||
def write_file(output, maybe_buildid):
|
||||
pp = Preprocessor()
|
||||
pp.out = StringIO()
|
||||
pp.do_include(os.path.join(buildconfig.topobjdir, "buildid.h"))
|
||||
buildid = pp.context["MOZ_BUILDID"] if maybe_buildid is None else maybe_buildid
|
||||
|
||||
buildid = maybe_buildid or get_buildid()
|
||||
keyword_extern = "extern" if maybe_buildid is None else ""
|
||||
attribute_used = "__attribute__((used))" if maybe_buildid is not None else ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user