Backout Bug 1132771 for spidermonkey build bustage on CLOSED TREE
☠☠ backed out by ce21e7a57cf8 ☠ ☠
authorNigel Babu <nigelbabu@gmail.com>
Mon, 02 Mar 2015 17:13:05 +0530
changeset 246791 1cd9344eb281a4ddbbbc3637b6a549e49b532275
parent 246790 c4ec1a14df2dfe9839c7c5855dd9aab595326724
child 246792 b768d5460be09d04308cec054a65ce0f9f728f25
push id879
push usercliu@mozilla.com
push dateTue, 03 Mar 2015 03:02:53 +0000
bugs1132771
milestone39.0a1
Backout Bug 1132771 for spidermonkey build bustage on CLOSED TREE
build/docs/index.rst
build/moz.build
config/moz.build
moz.build
python/moz.build
python/mozbuild/mozbuild/frontend/context.py
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/frontend/mach_commands.py
python/mozbuild/mozbuild/frontend/reader.py
python/mozbuild/mozbuild/test/frontend/test_reader.py
services/common/moz.build
services/crypto/moz.build
services/sync/moz.build
--- a/build/docs/index.rst
+++ b/build/docs/index.rst
@@ -8,17 +8,16 @@ Important Concepts
    :maxdepth: 1
 
    glossary
    build-overview
    supported-configurations
    Mozconfig Files <mozconfigs>
    mozbuild-files
    mozbuild-symbols
-   files-metadata
    Profile Guided Optimization <pgo>
    slow
    environment-variables
    build-targets
    python
    test_manifests
    mozinfo
    preprocessor
--- a/build/moz.build
+++ b/build/moz.build
@@ -1,17 +1,14 @@
 # -*- 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 http://mozilla.org/MPL/2.0/.
 
-with Files('**'):
-    BUG_COMPONENT = ('Core', 'Build Config')
-
 # This cannot be named "build" because of bug 922191.
 SPHINX_TREES['buildsystem'] = 'docs'
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     DIRS += ['win32']
 else:
     DIRS += ['unix']
 
--- a/config/moz.build
+++ b/config/moz.build
@@ -1,17 +1,14 @@
 # -*- 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 http://mozilla.org/MPL/2.0/.
 
