From 78a87ba896d0df3a944d1ffd43ee79c5d6ca5e6f Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Tue, 24 May 2022 08:13:14 +0000 Subject: [PATCH] Filter zap cache to one file, Add zap version to manifest --- examples/chef/chef.py | 9 ++++++++- examples/chef/cimanifest.json | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 2e6229bdca0ada..e06fd60b18ce50 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -23,6 +23,7 @@ import yaml import hashlib import json +import subprocess import constants import stateful_shell @@ -217,7 +218,7 @@ def main(argv: Sequence[str]) -> None: print(f"Generating files in {chef_zzz_root} for all devices") for device_dir_item in os.listdir(chef_devices_dir): target_file_ext = ".zap" - if device_dir_item.endswith(target_file_ext): + if device_dir_item.endswith(target_file_ext) and device_dir_item == 'lighting-app.zap': device_name = device_dir_item[:-len(target_file_ext)] device_file_path = os.path.join(chef_devices_dir, device_dir_item) with open(device_file_path, "rb") as device_file: @@ -234,6 +235,12 @@ def main(argv: Sequence[str]) -> None: {_CHEF_SCRIPT_PATH}/devices/{device_name}.zap -o {device_out_dir}") shell.run_cmd(f"touch {device_out_dir}/af-gen-event.h") with open(ci_manifest_file_name, "w+", encoding="utf-8") as ci_manifest_file: + git_cmd = ["git", "ls-tree", "master", "third_party/zap/repo"] + zap_commit = str(subprocess.check_output(git_cmd, cwd=_REPO_BASE_PATH)) + zap_commit = zap_commit.split(" ")[2] + zap_commit = zap_commit[:zap_commit.index("\\")] + print(f"zap commit: {zap_commit}") + ci_manifest["zap_commit"] = zap_commit ci_manifest_file.write(json.dumps(ci_manifest, indent=4)) exit(0) diff --git a/examples/chef/cimanifest.json b/examples/chef/cimanifest.json index 5f4e79876f343b..5521dc9ce43ac1 100644 --- a/examples/chef/cimanifest.json +++ b/examples/chef/cimanifest.json @@ -1,3 +1,4 @@ { - "lighting-app": "41c55e72d06a04d193901d6b5487f7fa" + "lighting-app": "41c55e72d06a04d193901d6b5487f7fa", + "zap_commit": "6594a9257ce96ee6d852eed052939849b31259fc" } \ No newline at end of file