public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH] scripts/get_default_envs.sh: preserve order of multiple entries for same variable
Date: Mon, 6 Jan 2020 13:16:58 +0100	[thread overview]
Message-ID: <20200106131658.635ac230@jawa> (raw)
In-Reply-To: <20200106120107.22564-1-rasmus.villemoes@prevas.dk>

Hi Rasmus,

> 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.
> 
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> ---
>  scripts/get_default_envs.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/get_default_envs.sh b/scripts/get_default_envs.sh
> index da86a9d69c..d1f2ce4d5c 100755
> --- a/scripts/get_default_envs.sh
> +++ b/scripts/get_default_envs.sh
> @@ -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}
>  

Reviewed-by: Lukasz Majewski <lukma@denx.de>


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>

  reply	other threads:[~2020-01-06 12:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 12:01 [PATCH] scripts/get_default_envs.sh: preserve order of multiple entries for same variable Rasmus Villemoes
2020-01-06 12:16 ` Lukasz Majewski [this message]
2020-01-30  2:17   ` Simon Glass
2020-04-29  8:46     ` Rasmus Villemoes
2020-05-07 13:03 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200106131658.635ac230@jawa \
    --to=lukma@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox