Bug 1155349 - set packageFilename in mach properties; r=glandium
authorMike Shal <mshal@mozilla.com>
Wed, 13 May 2015 14:26:53 -0400
changeset 265192 bd6fb3d49f402a476530545386c06671e08befda
parent 265191 a28dbf1faa66289c1cab95153581b9abd8d77d7a
child 265193 1e6654f7fdeaf5a9789dc6bc6cac9d0e25e620b1
push id2102
push usermartin.thomson@gmail.com
push dateMon, 18 May 2015 17:35:37 +0000
Bug 1155349 - set packageFilename in mach properties; r=glandium
--- a/build/gen_mach_buildprops.py
+++ b/build/gen_mach_buildprops.py
@@ -35,36 +35,34 @@ def getMarProperties(filename, partial=F
     (mar_hash, mar_size) = getFileHashAndSize(filename)
     martype = 'partial' if partial else 'complete'
     return {
         '%sMarFilename' % martype: os.path.basename(filename),
         '%sMarSize' % martype: mar_size,
         '%sMarHash' % martype: mar_hash,
-def getUrlProperties(filename):
+def getUrlProperties(filename, package):
     # let's create a switch case using name-spaces/dict
     # rather than a long if/else with duplicate code
     property_conditions = [
         # key: property name, value: condition
         ('symbolsUrl', lambda m: m.endswith('crashreporter-symbols.zip') or
         ('testsUrl', lambda m: m.endswith(('tests.tar.bz2', 'tests.zip'))),
         ('unsignedApkUrl', lambda m: m.endswith('apk') and
                            'unsigned-unaligned' in m),
         ('robocopApkUrl', lambda m: m.endswith('apk') and 'robocop' in m),
         ('jsshellUrl', lambda m: 'jsshell-' in m and m.endswith('.zip')),
         ('completeMarUrl', lambda m: m.endswith('.complete.mar')),
         ('partialMarUrl', lambda m: m.endswith('.mar') and '.partial.' in m),
         ('codeCoverageURL', lambda m: m.endswith('code-coverage-gcno.zip')),
         ('sdkUrl', lambda m: m.endswith(('sdk.tar.bz2', 'sdk.zip'))),
         ('testPackagesUrl', lambda m: m.endswith('test_packages.json')),
-        # packageUrl must be last!
-        ('packageUrl', lambda m: (not m.endswith('.json') and
-                                  not m.endswith('tests.zip'))),
+        ('packageUrl', lambda m: m.endswith(package)),
     url_re = re.compile(r'''^(https?://.*?\.(?:tar\.bz2|dmg|zip|apk|rpm|mar|tar\.gz|json))$''')
     properties = {}
         with open(filename) as f:
             for line in f:
                 m = url_re.match(line)
@@ -97,28 +95,32 @@ if __name__ == '__main__':
                         action="store", dest="partial_mar_file",
                         help="Path to the partial MAR file, relative to the objdir.")
     parser.add_argument("--upload-output", required=True,
                         action="store", dest="upload_output",
                         help="Path to the text output of 'make upload'")
     parser.add_argument("--upload-files", required=True, nargs="+",
                         action="store", dest="upload_files",
                         help="List of files to be uploaded.")
+    parser.add_argument("--package", required=True,
+                        action="store", dest="package",
+                        help="Filename of the build package")
     args = parser.parse_args()
     json_data = getMarProperties(args.complete_mar_file)
-    json_data.update(getUrlProperties(args.upload_output))
+    json_data.update(getUrlProperties(args.upload_output, args.package))
     if args.partial_mar_file:
         json_data.update(getMarProperties(args.partial_mar_file, partial=True))
         # Pull the previous buildid from the partial mar filename.
         res = re.match(r'.*\.([0-9]+)-[0-9]+.mar', args.partial_mar_file)
         if res:
             json_data['previous_buildid'] = res.group(1)
             # Set partialInfo to be a collection of the partial mar properties
             # useful for balrog.
             json_data['partialInfo'] = getPartialInfo(json_data)
     json_data['uploadFiles'] = args.upload_files
+    json_data['packageFilename'] = args.package
     with open('mach_build_properties.json', 'w') as outfile:
         json.dump(json_data, outfile, indent=4)
--- a/build/moz-automation.mk
+++ b/build/moz-automation.mk
@@ -94,17 +94,17 @@ automation/sdk: automation/installer aut
 # conflicts in writing to the same files.
 automation/installer: automation/pretty-installer
 automation/package: automation/pretty-package
 automation/package-tests: automation/pretty-package-tests
 automation/l10n-check: automation/pretty-l10n-check
 automation/update-packaging: automation/pretty-update-packaging
 automation/build: $(addprefix automation/,$(MOZ_AUTOMATION_TIERS))
-	$(PYTHON) $(topsrcdir)/build/gen_mach_buildprops.py --complete-mar-file $(DIST)/$(COMPLETE_MAR) $(addprefix --partial-mar-file ,$(wildcard $(DIST)/$(PARTIAL_MAR))) --upload-output $(AUTOMATION_UPLOAD_OUTPUT) --upload-files $(abspath $(UPLOAD_FILES))
+	$(PYTHON) $(topsrcdir)/build/gen_mach_buildprops.py --complete-mar-file $(DIST)/$(COMPLETE_MAR) $(addprefix --partial-mar-file ,$(wildcard $(DIST)/$(PARTIAL_MAR))) --upload-output $(AUTOMATION_UPLOAD_OUTPUT) --upload-files $(abspath $(UPLOAD_FILES)) --package $(PACKAGE)
 # We need the log from make upload to grep it for urls in order to set
 # properties.
 # Note: We have to force -j1 here, at least until bug 1036563 is fixed.
 AUTOMATION_EXTRA_CMDLINE-pretty-l10n-check = -j1