AOSP差分OTA中加入前後版MD5和版本號紀錄
--- build/tools/releasetools/ota_from_target_files
+++ build/tools/releasetools/ota_from_target_files
@@ -642,6 +642,15 @@ def LoadSystemFiles(z):
out[fn] = common.File(fn, data)
return out
+def GetMD5(path):
+ tp_file = open(path,"r")
+ if tp_file == False:
+ print("WARNING: cannot generate MD5".path)
+ return "NONE"
+ re_value = hashlib.md5(tp_file.read()).hexdigest()
+ tp_file.close()
+ del tp_file
+ return re_value
def GetBuildProp(prop, info_dict):
"""Return the fingerprint of the build of a given target-files info_dict."""
@@ -665,6 +674,12 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
OPTIONS.source_info_dict),
"post-timestamp": GetBuildProp("ro.build.date.utc",
OPTIONS.target_info_dict),
+ "test-pre-version": GetBuildProp("ro.build.display.id",
+ OPTIONS.source_info_dict),
+ "test-pre-md5": GetMD5(OPTIONS.incremental_source),
+ "test-post-version": GetBuildProp("ro.build.display.id",
+ OPTIONS.target_info_dict),
+ "test-post-md5": GetMD5(OPTIONS.incremental_target)
}
device_specific = common.DeviceSpecificParams(
@@ -1095,6 +1110,7 @@ def main(argv):
"build/target/product/security/testkey")
else:
print "unzipping source target-files..."
+ OPTIONS.incremental_target = args[0]
OPTIONS.source_tmp, source_zip = common.UnzipTemp(OPTIONS.incremental_source)
OPTIONS.target_info_dict = OPTIONS.info_dict
OPTIONS.source_info_dict = common.LoadInfoDict(source_zip)
留言