Bug 1087104 - Set the partialInfo property for Balrog; r=glandium a=NPOTB
authorMike Shal <mshal@mozilla.com>
Thu, 06 Nov 2014 17:10:13 -0500
changeset 225995 dc18ad2b4816
parent 225994 ee2c3cfb4a7b
child 225996 1f1e5b70a075
push id4099
push usermshal@mozilla.com
push date2014-11-07 15:57 +0000
treeherdermozilla-beta@dc18ad2b4816 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, NPOTB
bugs1087104
milestone34.0
Bug 1087104 - Set the partialInfo property for Balrog; r=glandium a=NPOTB
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)