Skip to content

Commit

Permalink
Restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
aBozowski committed May 25, 2022
1 parent 547a361 commit b26e609
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
15 changes: 10 additions & 5 deletions examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/<DEVICE_TYPE>/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)

Expand Down Expand Up @@ -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)

#
Expand Down
4 changes: 3 additions & 1 deletion examples/chef/chef_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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 = {}
Expand All @@ -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
2 changes: 1 addition & 1 deletion examples/chef/cimanifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"lighting-app": "41c55e72d06a04d193901d6b5487f7fa",
"zap_commit": "6594a9257ce96ee6d852eed052939849b31259fc"
}
}

0 comments on commit b26e609

Please sign in to comment.