Skip to content

Commit

Permalink
Untested git
Browse files Browse the repository at this point in the history
  • Loading branch information
aBozowski committed Jun 1, 2022
1 parent d8bb5b3 commit 23ca784
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,13 @@ def check_zap(master=False) -> str:
# zap_commit = zap_commit.split(" ")[2]
# zap_commit = zap_commit[:zap_commit.index("\\")]
"""
shell.run_cmd(f"cd {_CHIP_ROOT}")
if master:
pass
shell.run_cmd(f"git fetch master")
branch = "master"
else:
command = "git rev-parse --abbrev-ref HEAD"
zap_commit = 'TEMP DISABLED'
branch = shell.run_cmd("git rev-parse --abbrev-ref HEAD", return_cmd_output=True)
zap_commit = shell.run_cmd(f"git ls-tree {branch} third_party/zap/repo")
flush_print(f"zap commit: {zap_commit}")
return zap_commit

Expand Down Expand Up @@ -145,7 +147,10 @@ def generate_device_manifest(
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()
if options.validate_zzz:
ci_manifest["zap_commit"] = check_zap(master=True)
elif options.generate_zzz:
ci_manifest["zap_commit"] = check_zap()
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")
Expand Down Expand Up @@ -291,7 +296,7 @@ def main(argv: Sequence[str]) -> None:
git add {_CHEF_ZZZ_ROOT}
git add {_CI_MANIFEST_FILE_NAME}
Ensure you are running with the latest version of ZAP from master!""")
ci_manifest = generate_device_manifest()
ci_manifest = generate_device_manifest(include_zap_submod=True)
with open(_CI_MANIFEST_FILE_NAME, "r", encoding="utf-8") as ci_manifest_file:
cached_manifest = json.loads(ci_manifest_file.read())
cached_device_manifest = cached_manifest["devices"]
Expand All @@ -312,13 +317,8 @@ def main(argv: Sequence[str]) -> None:
if output_cached_md5 != device_md5:
flush_print(f"OUTPUT MISMATCH {device}: {fix_instrucitons}")
exit(1)
if False:
# TODO
# Disabled; should check:
# Current branch when writing manifest
# Master in CI
flush_print("BAD ZAP VERSION: "+fix_instructions)
# should only warn in output and not stop builds
if ci_manifest["zap_commit"] != cached_manifest["zap_commit"]:
flush_print(f"BAD ZAP VERSION: {fix_instructions}")
flush_print("Cached ZAP output is up to date!")
exit(0)

Expand Down

0 comments on commit 23ca784

Please sign in to comment.