mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1216371 - Don't assume the root directory is a base directory in packager formatters. r=gps
This commit is contained in:
parent
a98a80e64d
commit
f4d80001b6
@ -316,8 +316,7 @@ class SimplePackager(object):
|
||||
(m, self._included_manifests[m],
|
||||
mozpath.basedir(m, bases)))
|
||||
for base in bases:
|
||||
if base:
|
||||
self.formatter.add_base(base, base in self._addons)
|
||||
self.formatter.add_base(base, base in self._addons)
|
||||
self._chrome_queue.execute()
|
||||
self._queue.execute()
|
||||
self._file_queue.execute()
|
||||
|
@ -72,7 +72,7 @@ class FlatFormatter(object):
|
||||
def __init__(self, copier):
|
||||
assert isinstance(copier, FileRegistry)
|
||||
self.copier = copier
|
||||
self._bases = ['']
|
||||
self._bases = []
|
||||
self._addons = []
|
||||
self._frozen_bases = False
|
||||
|
||||
@ -99,6 +99,7 @@ class FlatFormatter(object):
|
||||
# after their parent directory, except for root manifests, all named
|
||||
# chrome.manifest.
|
||||
base = self._get_base(entry.base)
|
||||
assert base is not None
|
||||
if entry.base == base:
|
||||
name = 'chrome'
|
||||
else:
|
||||
@ -233,6 +234,7 @@ class OmniJarFormatter(JarFormatter):
|
||||
if not base in self.omnijars:
|
||||
omnijar = Jarrer(self._compress, self._optimize)
|
||||
self.omnijars[base] = FlatFormatter(omnijar)
|
||||
self.omnijars[base].add_base('')
|
||||
self.copier.add(mozpath.join(base, self._omnijar_name),
|
||||
omnijar)
|
||||
return self.omnijars[base], base, mozpath.relpath(path, base)
|
||||
@ -270,6 +272,8 @@ class OmniJarFormatter(JarFormatter):
|
||||
'''
|
||||
if base is None:
|
||||
base = self._get_base(path)
|
||||
if base is None:
|
||||
return False
|
||||
path = mozpath.relpath(path, base)
|
||||
if any(mozpath.match(path, p.replace('*', '**'))
|
||||
for p in self._non_resources):
|
||||
|
@ -44,7 +44,7 @@ from createprecomplete import generate_precomplete
|
||||
class LocaleManifestFinder(object):
|
||||
def __init__(self, finder):
|
||||
entries = self.entries = []
|
||||
bases = self.bases = ['']
|
||||
bases = self.bases = []
|
||||
|
||||
class MockFormatter(object):
|
||||
def add_interfaces(self, path, content):
|
||||
|
@ -189,6 +189,7 @@ class TestSimplePackager(unittest.TestCase):
|
||||
# The formatter is expected to reorder the manifest entries so that
|
||||
# chrome entries appear before the others.
|
||||
self.assertEqual(formatter.log, [
|
||||
(('dummy', 1), 'add_base', '', False),
|
||||
(('dummy', 1), 'add_base', 'qux', False),
|
||||
(('dummy', 1), 'add_base', 'addon', True),
|
||||
((os.path.join(curdir, 'foo', 'bar.manifest'), 2),
|
||||
@ -293,6 +294,7 @@ class TestSimpleManifestSink(unittest.TestCase):
|
||||
self.assertEqual(formatter.log, [])
|
||||
parser.close()
|
||||
self.assertEqual(formatter.log, [
|
||||
(None, 'add_base', '', False),
|
||||
(('foo/chrome.manifest', 1),
|
||||
'add_manifest', ManifestResource('foo', 'foo', 'foo/')),
|
||||
(None, 'add', 'foo/bar', foobar),
|
||||
|
@ -33,6 +33,7 @@ import mozpack.path as mozpath
|
||||
CONTENTS = {
|
||||
'bases': {
|
||||
# base_path: is_addon?
|
||||
'': False,
|
||||
'app': False,
|
||||
'addon0': True,
|
||||
},
|
||||
@ -214,7 +215,7 @@ RESULT_OMNIJAR['omni.foo'].update({
|
||||
|
||||
CONTENTS_WITH_BASE = {
|
||||
'bases': {
|
||||
mozpath.join('base/root', b): a
|
||||
mozpath.join('base/root', b) if b else 'base/root': a
|
||||
for b, a in CONTENTS['bases'].iteritems()
|
||||
},
|
||||
'manifests': [
|
||||
@ -227,10 +228,6 @@ CONTENTS_WITH_BASE = {
|
||||
},
|
||||
}
|
||||
|
||||
# There is no base for the top directory in CONTENTS,
|
||||
# and we want a specific base here.
|
||||
CONTENTS_WITH_BASE['bases']['base/root'] = False
|
||||
|
||||
EXTRA_CONTENTS = {
|
||||
'extra/file': GeneratedFile('extra file'),
|
||||
}
|
||||
@ -364,6 +361,7 @@ class TestFormatters(unittest.TestCase):
|
||||
'defaults/foo/*',
|
||||
'*/dummy',
|
||||
])
|
||||
f.add_base('')
|
||||
f.add_base('app')
|
||||
f.add(mozpath.join(base, path), GeneratedFile(''))
|
||||
if f.copier.contains(mozpath.join(base, path)):
|
||||
|
Loading…
Reference in New Issue
Block a user