Skip to content

Commit

Permalink
Filter zap cache to one file, Add zap version to manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
aBozowski committed May 24, 2022
1 parent 53156a1 commit 78a87ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import yaml
import hashlib
import json
import subprocess

import constants
import stateful_shell
Expand Down Expand Up @@ -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:
Expand All @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion examples/chef/cimanifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"lighting-app": "41c55e72d06a04d193901d6b5487f7fa"
"lighting-app": "41c55e72d06a04d193901d6b5487f7fa",
"zap_commit": "6594a9257ce96ee6d852eed052939849b31259fc"
}

0 comments on commit 78a87ba

Please sign in to comment.