+def add_checksum_info(output_dir):
+ """
+ Add checksum information into package.info file
+ :param output_dir: directory where are packages
+ """
+ tar_files = ['resources_package.tar', 'aux_package.tar', 'sw_package.tar']
+ for tar_file in tar_files:
+ try:
+ checksum = hashlib.md5()
+ with open(os.path.join(output_dir, tar_file), 'rb') as f:
+ for chunk in iter(lambda: f.read(4096), b""):
+ checksum.update(chunk)
+ with open(os.path.join(output_dir, 'package.info'), 'r') as f:
+ json_data = json.load(f)
+ json_data['Build_info']['Packages'].update({tar_file: checksum.hexdigest()})
+ with open(os.path.join(output_dir, 'package.info'), 'w') as f:
+ json.dump(json_data, f, indent=4)
+ except FileNotFoundError:
+ pass
+
+