Bug 1313640 - Add support for allowing duplicate files in multilocale builds. r=gps,mshal

MozReview-Commit-ID: CTmfSRs4JaS

--HG--
extra : rebase_source : c54f9090e8179ce2b6db281e89f798a6468b5279
This commit is contained in:
Chris AtLee 2016-10-28 09:25:33 -04:00
Родитель 35eaffd977
Коммит 10d3f8ee0e
1 изменённых файлов: 43 добавлений и 1 удалений

Просмотреть файл

@ -4,6 +4,7 @@
import sys
import hashlib
import re
from mozpack.packager.unpack import UnpackFinder
from mozpack.files import DeflatedFile
from collections import OrderedDict
@ -235,6 +236,25 @@ ALLOWED_DUPES = set([
'res/table-remove-row-active.gif',
'res/table-remove-row-hover.gif',
'res/table-remove-row.gif',
# For android multilocale
'chrome/en-US/locale/branding/brand.dtd',
'chrome/en-US/locale/branding/brand.properties',
'chrome/en-US/locale/en-US/browser/aboutHealthReport.dtd',
'chrome/en-US/locale/en-US/browser/aboutHome.dtd',
'chrome/en-US/locale/en-US/browser/checkbox.dtd',
'chrome/en-US/locale/en-US/browser/devicePrompt.properties',
'chrome/en-US/locale/en-US/browser/overrides/aboutAbout.dtd',
'chrome/en-US/locale/en-US/browser/overrides/global.dtd',
'chrome/en-US/locale/en-US/browser/overrides/global/mozilla.dtd',
'chrome/en-US/locale/en-US/browser/overrides/intl.css',
'chrome/en-US/locale/en-US/browser/region.properties',
'chrome/en-US/locale/en-US/browser/searchplugins/amazondotcom.xml',
'chrome/en-US/locale/en-US/browser/searchplugins/bing.xml',
'chrome/en-US/locale/en-US/browser/searchplugins/duckduckgo.xml',
'chrome/en-US/locale/en-US/browser/searchplugins/google-nocodes.xml',
'chrome/en-US/locale/en-US/browser/searchplugins/google.xml',
'chrome/en-US/locale/en-US/browser/searchplugins/qwant.xml',
'chrome/en-US/locale/en-US/browser/searchplugins/twitter.xml',
])
@ -251,6 +271,28 @@ def normalize_osx_path(p):
return p
def normalize_l10n_path(p):
'''
Normalizes localized paths to en-US
>>> normalize_l10n_path('chrome/es-ES/locale/branding/brand.properties')
'chrome/en-US/locale/branding/brand.properties'
>>> normalize_l10n_path('chrome/fr/locale/fr/browser/aboutHome.dtd')
'chrome/en-US/locale/en-US/browser/aboutHome.dtd'
'''
p = re.sub(r'chrome/(\S+)/locale/\1',
'chrome/en-US/locale/en-US',
p)
p = re.sub(r'chrome/(\S+)/locale',
'chrome/en-US/locale',
p)
return p
def normalize_path(p):
return normalize_osx_path(normalize_l10n_path(p))
def find_dupes(source):
md5s = OrderedDict()
for p, f in UnpackFinder(source):
@ -278,7 +320,7 @@ def find_dupes(source):
total_compressed += (len(paths) - 1) * compressed
num_dupes += 1
unexpected_dupes.extend([p for p in paths if normalize_osx_path(p) not in ALLOWED_DUPES])
unexpected_dupes.extend([p for p in paths if normalize_path(p) not in ALLOWED_DUPES])
if num_dupes:
print "WARNING: Found %d duplicated files taking %d bytes (%s)" % \