From 7d79cba28ca9bb02ba589eca2e80ce837d7d0ca8 Mon Sep 17 00:00:00 2001 From: Christoph Niedermaier Date: Wed, 23 Feb 2022 10:33:36 +0100 Subject: scripts/get_default_envs.sh: Remove blank lines After sorting, unnoticed blank lines at the end move to the top. Avoid this by removing it before sorting. Signed-off-by: Christoph Niedermaier Cc: Lukasz Majewski Cc: Rasmus Villemoes Cc: Tom Rini To: u-boot@lists.denx.de --- scripts/get_default_envs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/get_default_envs.sh b/scripts/get_default_envs.sh index 3c6fdc45e11..fedf7206fe1 100755 --- a/scripts/get_default_envs.sh +++ b/scripts/get_default_envs.sh @@ -35,8 +35,8 @@ cp ${env_obj_file_path} ${ENV_OBJ_FILE_COPY} ${OBJCOPY} --dump-section .rodata.default_environment=${ENV_OBJ_FILE_COPY} \ ${env_obj_file_path} -# Replace default '\0' with '\n' and sort entries -tr '\0' '\n' < ${ENV_OBJ_FILE_COPY} | sort --field-separator== -k1,1 --stable +# Replace default '\0' with '\n' , remove blank lines and sort entries +tr '\0' '\n' < ${ENV_OBJ_FILE_COPY} | sed -e '/^\s*$/d' | sort --field-separator== -k1,1 --stable rm ${ENV_OBJ_FILE_COPY} -- cgit v1.2.3 From 6910dbe3413e684bff9a194945df60345ecbc623 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 12 Mar 2022 22:47:49 -0700 Subject: env: Allow text-env tests to run with awk At present the tests assume that gawk is being used. Adjust the tests so that the names are inserted in alphabetical order, so that awk is happy. Also use PROCINFO to make gawk output in alphabetical order. This is not ideal, since it changes the env-car ordering from what the user provided, but it may be acceptable. Signed-off-by: Simon Glass Reported-by: Patrick Delaunay Fixes: https://source.denx.de/u-boot/u-boot/-/issues/10 --- scripts/env2string.awk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/env2string.awk b/scripts/env2string.awk index 1bfe9ed07a4..de470a49941 100644 --- a/scripts/env2string.awk +++ b/scripts/env2string.awk @@ -81,7 +81,10 @@ END { if (do_output) { printf("%s", "#define CONFIG_EXTRA_ENV_TEXT \"") - # Print out all the variables + # Print out all the variables by alphabetic order, if using + # gawk. This allows test_env_test.py to work on both awk (where + # this next line does nothing) + PROCINFO["sorted_in"] = "@ind_str_asc" for (var in vars) { env = vars[var] print var "=" vars[var] "\\0" -- cgit v1.2.3