Bug 1306329 - Backout 621aa115c3df (bug 1316450). r=glandium

We're going to remove the xpcom glue, so there is no need to check that
nothing depends on it anymore.
This commit is contained in:
Mike Hommey
2017-01-14 07:47:43 +09:00
parent b68b143dc2
commit 46f8311986
3 changed files with 3 additions and 76 deletions

View File

@@ -317,16 +317,14 @@ class LinkageMultipleRustLibrariesError(Exception):
class Linkable(ContextDerived):
"""Generic context derived container object for programs and libraries"""
__slots__ = (
'name',
'cxx_link',
'lib_defines',
'linked_libraries',
'linked_system_libs',
)
def __init__(self, context, name):
def __init__(self, context):
ContextDerived.__init__(self, context)
self.name = name
self.cxx_link = False
self.linked_libraries = []
self.linked_system_libs = []
@@ -385,7 +383,7 @@ class BaseProgram(Linkable):
}
def __init__(self, context, program, is_unit_test=False):
Linkable.__init__(self, context, program)
Linkable.__init__(self, context)
bin_suffix = context.config.substs.get(self.SUFFIX_VAR, '')
if not program.endswith(bin_suffix):
@@ -475,7 +473,7 @@ class BaseLibrary(Linkable):
)
def __init__(self, context, basename):
Linkable.__init__(self, context, basename)
Linkable.__init__(self, context)
self.basename = self.lib_name = basename
if self.lib_name:

View File

@@ -103,16 +103,6 @@ from .context import (
from mozbuild.base import ExecutionSummary
ALLOWED_XPCOM_GLUE = {
('xpcshell', 'js/xpconnect/shell'),
('testcrasher', 'toolkit/crashreporter/test'),
('TestMailCookie', 'mailnews/base/test'),
('calbasecomps', 'calendar/base/backend/libical/build'),
('purplexpcom', 'extensions/purple/purplexpcom/src'),
('ipdlunittest', 'ipc/ipdl/test/cxx/app'),
}
class TreeMetadataEmitter(LoggingMixin):
"""Converts the executed mozbuild files into data structures.
@@ -284,15 +274,11 @@ class TreeMetadataEmitter(LoggingMixin):
"""Add linkage declarations to a given object."""
assert isinstance(obj, Linkable)
use_xpcom = False
for path in context.get(variable, []):
force_static = path.startswith('static:') and obj.KIND == 'target'
if force_static:
path = path[7:]
name = mozpath.basename(path)
if name in ('xpcomglue', 'xpcomglue_s'):
use_xpcom = True
dir = mozpath.dirname(path)
candidates = [l for l in self._libs[name] if l.KIND == obj.KIND]
if dir:
@@ -379,38 +365,6 @@ class TreeMetadataEmitter(LoggingMixin):
for lib in context.get(variable.replace('USE', 'OS'), []):
obj.link_system_library(lib)
key = (obj.name, obj.relativedir)
substs = context.config.substs
extra_allowed = []
moz_build_app = substs.get('MOZ_BUILD_APP')
if moz_build_app is not None: # None during some test_emitter.py tests.
if moz_build_app.startswith('../'):
# For comm-central builds, where topsrcdir is not the root
# source dir.
moz_build_app = moz_build_app[3:]
extra_allowed = [
(substs.get('MOZ_APP_NAME'), '%s/app' % moz_build_app),
('%s-bin' % substs.get('MOZ_APP_NAME'), '%s/app' % moz_build_app),
]
if substs.get('MOZ_WIDGET_TOOLKIT') != 'android':
extra_allowed.append((substs.get('MOZ_CHILD_PROCESS_NAME'), 'ipc/app'))
else:
extra_allowed.append(('mozglue_android', 'mozglue/android'))
if key in ALLOWED_XPCOM_GLUE or key in extra_allowed:
if not use_xpcom:
raise SandboxValidationError(
"%s is in the exception list for XPCOM glue dependency but "
"doesn't depend on the XPCOM glue. Please adjust the list "
"in %s." % (obj.name, __file__), context
)
elif use_xpcom:
raise SandboxValidationError(
"%s depends on the XPCOM glue. "
"No new dependency on the XPCOM glue is allowed."
% obj.name, context
)
@memoize
def _get_external_library(self, dir, name, force_static):
# Create ExternalStaticLibrary or ExternalSharedLibrary object with a

View File

@@ -7,8 +7,6 @@ from __future__ import unicode_literals
import os
import unittest
from collections import defaultdict
from buildconfig import topsrcdir
from mozunit import main
from mozbuild.frontend.context import (
@@ -1235,29 +1233,6 @@ class TestEmitterBasic(unittest.TestCase):
'Objdir file specified in SYMBOLS_FILE not in GENERATED_FILES:'):
self.read_topsrcdir(reader)
def test_allowed_xpcom_glue(self):
"""Test that the ALLOWED_XPCOM_GLUE list is still relevant."""
from mozbuild.frontend.emitter import ALLOWED_XPCOM_GLUE
allowed = defaultdict(list)
useless = []
for name, path in ALLOWED_XPCOM_GLUE:
allowed[path].append(name)
for path, names in allowed.iteritems():
if path.startswith(('mailnews/', 'calendar/', 'extensions/purple/purplexpcom')):
continue
try:
content = open(os.path.join(topsrcdir, path, 'moz.build')).read()
except:
content = ''
for name in names:
if "'%s'" % name in content or '"%s"' % name in content:
continue
useless.append((name, path))
self.assertEqual(useless, [])
if __name__ == '__main__':
main()