From 23ca7847b23d435441a9bff245c28fc75a3628fd Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Wed, 1 Jun 2022 18:21:11 +0000 Subject: [PATCH] Untested git --- examples/chef/chef.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index ac90c772e30aa5..180e0a2e36604c 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -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 @@ -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") @@ -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"] @@ -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)