Skip to content

Commit

Permalink
Support to return software_version_string with <branch>:<commit_id> o…
Browse files Browse the repository at this point in the history
…n linux platform (project-chip#19710)
  • Loading branch information
MtTsai authored Jun 17, 2022
1 parent 504c761 commit 8da6fc8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,10 @@ def main(argv: Sequence[str]) -> None:
#

if options.do_build:
branch = shell.run_cmd(
"git branch | awk -v FS=' ' '/\*/{print $NF}' | sed 's|[()]||g'", return_cmd_output=True).replace("\n", "")
commit_id = shell.run_cmd("git rev-parse HEAD", return_cmd_output=True).replace("\n", "")

if options.use_zzz:
flush_print("Using pre-generated ZAP output")
zzz_dir = os.path.join(_CHEF_SCRIPT_PATH,
Expand Down Expand Up @@ -574,7 +578,7 @@ def main(argv: Sequence[str]) -> None:
chip_shell_cmd_server = false
chip_build_libshell = true
chip_config_network_layer_ble = false
target_defines = ["CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID={options.vid}", "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID={options.pid}", "CONFIG_ENABLE_PW_RPC={'1' if options.do_rpc else '0'}"]
target_defines = ["CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID={options.vid}", "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID={options.pid}", "CONFIG_ENABLE_PW_RPC={'1' if options.do_rpc else '0'}", "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\\"{branch}:{commit_id}\\""]
"""))
with open(f"{_CHEF_SCRIPT_PATH}/linux/sample.gni", "w") as f:
f.write(textwrap.dedent(f"""\
Expand Down

0 comments on commit 8da6fc8

Please sign in to comment.