Backout Bug 1132771 for spidermonkey build bustage on CLOSED TREE

This commit is contained in:
Nigel Babu 2015-03-02 17:13:05 +05:30
parent a3007359df
commit 19d4481b2a
13 changed files with 4 additions and 299 deletions

View File

@ -13,7 +13,6 @@ Important Concepts
Mozconfig Files <mozconfigs>
mozbuild-files
mozbuild-symbols
files-metadata
Profile Guided Optimization <pgo>
slow
environment-variables

View File

@ -4,9 +4,6 @@
# 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'

View File

@ -4,9 +4,6 @@
# 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.

View File

@ -4,10 +4,6 @@
# 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',

View File

@ -4,12 +4,6 @@
# 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',

View File

@ -19,6 +19,7 @@ from __future__ import unicode_literals
import os
from collections import OrderedDict
from contextlib import contextmanager
from mozbuild.util import (
HierarchicalStringList,
HierarchicalStringListWithFlagsFactory,
@ -30,7 +31,6 @@ from mozbuild.util import (
StrictOrderingOnAppendList,
StrictOrderingOnAppendListWithFlagsFactory,
TypedList,
TypedNamedTuple,
)
import mozpack.path as mozpath
from types import FunctionType
@ -167,6 +167,7 @@ class Context(KeyedDefaultDict):
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)
@ -395,108 +396,6 @@ def ContextDerivedTypedList(type, base_class=List):
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
@ -506,7 +405,6 @@ class Files(SubContext):
# argument is always the parent context. It is up to each class to perform
# argument validation.
SUBCONTEXTS = [
Files,
]
for cls in SUBCONTEXTS:

View File

@ -74,10 +74,7 @@ from .data import (
from .reader import SandboxValidationError
from .context import (
Context,
SubContext,
)
from .context import Context
class TreeMetadataEmitter(LoggingMixin):
@ -138,11 +135,6 @@ class TreeMetadataEmitter(LoggingMixin):
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

View File

@ -4,17 +4,13 @@
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
@ -76,49 +72,3 @@ class MozbuildFileCommands(MachCommandBase):
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)

View File

@ -62,7 +62,6 @@ from .sandbox import (
from .context import (
Context,
ContextDerivedValue,
Files,
FUNCTIONS,
VARIABLES,
DEPRECATION_HINTS,
@ -1238,46 +1237,3 @@ class BuildReader(object):
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

View File

@ -10,7 +10,6 @@ import unittest
from mozunit import main
from mozbuild.frontend.context import BugzillaComponent
from mozbuild.frontend.reader import BuildReaderError
from mozbuild.frontend.reader import BuildReader
@ -314,70 +313,6 @@ class TestBuildReader(unittest.TestCase):
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()

View File

@ -4,9 +4,6 @@
# 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 += [

View File

@ -4,9 +4,6 @@
# 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']

View File

@ -4,9 +4,6 @@
# 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']