Bug 1155349 - Set packageFilename in mach properties. r=glandium, a=NPOTB
authorMike Shal <mshal@mozilla.com>
Wed, 13 May 2015 14:26:53 -0400
changeset 266115 a1a1e0b8c9c5
parent 266114 2fe463b29e20
child 266116 887a153499b4
push id4759
push userryanvm@gmail.com
push date2015-05-27 15:14 +0000
treeherdermozilla-beta@9abcdd8e7712 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, NPOTB
bugs1155349
milestone39.0
Bug 1155349 - Set packageFilename in mach properties. r=glandium, a=NPOTB
build/gen_mach_buildprops.py
build/moz-automation.mk
--- a/build/gen_mach_buildprops.py
+++ b/build/gen_mach_buildprops.py
@@ -35,34 +35,33 @@ 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
                        m.endswith('crashreporter-symbols-full.zip')),
         ('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'))),
-        # packageUrl must be last!
-        ('packageUrl', lambda m: True),
+        ('packageUrl', lambda m: m.endswith(package)),
     ]
     url_re = re.compile(r'''^(https?://.*?\.(?:tar\.bz2|dmg|zip|apk|rpm|mar|tar\.gz))$''')
     properties = {}
 
     try:
         with open(filename) as f:
             for line in f:
                 m = url_re.match(line)
@@ -95,28 +94,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.
 AUTOMATION_EXTRA_CMDLINE-upload = 2>&1 | tee $(AUTOMATION_UPLOAD_OUTPUT)
 
 # Note: We have to force -j1 here, at least until bug 1036563 is fixed.
 AUTOMATION_EXTRA_CMDLINE-l10n-check = -j1
 AUTOMATION_EXTRA_CMDLINE-pretty-l10n-check = -j1