scripts/get_default_envs.sh: preserve order of multiple entries for same variable
PATCH 1/1 scripts/get_default_envs.sh: preserve order of multiple entries for same variable
It's possible that the default_environment[] array contains multiple entries for the same variable, e.g. a setting from env_default.h based on some CONFIG_* variable, and another from CONFIG_EXTRA_ENV_SETTINGS. In such a case, the last setting takes effect.
Hence, in order to be able to use the output from this script as an CONFIG_DEFAULT_ENV_FILE and get the same default environment as one currently has, we need to preserve the order. So only sort by the variable name, and disable the last-resort comparison.
We could pipe the result through uniq to remove duplicate lines, but I think there's some value in seeing that certain variables are defined multiple times.
--- scripts/get_default_envs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/get_default_envs.sh +1 -1
@@ -35,7 +35,7 @@ cp ${env_obj_file_path} ${ENV_OBJ_FILE_COPY} ${OBJCOPY} -O binary -j ".rodata.default_environment" ${ENV_OBJ_FILE_COPY} # Replace default '\0' with '\n' and sort entries -tr '\0' '\n' < ${ENV_OBJ_FILE_COPY} | sort -u +tr '\0' '\n' < ${ENV_OBJ_FILE_COPY} | sort --field-separator== -k1,1 --stable rm ${ENV_OBJ_FILE_COPY}
Signature · 1 line
2.23.0
PATCH 1/1 scripts/get_default_envs.sh: preserve order of multiple entries for same variable
Hi Rasmus,
Quoted 25 lines
It's possible that the default_environment[] array contains multiple entries for the same variable, e.g. a setting from
env_default.hbased on some CONFIG_* variable, and another fromCONFIG_EXTRA_ENV_SETTINGS. In such a case, the last setting takes effect.Hence, in order to be able to use the output from this script as an
CONFIG_DEFAULT_ENV_FILEand get the same default environment as one currently has, we need to preserve the order. So only sort by the variable name, and disable the last-resort comparison.We could pipe the result through uniq to remove duplicate lines, but I think there's some value in seeing that certain variables are defined multiple times.
Signed-off-by Rasmus Villemoes <[email protected]>--- scripts/get_default_envs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/get_default_envs.sh +0
-0
scripts/get_default_envs.sh cp ${env_obj_file_path} ${ENV_OBJ_FILE_COPY} · line 40
Quoted 8 lines
scripts/get_default_envs.sh +1
-2@@ -35,7 +35,7 @@ cp ${env_obj_file_path} ${ENV_OBJ_FILE_COPY} ${OBJCOPY} -O binary -j ".rodata.default_environment" ${ENV_OBJ_FILE_COPY} # Replace default '\0' with '\n' and sort entries -tr '\0' '\n' < ${ENV_OBJ_FILE_COPY} | sort -u +tr '\0' '\n' < ${ENV_OBJ_FILE_COPY} | sort --field-separator== -k1,1 --stable rm ${ENV_OBJ_FILE_COPY}
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200106/8cb426c3/attachment.sig>
PATCH 1/1 scripts/get_default_envs.sh: preserve order of multiple entries for same variable
Quoted 22 lines · Lukasz Majewski
Hi Rasmus,
Quoted 19 lines
It's possible that the default_environment[] array contains multiple entries for the same variable, e.g. a setting from
env_default.hbased on some CONFIG_* variable, and another fromCONFIG_EXTRA_ENV_SETTINGS. In such a case, the last setting takes effect.Hence, in order to be able to use the output from this script as an
CONFIG_DEFAULT_ENV_FILEand get the same default environment as one currently has, we need to preserve the order. So only sort by the variable name, and disable the last-resort comparison.We could pipe the result through uniq to remove duplicate lines, but I think there's some value in seeing that certain variables are defined multiple times.
Signed-off-by Rasmus Villemoes <[email protected]>--- scripts/get_default_envs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 1/1 scripts/get_default_envs.sh: preserve order of multiple entries for same variable
Quoted 19 lines · Simon Glass
Quoted 18 lines · Lukasz Majewski
Hi Rasmus,
Quoted 15 lines
It's possible that the default_environment[] array contains multiple entries for the same variable, e.g. a setting from
env_default.hbased on some CONFIG_* variable, and another fromCONFIG_EXTRA_ENV_SETTINGS. In such a case, the last setting takes effect.Hence, in order to be able to use the output from this script as an
CONFIG_DEFAULT_ENV_FILEand get the same default environment as one currently has, we need to preserve the order. So only sort by the variable name, and disable the last-resort comparison.We could pipe the result through uniq to remove duplicate lines, but I think there's some value in seeing that certain variables are defined multiple times.
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Signed-off-by Rasmus Villemoes <[email protected]>--- scripts/get_default_envs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Reviewed-by Lukasz Majewski <[email protected]>Reviewed-by Simon Glass <[email protected]>
Hi Tom,
This has two R-Bs, perhaps I can get you to pick it up?
Thanks,
Rasmus
PATCH 1/1 scripts/get_default_envs.sh: preserve order of multiple entries for same variable
In reply to Rasmus VillemoesQuoted 11 lines · Rasmus Villemoes
It's possible that the default_environment[] array contains multiple entries for the same variable, e.g. a setting from
env_default.hbased on some CONFIG_* variable, and another fromCONFIG_EXTRA_ENV_SETTINGS. In such a case, the last setting takes effect.Hence, in order to be able to use the output from this script as an
CONFIG_DEFAULT_ENV_FILEand get the same default environment as one currently has, we need to preserve the order. So only sort by the variable name, and disable the last-resort comparison.
Quoted 7 lines
We could pipe the result through uniq to remove duplicate lines, but I think there's some value in seeing that certain variables are defined multiple times.
Signed-off-by Rasmus Villemoes <[email protected]>Reviewed-by Lukasz Majewski <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200507/0d24d5d6/attachment.sig>