Bug 1747879 - Do not set MOZ_SOURCE environment variables in build jobs. r=darktrojan
Debug .sym files contained incorrect VCS references due to MOZ_SOURCE_REPO and MOZ_SOURCE_CHANGESET being set in the environment reffering to the Thunderbird repository. mozconfigure will handle setting these values in the buildconfig. See D135299. Differential Revision: https://phabricator.services.mozilla.com/D135392
This commit is contained in:
Родитель
09a66a0fe6
Коммит
b01c4d680c
|
@ -4,9 +4,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# Attempt to ascertain the Gecko source repository information. This is
|
||||
# necessary because MOZ_SOURCE_REPOSITORY and MOZ_SOURCE_CHANGESET both refer
|
||||
# to the Thunderbird (comm) repository.
|
||||
# Attempt to ascertain the Gecko source repository information.
|
||||
# We need to have accurate source repository information for MPL compliance.
|
||||
|
||||
|
||||
|
@ -105,12 +103,12 @@ def comm_repo_from_environ(app):
|
|||
"""
|
||||
Read the Thunderbird source repository information from the environment.
|
||||
|
||||
Taskcluster builds set MOZ_SOURCE_REPO and MOZ_SOURCE_CHANGESET pointing
|
||||
Taskcluster builds set COMM_HEAD_REPOSITORY and COMM_HEAD_REV pointing
|
||||
to the comm-* repository.
|
||||
"""
|
||||
log.info("Determining COMM source information from environment...")
|
||||
comm_repo = environ.get("MOZ_SOURCE_REPO", None)
|
||||
comm_rev = environ.get("MOZ_SOURCE_CHANGESET", None)
|
||||
comm_repo = environ.get("COMM_HEAD_REPOSITORY", None)
|
||||
comm_rev = environ.get("COMM_HEAD_REV", None)
|
||||
|
||||
if all([comm_repo, comm_rev]):
|
||||
comm_repo = ensure_text(comm_repo)
|
||||
|
@ -130,21 +128,13 @@ comm_sourcestamp = read_sourcestamp("COMM")
|
|||
def comm_repo_heuristics(comm_environ, paths, hg, sourcestamp):
|
||||
"""
|
||||
Determine the Thunderbird Mercurial repository and revision from Mercurial
|
||||
or sourcestamp.txt when MOZ_SOURCE_REPO and MOZ_SOURCE_CHANGESET are unset
|
||||
or sourcestamp.txt when COMM_HEAD_REPOSITORY and COMM_HEAD_REV are unset
|
||||
(local developer builds).
|
||||
|
||||
In that case, MOZ_SOURCE_REPO and MOZ_SOURCE_CHANGESET are set
|
||||
by build/variables.py, but will refer to the mozilla- repository,
|
||||
which is incorrect for Thunderbird builds.
|
||||
|
||||
There's no set_config call for MOZ_SOURCE_REPO or MOZ_SOURCE_CHANGESET
|
||||
here as that will be done when old-configure runs later. Here we just
|
||||
set the environment variables the same as Taskcluster would.
|
||||
"""
|
||||
if not comm_environ:
|
||||
comm_repo = comm_rev = None
|
||||
if hg:
|
||||
log.info("Determining COMM source information from " "Mercurial...")
|
||||
log.info("Determining COMM source information from Mercurial...")
|
||||
comm_rev = hg_cmd_output(
|
||||
hg, "-R", paths.commtopsrcdir, "parent", "--template={node}"
|
||||
)
|
||||
|
@ -162,16 +152,12 @@ def comm_repo_heuristics(comm_environ, paths, hg, sourcestamp):
|
|||
except:
|
||||
pass
|
||||
|
||||
# If values are found, set MOZ_SOURCE_REPO and MOZ_SOURCE_CHANGESET
|
||||
if comm_repo and comm_rev:
|
||||
environ["MOZ_SOURCE_REPO"] = comm_repo
|
||||
environ["MOZ_SOURCE_CHANGESET"] = comm_rev
|
||||
|
||||
if comm_repo and comm_rev:
|
||||
return namespace(comm_repo=comm_repo, comm_rev=comm_rev)
|
||||
|
||||
|
||||
@depends(comm_repo_from_environ, comm_repo_heuristics, "MOZ_AUTOMATION")
|
||||
@imports(_from="os", _import="environ")
|
||||
def comm_source_repo(from_environ, from_config, automation):
|
||||
rv = None
|
||||
if from_environ:
|
||||
|
@ -179,13 +165,19 @@ def comm_source_repo(from_environ, from_config, automation):
|
|||
elif from_config:
|
||||
rv = from_config
|
||||
elif automation:
|
||||
die(get_fail_msg("COMM", "MOZ_SOURCE_REPO", "MOZ_SOURCE_CHANGESET"))
|
||||
die(get_fail_msg("COMM", "COMM_HEAD_REPOSITORY", "COMM_HEAD_REV"))
|
||||
else:
|
||||
log.info(get_fail_msg("COMM", "MOZ_SOURCE_REPO", "MOZ_SOURCE_CHANGESET"))
|
||||
log.info(get_fail_msg("COMM", "COMM_HEAD_REPOSITORY", "COMM_HEAD_REV"))
|
||||
rv = namespace(comm_repo="unknown", comm_rev="unknown")
|
||||
|
||||
log.info("COMM_SOURCE_REPOSITORY: {}".format(rv.comm_repo))
|
||||
log.info("COMM_SOURCE_CHANGESET: {}".format(rv.comm_rev))
|
||||
|
||||
# Used by old-configure to set in buildconfig. This is configure's environment
|
||||
# not the same as used by the build itself.
|
||||
environ["MOZ_SOURCE_REPO"] = rv.comm_repo
|
||||
environ["MOZ_SOURCE_CHANGESET"] = rv.comm_rev
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
|
@ -238,9 +230,7 @@ def gecko_repo_heuristics(gecko_environ, paths, hg, sourcestamp, gecko_yml):
|
|||
# "default" when a revision hash is needed. Try to query
|
||||
# Mercurial first.
|
||||
if hg:
|
||||
log.info(
|
||||
"Determining GECKO source information from " "Mercurial..."
|
||||
)
|
||||
log.info("Determining GECKO source information from Mercurial...")
|
||||
gecko_rev = hg_cmd_output(
|
||||
hg, "-R", paths.moztopsrcdir, "parent", "--template={node}"
|
||||
)
|
||||
|
|
|
@ -13,6 +13,7 @@ transforms:
|
|||
- gecko_taskgraph.transforms.build_attrs:transforms
|
||||
- gecko_taskgraph.transforms.build_lints:transforms
|
||||
- gecko_taskgraph.transforms.job:transforms
|
||||
- comm_taskgraph.transforms.tb_build:transforms
|
||||
- gecko_taskgraph.transforms.task:transforms
|
||||
|
||||
jobs-from:
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
# 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 http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import logging
|
||||
|
||||
from gecko_taskgraph.transforms.base import TransformSequence
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
transforms = TransformSequence()
|
||||
|
||||
|
||||
@transforms.add
|
||||
def munge_environment(config, jobs):
|
||||
for job in jobs:
|
||||
env = job["worker"]["env"]
|
||||
# Remove MOZ_SOURCE_CHANGESET/REPO from the job environment and discard
|
||||
# if present. Having these variables set in the environment causes problems
|
||||
# with generating debug sym files. Bug 1747879.
|
||||
env.pop("MOZ_SOURCE_CHANGESET", None)
|
||||
env.pop("MOZ_SOURCE_REPO", None)
|
||||
|
||||
yield job
|
Загрузка…
Ссылка в новой задаче