Bug 1239872 - Prevent jar maker from installing the same file twice. r=gps

The faster make backend cannot support such things, so it's better to
avoid unsupported things to slip in because it happens that doesn't
break what automation runs.
This commit is contained in:
Mike Hommey 2016-01-15 18:24:29 +09:00
parent 6e930714bd
commit 364bdaff67

View File

@ -209,6 +209,7 @@ class JarMaker(object):
self.l10nmerge = None
self.relativesrcdir = None
self.rootManifestAppId = None
self._seen_output = set()
def getCommandLineParser(self):
'''Get a optparse.OptionParser for jarmaker.
@ -414,11 +415,19 @@ class JarMaker(object):
if '*' not in p:
yield p + '/'
prefix = ''.join(_prefix(src))
emitted = set()
for _srcdir in src_base:
finder = FileFinder(_srcdir, find_executables=False)
for path, _ in finder.find(src):
# If the path was already seen in one of the other source
# directories, skip it. That matches the non-wildcard case
# below, where we pick the first existing file.
reduced_path = path[len(prefix):]
if reduced_path in emitted:
continue
emitted.add(reduced_path)
e = JarManifestEntry(
mozpath.join(out, path[len(prefix):]),
mozpath.join(out, reduced_path),
path,
is_locale=e.is_locale,
preprocess=e.preprocess,
@ -438,6 +447,11 @@ class JarMaker(object):
jf.close()
raise RuntimeError('File "{0}" not found in {1}'.format(src,
', '.join(src_base)))
if out in self._seen_output:
raise RuntimeError('%s already added' % out)
self._seen_output.add(out)
if e.preprocess:
outf = outHelper.getOutput(out)
inf = open(realsrc)