diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 909911159b1b20..075153245d8415 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -38,8 +38,8 @@ _DEVICE_FOLDER = os.path.join(_CHEF_SCRIPT_PATH, "devices") _DEVICE_LIST = [file[:-4] for file in os.listdir(_DEVICE_FOLDER) if file.endswith(".zap")] _CHEF_ZZZ_ROOT = os.path.join(_CHEF_SCRIPT_PATH, "zzz_generated") -_CI_MANIFEST_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "ci_manifest.json") _CI_DEVICE_MANIFEST_NAME = "INPUTMD5.txt" +_CI_ZAP_MANIFEST_NAME = "ZAPSHA.txt" _CICD_CONFIG_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "cicd_meta.json") _CI_ALLOW_LIST = ["lighting-app"] @@ -124,7 +124,6 @@ def check_zap(master: bool = False) -> str: def generate_device_manifest( - include_zap_submod: bool = False, write_manifest_file: bool = False, zap_check_master: bool = False) -> Dict[str, Any]: """Produces dictionary containing md5 of device dir zap files. @@ -137,6 +136,8 @@ def generate_device_manifest( """ ci_manifest = {"devices": {}} devices_manifest = ci_manifest["devices"] + zap_sha = check_zap(master=zap_check_master) + ci_manifest["zap_commit"] = zap_sha for device_name in _DEVICE_LIST: device_file_path = os.path.join(_DEVICE_FOLDER, device_name + ".zap") with open(device_file_path, "rb") as device_file: @@ -145,16 +146,13 @@ def generate_device_manifest( devices_manifest[device_name] = device_file_md5 flush_print(f"Current digest for {device_name} : {device_file_md5}") if write_manifest_file: - device_zzz_md5_file = os.path.join(_CHEF_ZZZ_ROOT, - device_name, - _CI_DEVICE_MANIFEST_NAME) - with open(device_zzz_md5_file, "w+", encoding="utf-8") as md5file: - md5file.write(device_file_md5) - if include_zap_submod: - ci_manifest["zap_commit"] = check_zap(master=zap_check_master) - if write_manifest_file: - with open(_CI_MANIFEST_FILE_NAME, "w+", encoding="utf-8") as ci_manifest_file: - ci_manifest_file.write(json.dumps(ci_manifest, indent=4)+"\n") + device_zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device_name) + device_zzz_md5_file = os.path.join(device_zzz_dir, _CI_DEVICE_MANIFEST_NAME) + with open(device_zzz_md5_file, "w+", encoding="utf-8") as md5_file: + md5_file.write(device_file_md5) + device_zzz_zap_sha_file = os.path.join(device_zzz_dir, _CI_ZAP_MANIFEST_NAME) + with open(device_zzz_zap_sha_file, "w+", encoding="utf-8") as zap_sha_file: + zap_sha_file.write(zap_sha) return ci_manifest