From 061cdf2bb010ae66c8ff0972d2c9e7b5d2b627c8 Mon Sep 17 00:00:00 2001 From: brian-level Date: Wed, 12 Jun 2024 13:53:12 -0400 Subject: [PATCH 1/6] dont use gnu specific grep --- script/generate | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/script/generate b/script/generate index d1cef59a..d476710c 100755 --- a/script/generate +++ b/script/generate @@ -117,7 +117,8 @@ 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="$(echo ${extension_line//id:/})" # Define symlink location local extension_symlink="${sdk_dir}/extension/${extension_name}" @@ -174,7 +175,8 @@ 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="$(echo ${project_line//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} From b5d30c8c51621343bab6a9e68edfe89b55db2bd1 Mon Sep 17 00:00:00 2001 From: brian-level Date: Wed, 12 Jun 2024 16:40:59 -0400 Subject: [PATCH 2/6] take out perl-grep in util --- script/util | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/script/util b/script/util index bd21282c..cef584fd 100644 --- a/script/util +++ b/script/util @@ -85,10 +85,14 @@ 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="$(echo $line//rcp_uart_slcp:/)" + line="$(grep 'rcp_spi_slcp:' "${config_yml}")" + rcp_spi_slcp="$(echo $line//rcp_spi_slcp:/)" + line="$(grep 'soc_slcp:' "${config_yml}")" + soc_slcp="$(echo $line//soc_slcp:/)" + line="$(grep 'board:' "${config_yml}")" + board="$(echo $line//board:/)" # Strip quotes rcp_uart_slcp=$(eval echo "${rcp_uart_slcp}") @@ -103,3 +107,4 @@ parse_configuration() if [[ -n $old_setting ]]; then set -e; else set +e; fi } + From 0d848b2699714c5d1496f9060d094c024ed35584 Mon Sep 17 00:00:00 2001 From: brian-level Date: Thu, 13 Jun 2024 11:27:13 -0400 Subject: [PATCH 3/6] add newline to util script for shfmt --- script/util | 1 - 1 file changed, 1 deletion(-) diff --git a/script/util b/script/util index cef584fd..fd3ba267 100644 --- a/script/util +++ b/script/util @@ -107,4 +107,3 @@ parse_configuration() if [[ -n $old_setting ]]; then set -e; else set +e; fi } - From 49f0e904a9283ac1e0744795cc470eb296706f05 Mon Sep 17 00:00:00 2001 From: brian-level Date: Fri, 14 Jun 2024 06:20:38 -0400 Subject: [PATCH 4/6] simplify shell --- script/generate | 4 ++-- script/util | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/script/generate b/script/generate index d476710c..61614c46 100755 --- a/script/generate +++ b/script/generate @@ -118,7 +118,7 @@ trust_sdk_and_extensions() # Parse extension name local extension_name="" extension_line=$(grep -m 1 'id: ' "${slce_file}") - extension_name="$(echo ${extension_line//id:/})" + extension_name="${extension_line//id:/}" # Define symlink location local extension_symlink="${sdk_dir}/extension/${extension_name}" @@ -176,7 +176,7 @@ generate() local slcp=${1?A .slcp file is expected as the first argument} local project_name="" project_line=$(grep 'project_name: ' "${slcp}") - project_name="$(echo ${project_line//project_name:/})" + project_name="${project_line//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} diff --git a/script/util b/script/util index fd3ba267..93ea759c 100644 --- a/script/util +++ b/script/util @@ -86,13 +86,13 @@ parse_configuration() set +e # grep raw values from the configuration file line="$(grep 'rcp_uart_slcp:' "${config_yml}")" - rcp_uart_slcp="$(echo $line//rcp_uart_slcp:/)" + rcp_uart_slcp="${line//rcp_uart_slcp:/}" line="$(grep 'rcp_spi_slcp:' "${config_yml}")" - rcp_spi_slcp="$(echo $line//rcp_spi_slcp:/)" + rcp_spi_slcp="${line//rcp_spi_slcp:/}" line="$(grep 'soc_slcp:' "${config_yml}")" - soc_slcp="$(echo $line//soc_slcp:/)" + soc_slcp="${line//soc_slcp:/}" line="$(grep 'board:' "${config_yml}")" - board="$(echo $line//board:/)" + board="${line//board:/}" # Strip quotes rcp_uart_slcp=$(eval echo "${rcp_uart_slcp}") From d52c41dee9b5255b2afa0f57c96caae438f01329 Mon Sep 17 00:00:00 2001 From: brian-level Date: Fri, 14 Jun 2024 15:19:10 -0400 Subject: [PATCH 5/6] strip spaces from names --- script/generate | 2 ++ script/util | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/script/generate b/script/generate index 61614c46..14939748 100755 --- a/script/generate +++ b/script/generate @@ -119,6 +119,7 @@ trust_sdk_and_extensions() local extension_name="" extension_line=$(grep -m 1 'id: ' "${slce_file}") extension_name="${extension_line//id:/}" + extension_name="${extension_name// /}" # Define symlink location local extension_symlink="${sdk_dir}/extension/${extension_name}" @@ -177,6 +178,7 @@ generate() local project_name="" project_line=$(grep 'project_name: ' "${slcp}") project_name="${project_line//project_name:/}" + project_name="${project_line// /}" 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} diff --git a/script/util b/script/util index 93ea759c..5e8c75fb 100644 --- a/script/util +++ b/script/util @@ -94,6 +94,12 @@ parse_configuration() line="$(grep 'board:' "${config_yml}")" board="${line//board:/}" + # 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}") rcp_spi_slcp=$(eval echo "${rcp_spi_slcp}") From 365f4e3ed565788bc2faaee1f4889dd03478a556 Mon Sep 17 00:00:00 2001 From: brian-level Date: Fri, 14 Jun 2024 16:34:13 -0400 Subject: [PATCH 6/6] fix mistake in stripping spaces from projectname --- script/generate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/generate b/script/generate index 14939748..606e4c94 100755 --- a/script/generate +++ b/script/generate @@ -178,7 +178,7 @@ generate() local project_name="" project_line=$(grep 'project_name: ' "${slcp}") project_name="${project_line//project_name:/}" - project_name="${project_line// /}" + 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}