-with Files('**'):
-    BUG_COMPONENT = ('Core', 'Build Config')
-
 NO_DIST_INSTALL = True
 # For sanity's sake, we compile nsinstall without the wrapped system
 # headers, so that we can use it to set up the wrapped system headers.
 NO_VISIBILITY_FLAGS = True
 
 CONFIGURE_SUBST_FILES += [
     'doxygen.cfg',
     'makefiles/test/Makefile',
--- a/moz.build
+++ b/moz.build
@@ -1,18 +1,14 @@
 # -*- 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 http://mozilla.org/MPL/2.0/.
 
-with Files('**/Makefile.in'):
-    BUG_COMPONENT = ('Core', 'Build Config')
-    FINAL = True
-
 CONFIGURE_SUBST_FILES += [
     'config/autoconf.mk',
     'config/emptyvars.mk',
 ]
 
 if CONFIG['ENABLE_CLANG_PLUGIN']:
     DIRS += ['build/clang-plugin']
 
--- a/python/moz.build
+++ b/python/moz.build
@@ -1,20 +1,14 @@
 # -*- 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 http://mozilla.org/MPL/2.0/.
 
-with Files('mach/**'):
-    BUG_COMPONENT = ('Core', 'mach')
-
-with Files('mozbuild/**'):
-    BUG_COMPONENT = ('Core', 'Build Config')
-
 SPHINX_PYTHON_PACKAGE_DIRS += [
     'mach',
     'mozbuild/mozbuild',
     'mozbuild/mozpack',
     'mozversioncontrol/mozversioncontrol',
 ]
 
 SPHINX_TREES['mach'] = 'mach/docs'
--- a/python/mozbuild/mozbuild/frontend/context.py
+++ b/python/mozbuild/mozbuild/frontend/context.py
@@ -14,28 +14,28 @@ If you are looking for the absolute auth
 contain, you've come to the right place.
 """
 
 from __future__ import unicode_literals
 
 import os
 
 from collections import OrderedDict
+from contextlib import contextmanager
 from mozbuild.util import (
     HierarchicalStringList,
     HierarchicalStringListWithFlagsFactory,
     KeyedDefaultDict,
     List,
     memoize,
     memoized_property,
     ReadOnlyKeyedDefaultDict,
     StrictOrderingOnAppendList,
     StrictOrderingOnAppendListWithFlagsFactory,
     TypedList,
-    TypedNamedTuple,
 )
 import mozpack.path as mozpath
 from types import FunctionType
 from UserString import UserString
 
 import itertools
 
 
@@ -162,16 +162,17 @@ class Context(KeyedDefaultDict):
     @memoized_property
     def relobjdir(self):
         assert self.main_path
         return mozpath.relpath(mozpath.dirname(self.main_path),
             self.config.topsrcdir)
 
     def _factory(self, key):
         """Function called when requesting a missing key."""
+
         defaults = self._allowed_variables.get(key)
         if not defaults:
             raise KeyError('global_ns', 'get_unknown', key)
 
         # If the default is specifically a lambda (or, rather, any function
         # --but not a class that can be called), then it is actually a rule to
         # generate the default that should be used.
         default = defaults[0]
@@ -390,128 +391,25 @@ def ContextDerivedTypedList(type, base_c
                 def __new__(cls, obj):
                     return type(context, obj)
             self.TYPE = _Type
             super(_TypedList, self).__init__(iterable)
 
     return _TypedList
 
 
-BugzillaComponent = TypedNamedTuple('BugzillaComponent',
-                        [('product', unicode), ('component', unicode)])
-
-
-class Files(SubContext):
-    """Metadata attached to files.
-
-    It is common to want to annotate files with metadata, such as which
-    Bugzilla component tracks issues with certain files. This sub-context is
-    where we stick that metadata.
-
-    The argument to this sub-context is a file matching pattern that is applied
-    against the host file's directory. If the pattern matches a file whose info
-    is currently being sought, the metadata attached to this instance will be
-    applied to that file.
-
-    Patterns are collections of filename characters with ``/`` used as the
-    directory separate (UNIX-style paths) and ``*`` and ``**`` used to denote
-    wildcard matching.
-
-    Patterns without the ``*`` character are literal matches and will match at
-    most one entity.
-
-    Patterns with ``*`` or ``**`` are wildcard matches. ``*`` matches files
-    within a single directory. ``**`` matches files across several directories.
-    Here are some examples:
-
-    ``foo.html``
-       Will match only the ``foo.html`` file in the current directory.
-    ``*.jsm``
-       Will match all ``.jsm`` files in the current directory.
-    ``**/*.cpp``
-       Will match all ``.cpp`` files in this and all child directories.
-    ``foo/*.css``
-       Will match all ``.css`` files in the ``foo/`` directory.
-    ``bar/*``
-       Will match all files in the ``bar/`` directory but not any files in
-       child directories of ``bar/``, such as ``bar/dir1/baz``.
-    ``baz/**``
-       Will match all files in the ``baz/`` directory and all directories
-       underneath.
-    """
-
-    VARIABLES = {
-        'BUG_COMPONENT': (BugzillaComponent, tuple,
-            """The bug component that tracks changes to these files.
-
-            Values are a 2-tuple of unicode describing the Bugzilla product and
-            component. e.g. ``('Core', 'Build Config')``.
-            """, None),
-
-        'FINAL': (bool, bool,
-            """Mark variable assignments as finalized.
-
-            During normal processing, values from newer Files contexts
-            overwrite previously set values. Last write wins. This behavior is
-            not always desired. ``FINAL`` provides a mechanism to prevent
-            further updates to a variable.
-
-            When ``FINAL`` is set, the value of all variables defined in this
-            context are marked as frozen and all subsequent writes to them
-            are ignored during metadata reading.
-
-            See :ref:`mozbuild_files_metadata_finalizing` for more info.
-            """, None),
-    }
-
-    def __init__(self, parent, pattern=None):
-        super(Files, self).__init__(parent)
-        self.pattern = pattern
-        self.finalized = set()
-
-    def __iadd__(self, other):
-        assert isinstance(other, Files)
-
-        for k, v in other.items():
-            # Ignore updates to finalized flags.
-            if k in self.finalized:
-                continue
-
-            # Only finalize variables defined in this instance.
-            if k == 'FINAL':
-                self.finalized |= set(other) - {'FINAL'}
-                continue
-
-            self[k] = v
-
-        return self
-
-    def asdict(self):
-        """Return this instance as a dict with built-in data structures.
-
-        Call this to obtain an object suitable for serializing.
-        """
-        d = {}
-        if 'BUG_COMPONENT' in self:
-            bc = self['BUG_COMPONENT']
-            d['bug_component'] = (bc.product, bc.component)
-
-        return d
-
-
 # This defines functions that create sub-contexts.
 #
 # Values are classes that are SubContexts. The class name will be turned into
 # a function that when called emits an instance of that class.
 #
 # Arbitrary arguments can be passed to the class constructor. The first
 # argument is always the parent context. It is up to each class to perform
 # argument validation.
 SUBCONTEXTS = [
-    Files,
 ]
 
 for cls in SUBCONTEXTS:
     if not issubclass(cls, SubContext):
         raise ValueError('SUBCONTEXTS entry not a SubContext class: %s' % cls)
 
     if not hasattr(cls, 'VARIABLES'):
         raise ValueError('SUBCONTEXTS entry does not have VARIABLES: %s' % cls)
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -69,20 +69,17 @@ from .data import (
     UnifiedSources,
     VariablePassthru,
     WebIDLFile,
     XPIDLFile,
 )
 
 from .reader import SandboxValidationError
 
-from .context import (
-    Context,
-    SubContext,
-)
+from .context import Context
 
 
 class TreeMetadataEmitter(LoggingMixin):
     """Converts the executed mozbuild files into data structures.
 
     This is a bridge between reader.py and data.py. It takes what was read by
     reader.BuildReader and converts it into the classes defined in the data
     module.
@@ -133,21 +130,16 @@ class TreeMetadataEmitter(LoggingMixin):
 
         def emit_objs(objs):
             for o in objs:
                 yield o
                 if not o._ack:
                     raise Exception('Unhandled object of type %s' % type(o))
 
         for out in output:
-            # Nothing in sub-contexts is currently of interest to us. Filter
-            # them all out.
-            if isinstance(out, SubContext):
-                continue
-
             if isinstance(out, Context):
                 # Keep all contexts around, we will need them later.
                 contexts[out.objdir] = out
 
                 start = time.time()
                 # We need to expand the generator for the timings to work.
                 objs = list(self.emit_from_context(out))
                 emitter_time += time.time() - start
--- a/python/mozbuild/mozbuild/frontend/mach_commands.py
+++ b/python/mozbuild/mozbuild/frontend/mach_commands.py
@@ -1,25 +1,21 @@
 # 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/.
 
 from __future__ import print_function, unicode_literals
 
-from collections import defaultdict
-
 from mach.decorators import (
     CommandArgument,
     CommandProvider,
-    Command,
-    SubCommand,
+    Command
 )
 
 from mozbuild.base import MachCommandBase
-import mozpack.path as mozpath
 
 
 @CommandProvider
 class MozbuildFileCommands(MachCommandBase):
     @Command('mozbuild-reference', category='build-dev',
         description='View reference documentation on mozbuild files.')
     @CommandArgument('symbol', default=None, nargs='*',
         help='Symbol to view help on. If not specified, all will be shown.')
@@ -71,54 +67,8 @@ class MozbuildFileCommands(MachCommandBa
                 return 1
 
             return 0
 
         for line in format_module(m):
             print(line)
 
         return 0
-
-    @Command('file-info', category='build-dev',
-             description='Query for metadata about files.')
-    def file_info(self):
-        pass
-
-    @SubCommand('file-info', 'bugzilla-component',
-                'Show Bugzilla component info for files listed.')
-    @CommandArgument('paths', nargs='+',
-                     help='Paths whose data to query')
-    def file_info_bugzilla(self, paths):
-        components = defaultdict(set)
-        for p, m in self._get_files_info(paths).items():
-            components[m.get('BUG_COMPONENT')].add(p)
-
-        for component, files in sorted(components.items(), key=lambda x: (x is None, x)):
-            print('%s :: %s' % (component.product, component.component) if component else 'UNKNOWN')
-            for f in sorted(files):
-                print('  %s' % f)
-
-    @SubCommand('file-info', 'missing-bugzilla',
-                'Show files missing Bugzilla component info')
-    @CommandArgument('paths', nargs='+',
-                     help='Paths whose data to query')
-    def file_info_missing_bugzilla(self, paths):
-        for p, m in sorted(self._get_files_info(paths).items()):
-            if 'BUG_COMPONENT' not in m:
-                print(p)
-
-    def _get_reader(self):
-        from mozbuild.frontend.reader import BuildReader
-        config = self.config_environment
-        return BuildReader(config)
-
-    def _get_files_info(self, paths):
-        relpaths = []
-        for p in paths:
-            a = mozpath.abspath(p)
-            if not mozpath.basedir(a, [self.topsrcdir]):
-                print('path is not inside topsrcdir: %s' % p)
-                return 1
-
-            relpaths.append(mozpath.relpath(a, self.topsrcdir))
-
-        reader = self._get_reader()
-        return reader.files_info(relpaths)
--- a/python/mozbuild/mozbuild/frontend/reader.py
+++ b/python/mozbuild/mozbuild/frontend/reader.py
@@ -57,17 +57,16 @@ from .sandbox import (
     SandboxExecutionError,
     SandboxLoadError,
     Sandbox,
 )
 
 from .context import (
     Context,
     ContextDerivedValue,
-    Files,
     FUNCTIONS,
     VARIABLES,
     DEPRECATION_HINTS,
     SPECIAL_VARIABLES,
     SUBCONTEXTS,
     SubContext,
     TemplateContext,
 )
@@ -1233,51 +1232,8 @@ class BuildReader(object):
             contexts[context.main_path].append(context)
             all_contexts.append(context)
 
         result = {}
         for path, paths in path_mozbuilds.items():
             result[path] = reduce(lambda x, y: x + y, (contexts[p] for p in paths), [])
 
         return result, all_contexts
-
-    def files_info(self, paths):
-        """Obtain aggregate data from Files for a set of files.
-
-        Given a set of input paths, determine which moz.build files may
-        define metadata for them, evaluate those moz.build files, and
-        apply file metadata rules defined within to determine metadata
-        values for each file requested.
-
-        Essentially, for each input path:
-
-        1. Determine the set of moz.build files relevant to that file by
-           looking for moz.build files in ancestor directories.
-        2. Evaluate moz.build files starting with the most distant.
-        3. Iterate over Files sub-contexts.
-        4. If the file pattern matches the file we're seeking info on,
-           apply attribute updates.
-        5. Return the most recent value of attributes.
-        """
-        paths, _ = self.read_relevant_mozbuilds(paths)
-
-        r = {}
-
-        for path, ctxs in paths.items():
-            flags = Files(Context())
-
-            for ctx in ctxs:
-                if not isinstance(ctx, Files):
-                    continue
-
-                relpath = mozpath.relpath(path, ctx.relsrcdir)
-                pattern = ctx.pattern
-
-                # Only do wildcard matching if the '*' character is present.
-                # Otherwise, mozpath.match will match directories, which we've
-                # arbitrarily chosen to not allow.
-                if pattern == relpath or \
-                        ('*' in pattern and mozpath.match(relpath, pattern)):
-                    flags += ctx
-
-            r[path] = flags
-
-        return r
--- a/python/mozbuild/mozbuild/test/frontend/test_reader.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_reader.py
@@ -5,17 +5,16 @@
 from __future__ import unicode_literals
 
 import os
 import sys
 import unittest
 
 from mozunit import main
 
-from mozbuild.frontend.context import BugzillaComponent
 from mozbuild.frontend.reader import BuildReaderError
 from mozbuild.frontend.reader import BuildReader
 
 from mozbuild.test.common import MockConfig
 
 import mozpack.path as mozpath
 
 
@@ -309,75 +308,11 @@ class TestBuildReader(unittest.TestCase)
 
         self.assertEqual([ctx.relsrcdir for ctx in paths['d1/every-level/a/file']],
             ['', 'd1', 'd1/every-level', 'd1/every-level/a'])
         self.assertEqual([ctx.relsrcdir for ctx in paths['d1/every-level/b/file']],
             ['', 'd1', 'd1/every-level', 'd1/every-level/b'])
         self.assertEqual([ctx.relsrcdir for ctx in paths['d2/file']],
             ['', 'd2'])
 
-    def test_files_bad_bug_component(self):
-        reader = self.reader('files-info')
-
-        with self.assertRaises(BuildReaderError):
-            reader.files_info(['bug_component/bad-assignment/moz.build'])
-
-    def test_files_bug_component_static(self):
-        reader = self.reader('files-info')
-
-        v = reader.files_info(['bug_component/static/foo',
-                               'bug_component/static/bar',
-                               'bug_component/static/foo/baz'])
-        self.assertEqual(len(v), 3)
-        self.assertEqual(v['bug_component/static/foo']['BUG_COMPONENT'],
-                         BugzillaComponent('FooProduct', 'FooComponent'))
-        self.assertEqual(v['bug_component/static/bar']['BUG_COMPONENT'],
-                         BugzillaComponent('BarProduct', 'BarComponent'))
-        self.assertEqual(v['bug_component/static/foo/baz']['BUG_COMPONENT'],
-                         BugzillaComponent('default_product', 'default_component'))
-
-    def test_files_bug_component_simple(self):
-        reader = self.reader('files-info')
-
-        v = reader.files_info(['bug_component/simple/moz.build'])
-        self.assertEqual(len(v), 1)
-        flags = v['bug_component/simple/moz.build']
-        self.assertEqual(flags['BUG_COMPONENT'].product, 'Core')
-        self.assertEqual(flags['BUG_COMPONENT'].component, 'Build Config')
-
-    def test_files_bug_component_different_matchers(self):
-        reader = self.reader('files-info')
-
-        v = reader.files_info([
-            'bug_component/different-matchers/foo.jsm',
-            'bug_component/different-matchers/bar.cpp',
-            'bug_component/different-matchers/baz.misc'])
-        self.assertEqual(len(v), 3)
-
-        js_flags = v['bug_component/different-matchers/foo.jsm']
-        cpp_flags = v['bug_component/different-matchers/bar.cpp']
-        misc_flags = v['bug_component/different-matchers/baz.misc']
-
-        self.assertEqual(js_flags['BUG_COMPONENT'], BugzillaComponent('Firefox', 'JS'))
-        self.assertEqual(cpp_flags['BUG_COMPONENT'], BugzillaComponent('Firefox', 'C++'))
-        self.assertEqual(misc_flags['BUG_COMPONENT'], BugzillaComponent('default_product', 'default_component'))
-
-    def test_files_bug_component_final(self):
-        reader = self.reader('files-info')
-
-        v = reader.files_info([
-            'bug_component/final/foo',
-            'bug_component/final/Makefile.in',
-            'bug_component/final/subcomponent/Makefile.in',
-            'bug_component/final/subcomponent/bar'])
-
-        self.assertEqual(v['bug_component/final/foo']['BUG_COMPONENT'],
-            BugzillaComponent('default_product', 'default_component'))
-        self.assertEqual(v['bug_component/final/Makefile.in']['BUG_COMPONENT'],
-            BugzillaComponent('Core', 'Build Config'))
-        self.assertEqual(v['bug_component/final/subcomponent/Makefile.in']['BUG_COMPONENT'],
-            BugzillaComponent('Core', 'Build Config'))
-        self.assertEqual(v['bug_component/final/subcomponent/bar']['BUG_COMPONENT'],
-            BugzillaComponent('Another', 'Component'))
-
 
 if __name__ == '__main__':
     main()
--- a/services/common/moz.build
+++ b/services/common/moz.build
@@ -1,17 +1,14 @@
 # -*- 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 http://mozilla.org/MPL/2.0/.
 
-with Files('**'):
-    BUG_COMPONENT = ('Mozilla Services', 'Firefox: Common')
-
 TEST_DIRS += ['tests']
 
 EXTRA_COMPONENTS += [
     'servicesComponents.manifest',
 ]
 
 EXTRA_JS_MODULES['services-common'] += [
     'hawkclient.js',
--- a/services/crypto/moz.build
+++ b/services/crypto/moz.build
@@ -1,17 +1,14 @@
 # -*- 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 http://mozilla.org/MPL/2.0/.
 
-with Files('**'):
-    BUG_COMPONENT = ('Mozilla Services', 'Firefox Sync: Crypto')
-
 DIRS += ['component']
 
 XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
 
 EXTRA_JS_MODULES['services-crypto'] += [
     'modules/utils.js',
 ]
 
--- a/services/sync/moz.build
+++ b/services/sync/moz.build
@@ -1,17 +1,14 @@
 # -*- 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 http://mozilla.org/MPL/2.0/.
 
-with Files('**'):
-    BUG_COMPONENT = ('Mozilla Services', 'Firefox Sync: Backend')
-
 DIRS += ['locales']
 
 XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
 
 EXTRA_COMPONENTS += [
     'Weave.js',
 ]