Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use regular (not Perl) grep syntax in scripts #887

Merged
merged 6 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions script/generate
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ trust_sdk_and_extensions()

# Parse extension name
local extension_name=""
extension_name=$(grep -oP '^id: \K(.*)' "${slce_file}")
extension_line=$(grep -m 1 'id: ' "${slce_file}")
extension_name="${extension_line//id:/}"
jwhui marked this conversation as resolved.
Show resolved Hide resolved
extension_name="${extension_name// /}"

# Define symlink location
local extension_symlink="${sdk_dir}/extension/${extension_name}"
Expand Down Expand Up @@ -174,7 +176,9 @@ generate()
# Define generation variables
local slcp=${1?A .slcp file is expected as the first argument}
local project_name=""
project_name=$(grep -oP 'project_name: \K(.*)' "${slcp}")
project_line=$(grep 'project_name: ' "${slcp}")
project_name="${project_line//project_name:/}"
jwhui marked this conversation as resolved.
Show resolved Hide resolved
project_name="${project_name// /}"
local generation_dir=${2?A generation output dir is expected as the second argument}
local export_templates="${repo_dir}/slc/exporter_templates/platform_library"
local board=${3?A board is expected as the third argument}
Expand Down
18 changes: 14 additions & 4 deletions script/util
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,20 @@ parse_configuration()
old_setting=${-//[^e]/}
set +e
# grep raw values from the configuration file
rcp_uart_slcp="$(grep -oP 'rcp_uart_slcp: \K(.*)' "${config_yml}")"
rcp_spi_slcp="$(grep -oP 'rcp_spi_slcp: \K(.*)' "${config_yml}")"
soc_slcp="$(grep -oP 'soc_slcp: \K(.*)' "${config_yml}")"
board="$(grep -oP 'board: \K(.*)' "${config_yml}")"
line="$(grep 'rcp_uart_slcp:' "${config_yml}")"
rcp_uart_slcp="${line//rcp_uart_slcp:/}"
jwhui marked this conversation as resolved.
Show resolved Hide resolved
line="$(grep 'rcp_spi_slcp:' "${config_yml}")"
rcp_spi_slcp="${line//rcp_spi_slcp:/}"
jwhui marked this conversation as resolved.
Show resolved Hide resolved
line="$(grep 'soc_slcp:' "${config_yml}")"
soc_slcp="${line//soc_slcp:/}"
jwhui marked this conversation as resolved.
Show resolved Hide resolved
line="$(grep 'board:' "${config_yml}")"
board="${line//board:/}"
jwhui marked this conversation as resolved.
Show resolved Hide resolved

# Strip spaces
rcp_uart_slcp="${rcp_uart_slcp// /}"
rcp_spi_slcp="${rcp_spi_slcp// /}"
soc_slcp="${soc_slcp// /}"
board="${board// /}"

# Strip quotes
rcp_uart_slcp=$(eval echo "${rcp_uart_slcp}")
Expand Down