diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 0ad749b19c295a..6a82a292d372b8 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -172,10 +172,14 @@ def main(argv: Sequence[str]) -> None: dest="tty", metavar="TTY", default=None) parser.add_option("", "--generate_zzz", help="Populates zzz_generated/chef//zap-generated with output of ZAP tool for every device in examples/chef/devices. If this flag is set, all other arguments are ignored except for --bootstrap_zap and --validate_zzz.", dest="generate_zzz", action="store_true") - parser.add_option("", "--validate_zzz", help="Checks if cached ZAP output needs to be regenrated, for use in CI. If this flag is set, all other arguments are ignored.", dest="validate_zzz", action="store_true") - parser.add_option("", "--use_zzz", help="Use pre generated output from the ZAP tool found in the zzz_generated folder. Used to decrease execution time of CI jobs", dest="use_zzz", action="store_true") - parser.add_option("", "--build_all", help="Builds all chef examples across all platforms and collates artifacts. Chef exits after completion.", dest="build_all", action="store_true") - parser.add_option("", "--ci", help="Builds Chef examples defined in chef_util.ci_allowlist. Uses specified target. Chef exits after completion.", dest="ci", action="store_true") + parser.add_option("", "--validate_zzz", help="Checks if cached ZAP output needs to be regenrated, for use in CI. If this flag is set, all other arguments are ignored.", + dest="validate_zzz", action="store_true") + parser.add_option("", "--use_zzz", help="Use pre generated output from the ZAP tool found in the zzz_generated folder. Used to decrease execution time of CI jobs", + dest="use_zzz", action="store_true") + parser.add_option("", "--build_all", help="Builds all chef examples across all platforms and collates artifacts. Chef exits after completion.", + dest="build_all", action="store_true") + parser.add_option( + "", "--ci", help="Builds Chef examples defined in chef_util.ci_allowlist. Uses specified target. Chef exits after completion.", dest="ci", action="store_true") options, _ = parser.parse_args(argv) @@ -253,7 +257,8 @@ def main(argv: Sequence[str]) -> None: shell.run_cmd(f"{_REPO_BASE_PATH}/scripts/tools/zap/generate.py\ {_CHEF_SCRIPT_PATH}/devices/{device_name}.zap -o {device_out_dir}") shell.run_cmd(f"touch {device_out_dir}/af-gen-event.h") - chef_util.generate_device_manifest(chef_devices_dir, include_zap_submod=True, write_manifest_file = True, ci_manifest_file_name = ci_manifest_file_name, repo_base_path=_REPO_BASE_PATH) + chef_util.generate_device_manifest(chef_devices_dir, include_zap_submod=True, write_manifest_file=True, + ci_manifest_file_name=ci_manifest_file_name, repo_base_path=_REPO_BASE_PATH) exit(0) # diff --git a/examples/chef/chef_util.py b/examples/chef/chef_util.py index 80f021edbeb941..61aa0c462c7974 100644 --- a/examples/chef/chef_util.py +++ b/examples/chef/chef_util.py @@ -10,6 +10,7 @@ 'nrfconnect': 'nrfconnect/build', } + def check_zap_master(repo_base_path: str) -> str: """Produces hash of ZAP submodule in branch master""" git_cmd = ["git", "ls-tree", "master", "third_party/zap/repo"] @@ -19,6 +20,7 @@ def check_zap_master(repo_base_path: str) -> str: print(f"zap commit: {zap_commit}") return zap_commit + def generate_device_manifest(chef_devices_dir: str, include_zap_submod: bool = False, write_manifest_file: bool = False, ci_manifest_file_name: str = '', repo_base_path: str = '') -> dict: """Produces dictionary containing md5 of device dir zap files""" ci_manifest = {} @@ -36,5 +38,5 @@ def generate_device_manifest(chef_devices_dir: str, include_zap_submod: bool = F ci_manifest["zap_commit"] = check_zap_master(repo_base_path) 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)) + ci_manifest_file.write(json.dumps(ci_manifest, indent=4)+"\n") return ci_manifest diff --git a/examples/chef/cimanifest.json b/examples/chef/cimanifest.json index 5521dc9ce43ac1..318370d55f39b9 100644 --- a/examples/chef/cimanifest.json +++ b/examples/chef/cimanifest.json @@ -1,4 +1,4 @@ { "lighting-app": "41c55e72d06a04d193901d6b5487f7fa", "zap_commit": "6594a9257ce96ee6d852eed052939849b31259fc" -} \ No newline at end of file +}