Bug 1087104 - Set the partialInfo property for Balrog; r=glandium a=metered
authorMike Shal <mshal@mozilla.com>
Thu, 06 Nov 2014 17:10:13 -0500
changeset 214499 edea136c8f9941cc4c4cb61abdb3f00127d10b3b
parent 214498 bb6355a9cdc09dad20600287608477777164586a
child 214500 87cc8b0a2596e3e073079c9ae6b1c0a1b59974a8
push id27784
push usercbook@mozilla.com
push dateFri, 07 Nov 2014 13:34:30 +0000
treeherdermozilla-central@65965f342b98 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, metered
bugs1087104
milestone36.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 1087104 - Set the partialInfo property for Balrog; r=glandium a=metered
build/gen_mach_buildprops.py
--- a/build/gen_mach_buildprops.py
+++ b/build/gen_mach_buildprops.py
@@ -71,28 +71,45 @@ def getUrlProperties(filename):
                             properties.update({prop: m})
                             break
     except IOError as e:
         if e.errno != errno.ENOENT:
             raise
         properties = {prop: 'UNKNOWN' for prop, condition in property_conditions}
     return properties
 
+def getPartialInfo(props):
+    return [{
+        "from_buildid": props.get("previous_buildid"),
+        "size": props.get("partialMarSize"),
+        "hash": props.get("partialMarHash"),
+        "url": props.get("partialMarUrl"),
+    }]
+
 if __name__ == '__main__':
     parser = ArgumentParser(description='Generate mach_build_properties.json for automation builds.')
     parser.add_argument("--complete-mar-file", required=True,
                         action="store", dest="complete_mar_file",
                         help="Path to the complete MAR file, relative to the objdir.")
     parser.add_argument("--partial-mar-file", required=False,
                         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'")
     args = parser.parse_args()
 
     json_data = getMarProperties(args.complete_mar_file)
+    json_data.update(getUrlProperties(args.upload_output))
     if args.partial_mar_file:
         json_data.update(getMarProperties(args.partial_mar_file, partial=True))
-    json_data.update(getUrlProperties(args.upload_output))
+
+        # 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)
 
     with open('mach_build_properties.json', 'w') as outfile:
         json.dump(json_data, outfile, indent=4)