Bug 1395456 - Use MOZ_APP_MAXVERSION for strict_max_version in langpack manifest. r=Pike
authorZibi Braniecki <zbraniecki@mozilla.com>
Thu, 31 Aug 2017 11:54:26 -0700
changeset 378804 683153eaa16ac8ac46b72847fd1b66a9ac87340f
parent 378803 827fae5a03b435b0ce8b96cfdbccebdd596e198e
child 378805 714cf1e9165985b199010b120e6ef51e1e3d43e3
push id50376
push userzbraniecki@mozilla.com
push dateMon, 04 Sep 2017 17:40:06 +0000
treeherderautoland@683153eaa16a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersPike
bugs1395456
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1395456 - Use MOZ_APP_MAXVERSION for strict_max_version in langpack manifest. r=Pike MozReview-Commit-ID: 63BQQt4U8if
python/mozbuild/mozbuild/action/langpack_manifest.py
toolkit/locales/l10n.mk
--- a/python/mozbuild/mozbuild/action/langpack_manifest.py
+++ b/python/mozbuild/mozbuild/action/langpack_manifest.py
@@ -214,29 +214,32 @@ def parse_chrome_manifest(path, base_pat
 
 ###
 # Generates a new web manifest dict with values specific for a language pack.
 #
 # Args:
 #    locstr         (str)  - A string with a comma separated list of locales
 #                            for which resources are embedded in the
 #                            language pack
-#    appver         (str)  - A version of the application the language
+#    min_app_ver    (str)  - A minimum version of the application the language
+#                            resources are for
+#    max_app_ver    (str)  - A maximum version of the application the language
 #                            resources are for
 #    defines        (dict) - A dictionary of defines entries
 #    chrome_entries (dict) - A dictionary of chrome registry entries
 #
 # Returns:
 #    (dict) - a web manifest
 #
 # Example:
 #    manifest = create_webmanifest(
 #      ['pl'],
 #      '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}',
 #      '57.0',
+#      '57.0.*',
 #      {'MOZ_LANG_TITLE': 'Polski'},
 #      chrome_entries
 #    )
 #    manifest == {
 #        'languages': {
 #            'pl': {
 #                'version': '201709121481',
 #                'resources': None,
@@ -261,38 +264,38 @@ def parse_chrome_manifest(path, base_pat
 #                'id': 'langpack-pl@mozilla.org',
 #            }
 #        },
 #        'version': '57.0',
 #        'name': 'Polski Language Pack',
 #        ...
 #    }
 ###
-def create_webmanifest(locstr, appver, defines, chrome_entries):
+def create_webmanifest(locstr, min_app_ver, max_app_ver, defines, chrome_entries):
     locales = map(lambda loc: loc.strip(), locstr.split(','))
     main_locale = locales[0]
 
     author = build_author_string(
         defines['MOZ_LANGPACK_CREATOR'],
         defines['MOZ_LANGPACK_CONTRIBUTORS']
     )
 
     manifest = {
         'langpack_id': main_locale,
         'manifest_version': 2,
         'applications': {
             'gecko': {
                 'id': 'langpack-{0}@firefox.mozilla.org'.format(main_locale),
-                'strict_min_version': appver,
-                'strict_max_version': '{0}.*'.format(appver)
+                'strict_min_version': min_app_ver,
+                'strict_max_version': max_app_ver,
             }
         },
         'name': '{0} Language Pack'.format(defines['MOZ_LANG_TITLE']),
         'description': 'Language pack for Firefox for {0}'.format(main_locale),
-        'version': appver,
+        'version': min_app_ver,
         'languages': {},
         'author': author
     }
 
     cr = {}
     for entry in chrome_entries:
         if entry['type'] == 'locale':
             platforms = entry['platforms']
@@ -304,46 +307,49 @@ def create_webmanifest(locstr, appver, d
             else:
                 assert entry['alias'] not in cr
                 cr[entry['alias']] = entry['path']
         else:
             raise Exception('Unknown type {0}'.format(entry['type']))
 
     for loc in locales:
         manifest['languages'][loc] = {
-            'version': appver,
+            'version': min_app_ver,
             'resources': None,
             'chrome_resources': cr
         }
 
     return json.dumps(manifest, indent=2, ensure_ascii=False, encoding='utf8')
 
 
 def main(args):
     parser = argparse.ArgumentParser()
     parser.add_argument('--locales',
                         help='List of language codes provided by the langpack')
-    parser.add_argument('--appver',
-                        help='Version of the application the langpack is for')
+    parser.add_argument('--min-app-ver',
+                        help='Min version of the application the langpack is for')
+    parser.add_argument('--max-app-ver',
+                        help='Max version of the application the langpack is for')
     parser.add_argument('--defines', default=[], nargs='+',
                         help='List of defines files to load data from')
     parser.add_argument('--input',
                         help='Langpack directory.')
 
     args = parser.parse_args(args)
 
     chrome_entries = []
     parse_chrome_manifest(
         os.path.join(args.input, 'chrome.manifest'), args.input, chrome_entries)
 
     defines = parse_defines(args.defines)
 
     res = create_webmanifest(
         args.locales,
-        args.appver,
+        args.min_app_ver,
+        args.max_app_ver,
         defines,
         chrome_entries
     )
     write_file(os.path.join(args.input, 'manifest.json'), res)
 
 
 if __name__ == '__main__':
     main(sys.argv[1:])
--- a/toolkit/locales/l10n.mk
+++ b/toolkit/locales/l10n.mk
@@ -202,17 +202,17 @@ langpack-%:
 	@$(MAKE) package-langpack-$(AB_CD)
 
 package-langpack-%: LANGPACK_FILE=$(ABS_DIST)/$(PKG_LANGPACK_PATH)$(PKG_LANGPACK_BASENAME).xpi
 package-langpack-%: XPI_NAME=locale-$*
 package-langpack-%: AB_CD=$*
 package-langpack-%:
 	$(NSINSTALL) -D $(DIST)/$(PKG_LANGPACK_PATH)
 ifdef WEBEXT_LANGPACKS
-	$(call py_action,langpack_manifest,--locales $(AB_CD) --appver $(MOZ_APP_VERSION) --defines $(NEW_APP_DEFINES) --input $(DIST)/xpi-stage/locale-$(AB_CD))
+	$(call py_action,langpack_manifest,--locales $(AB_CD) --min-app-ver $(MOZ_APP_VERSION) --max-app-ver $(MOZ_APP_MAXVERSION) --defines $(NEW_APP_DEFINES) --input $(DIST)/xpi-stage/locale-$(AB_CD))
 	$(call py_action,zip,-C $(DIST)/xpi-stage/locale-$(AB_CD) -x **/*.manifest -x **/*.js -x **/*.ini $(LANGPACK_FILE) $(PKG_ZIP_DIRS) manifest.json)
 else
 	$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) \
 	  -DTK_DEFINES=$(TK_DEFINES) -DAPP_DEFINES=$(APP_DEFINES) $(MOZILLA_DIR)/toolkit/locales/generic/install.rdf -o $(DIST)/xpi-stage/$(XPI_NAME)/install.rdf)
 	$(call py_action,zip,-C $(DIST)/xpi-stage/locale-$(AB_CD) $(LANGPACK_FILE) install.rdf $(PKG_ZIP_DIRS) chrome.manifest)
 endif
 
 # This variable is to allow the wget-en-US target to know which ftp server to download from