Bug 1341214 - Define GECKO in a single location. r=dustin

Instead of every file trying to get the top source directory having an
ad-hoc definition that gets wrong if the files gets moved around for
some reason, define it in a more central location.
This commit is contained in:
Mike Hommey
2017-02-17 11:56:12 +09:00
parent 6b28dd24f0
commit eb5916da95
9 changed files with 13 additions and 14 deletions

View File

@@ -0,0 +1,7 @@
# 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 os
GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..'))

View File

@@ -21,6 +21,7 @@ from .util import (
calculate_head_rev calculate_head_rev
) )
from ..create import create_task from ..create import create_task
from .. import GECKO
from taskgraph.util.attributes import match_run_on_projects from taskgraph.util.attributes import match_run_on_projects
from taskgraph.util.schema import resolve_keyed_by from taskgraph.util.schema import resolve_keyed_by
@@ -32,7 +33,6 @@ JOB_TYPES = {
'decision-task': decision.run_decision_task, 'decision-task': decision.run_decision_task,
} }
GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..', '..'))
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
_session = None _session = None

View File

@@ -18,6 +18,7 @@ from .create import create_tasks
from .parameters import Parameters from .parameters import Parameters
from .taskgraph import TaskGraph from .taskgraph import TaskGraph
from actions import render_actions_json from actions import render_actions_json
from . import GECKO
from taskgraph.util.templates import Templates from taskgraph.util.templates import Templates
from taskgraph.util.time import ( from taskgraph.util.time import (
@@ -28,7 +29,6 @@ from taskgraph.util.time import (
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
ARTIFACTS_DIR = 'artifacts' ARTIFACTS_DIR = 'artifacts'
GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..'))
# For each project, this gives a set of parameters specific to the project. # For each project, this gives a set of parameters specific to the project.
# See `taskcluster/docs/parameters.rst` for information on parameters. # See `taskcluster/docs/parameters.rst` for information on parameters.

View File

@@ -18,8 +18,8 @@ from subprocess import Popen, PIPE
from io import BytesIO from io import BytesIO
from taskgraph.util import docker from taskgraph.util import docker
from . import GECKO
GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..'))
INDEX_URL = 'https://index.taskcluster.net/v1/task/' + docker.INDEX_PREFIX + '.{}.{}.hash.{}' INDEX_URL = 'https://index.taskcluster.net/v1/task/' + docker.INDEX_PREFIX + '.{}.{}.hash.{}'
ARTIFACT_URL = 'https://queue.taskcluster.net/v1/task/{}/artifacts/{}' ARTIFACT_URL = 'https://queue.taskcluster.net/v1/task/{}/artifacts/{}'

View File

@@ -5,7 +5,6 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import logging import logging
import os
from . import ( from . import (
target_tasks, target_tasks,
@@ -13,8 +12,6 @@ from . import (
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
GECKO = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..'))
filter_task_functions = {} filter_task_functions = {}

View File

@@ -9,6 +9,7 @@ import os
import urllib2 import urllib2
from . import base from . import base
from .. import GECKO
from taskgraph.util.docker import ( from taskgraph.util.docker import (
docker_image, docker_image,
generate_context_hash, generate_context_hash,
@@ -17,7 +18,6 @@ from taskgraph.util.docker import (
from taskgraph.util.templates import Templates from taskgraph.util.templates import Templates
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..', '..'))
# if running in a task, prefer to use the taskcluster proxy (http://taskcluster/), # if running in a task, prefer to use the taskcluster proxy (http://taskcluster/),
# otherwise hit the services directly # otherwise hit the services directly

View File

@@ -4,13 +4,10 @@
from __future__ import absolute_import, print_function, unicode_literals from __future__ import absolute_import, print_function, unicode_literals
import os
from .graph import Graph from .graph import Graph
from .util.python_path import find_object from .util.python_path import find_object
TASKCLUSTER_QUEUE_URL = "https://queue.taskcluster.net/v1/task/" TASKCLUSTER_QUEUE_URL = "https://queue.taskcluster.net/v1/task/"
GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..'))
class TaskGraph(object): class TaskGraph(object):

View File

@@ -7,8 +7,6 @@ Support for running toolchain-building jobs via dedicated scripts
from __future__ import absolute_import, print_function, unicode_literals from __future__ import absolute_import, print_function, unicode_literals
import os
from voluptuous import Schema, Optional, Required, Any from voluptuous import Schema, Optional, Required, Any
from taskgraph.transforms.job import run_job_using from taskgraph.transforms.job import run_job_using
@@ -18,9 +16,9 @@ from taskgraph.transforms.job.common import (
docker_worker_support_vcs_checkout, docker_worker_support_vcs_checkout,
) )
from taskgraph.util.hash import hash_paths from taskgraph.util.hash import hash_paths
from taskgraph import GECKO
GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..', '..', '..'))
TOOLCHAIN_INDEX = 'gecko.cache.level-{level}.toolchains.v1.{name}.{digest}' TOOLCHAIN_INDEX = 'gecko.cache.level-{level}.toolchains.v1.{name}.{digest}'
toolchain_run_schema = Schema({ toolchain_run_schema = Schema({

View File

@@ -14,9 +14,9 @@ import tempfile
from mozpack.archive import ( from mozpack.archive import (
create_tar_gz_from_files, create_tar_gz_from_files,
) )
from .. import GECKO
GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..', '..'))
IMAGE_DIR = os.path.join(GECKO, 'taskcluster', 'docker') IMAGE_DIR = os.path.join(GECKO, 'taskcluster', 'docker')
INDEX_PREFIX = 'docker.images.v2' INDEX_PREFIX = 'docker.images.v2'
ARTIFACT_URL = 'https://queue.taskcluster.net/v1/task/{}/artifacts/{}' ARTIFACT_URL = 'https://queue.taskcluster.net/v1/task/{}/artifacts/{}'