author Gregory Szorc <>
Tue, 24 May 2016 11:35:44 -0700
changeset 298842 32886f06e0fb2a5c2b58d49500b3baee59e970d4
parent 297801 54f2a1fe535f2c623142c42401b38413c887d305
child 298856 408319d87eacb28848efeab0346eb815440adade
permissions -rw-r--r--
Bug 1274655 - Resolve changeset when only repo is defined; r=mshal Previously, we required both or none of MOZ_SOURCE_REPO and MOZ_SOURCE_CHANGESET to be defined. This logic was established in 51029f4d82d3 (bug 1247162). There appears to be no good reason why we require MOZ_SOURCE_CHANGESET if MOZ_SOURCE_REPO is defined. After all, if we have a checkout we should be able to resolve the revision. This commit changes the logic to resolve the changeset when not defined. We still error if MOZ_SOURCE_REPO is defined but we can't resolve the changeset. I can't imagine this breaking anything. This change will be necessary to appease TaskCluster tasks once mozharness is changed in a subsequent commit to define MOZ_SOURCE_REPO. Buildbot and TC each have their own way of specifying the source revision. Rather than change mozharness, it feels easier to just have the build system derive things. This decision is further justified by the fact there is a chicken and egg problem in mozharness: the environment variable dict is resolved before source directory population. So, we'd need to teach mozharness about TC's VCS mechanism, which it currently has no knowledge of. I'd rather not do that. MozReview-Commit-ID: ANaoGbPGWj2

# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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


# Note:
# - Gecko-specific options and rules should go in toolkit/moz.configure.
# - Firefox-specific options and rules should go in browser/moz.configure.
# - Fennec-specific options and rules should go in
#   mobile/android/moz.configure.
# - Spidermonkey-specific options and rules should go in js/moz.configure.
# - etc.

# Multiprocess Firefox Testing UI - Nightly and Aurora
# To be removed in Bug 1003313
def e10s_testing_only(milestone):
    if not milestone.is_release:
        return True

set_config('E10S_TESTING_ONLY', e10s_testing_only)
set_define('E10S_TESTING_ONLY', e10s_testing_only)

option('--enable-artifact-builds', env='MOZ_ARTIFACT_BUILDS',
       help='Download and use prebuilt binary artifacts.')

def artifact_builds(value):
    if value:
        return True

set_config('MOZ_ARTIFACT_BUILDS', artifact_builds)

def imply_disable_compile_environment(value):
    if value:
        return False

imply_option('--enable-compile-environment', imply_disable_compile_environment)

       help='Disable compiler/library checks')

def compile_environment(compile_env):
    if compile_env:
        return True

set_config('COMPILE_ENVIRONMENT', compile_environment)
add_old_configure_assignment('COMPILE_ENVIRONMENT', compile_environment)

@depends('--disable-compile-environment', '--help')
def toolchain_include(compile_env, help):
    if compile_env:
        return 'build/moz.configure/toolchain.configure'


@depends('--disable-compile-environment', '--help')
def memory_include(compile_env, help):
    if compile_env:
        return 'build/moz.configure/memory.configure'


@imports(_from='mozbuild.backend', _import='backends')
def build_backends_choices(help):
    return tuple(backends)

option('--enable-build-backend', nargs='+', choices=build_backends_choices,
       help='Enable additional build backends')

@depends('--enable-build-backend', '--enable-artifact-builds')
def build_backend(backends, artifact_builds):
    if artifact_builds:
        all_backends = ['FasterMake+RecursiveMake']
        all_backends = ['RecursiveMake', 'FasterMake']
    return unique_list(all_backends)

set_config('BUILD_BACKENDS', build_backend)

# Awk detection
# ==============================================================
awk = check_prog('AWK', ('gawk', 'mawk', 'nawk', 'awk'))

# Until the AWK variable is not necessary in old-configure
def awk_for_old_configure(value):
    return value

add_old_configure_assignment('AWK', awk_for_old_configure)

# Perl detection
# ==============================================================
perl = check_prog('PERL', ('perl5', 'perl'))

# Until the PERL variable is not necessary in old-configure
def perl_for_old_configure(value):
    return value

add_old_configure_assignment('PERL', perl_for_old_configure)

def perl_version_check(min_version):
    @checking('for minimum required perl version >= %s' % min_version)
    def get_perl_version(perl):
        return Version(check_cmd_output(
            perl, '-e', 'print $]',
            onerror=lambda: die('Failed to get perl version.')

    def check_perl_version(version):
        if version < min_version:
            die('Perl %s or higher is required.', min_version)

    @checking('for full perl installation')
    def has_full_perl_installation(perl):
        ret =
            [perl, '-e', 'use Config; exit(!-d $Config{archlib})'])
        return ret == 0

    def require_full_perl_installation(has_full_perl_installation):
        if not has_full_perl_installation:
            die('Cannot find or $Config{archlib}. '
                'A full perl installation is required.')


# Miscellaneous programs
# ==============================================================
check_prog('DOXYGEN', ('doxygen',), allow_missing=True)
check_prog('XARGS', ('xargs',))

def extra_programs(target):
    if target.kernel == 'Darwin':
        return namespace(
            DSYMUTIL=('dsymutil', 'llvm-dsymutil'),
    if target.os == 'GNU' and target.kernel == 'Linux':
        return namespace(RPMBUILD=('rpmbuild',))

check_prog('DSYMUTIL', delayed_getattr(extra_programs, 'DSYMUTIL'),
check_prog('GENISOIMAGE', delayed_getattr(extra_programs, 'GENISOIMAGE'),
check_prog('RPMBUILD', delayed_getattr(extra_programs, 'RPMBUILD'),

       help="Use system hunspell (located with pkgconfig)")

@depends('--enable-system-hunspell', compile_environment)
def check_for_hunspell(value, compile_env):
    return value and compile_env

system_hunspell = pkg_check_modules('MOZ_HUNSPELL', 'hunspell',

set_config('MOZ_SYSTEM_HUNSPELL', system_hunspell)

# Fallthrough to autoconf-based configure
# Please do not add anything after the include of old.configure.