public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: vijaikumar.kanagarajan@gmail.com, isar-users@googlegroups.com,
	henning.schild@siemens.com, claudius.heine.ext@siemens.com
Cc: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
Subject: Re: [PATCH v2] scripts: Avoid adding duplicate entries to PATH
Date: Wed, 21 Aug 2019 21:00:28 +0200	[thread overview]
Message-ID: <85a07645-8597-8db5-bd29-a515a0842f0a@siemens.com> (raw)
In-Reply-To: <20190821184837.7279-1-Vijaikumar_Kangarajan@mentor.com>

On 21.08.19 20:48, vijaikumar.kanagarajan@gmail.com wrote:
> From: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
> 
> If the setup script is run multiple times in the same shell session,
> PATH variable gets overpopulated with duplicate entries. Remove any
> existing entries before adding.
> 
> Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
> ---
> Changes in v2:
> - Unset newpath
> 
>   scripts/isar-buildenv-internal | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/isar-buildenv-internal b/scripts/isar-buildenv-internal
> index 2186e40..72a91ab 100755
> --- a/scripts/isar-buildenv-internal
> +++ b/scripts/isar-buildenv-internal
> @@ -60,7 +60,15 @@ unset BDIR
>   
>   export BUILDDIR
>   
> -PATH=$ISARROOT/bitbake/bin:$ISARROOT/scripts:$PATH
> +for newpath in "$ISARROOT/bitbake/bin" "$ISARROOT/scripts"; do
> +    # Remove any existences of $newpath from $PATH
> +    PATH=$(echo $PATH | sed -re "s#(^|:)$newpath(:|$)#\2#g;s#^:##")
> +
> +    # Add $newpath to $PATH
> +    PATH="$newpath:$PATH"
> +done
> +unset newpath
> +
>   export PATH
>   
>   BBPATH="${BUILDDIR}"
> 

Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>

Thanks,
Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2019-08-21 19:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 17:43 [PATCH] " vijaikumar.kanagarajan
2019-08-21 17:49 ` Jan Kiszka
2019-08-21 18:44   ` vijai kumar
2019-08-21 18:48   ` [PATCH v2] " vijaikumar.kanagarajan
2019-08-21 19:00     ` Jan Kiszka [this message]
2019-09-03  7:56       ` Vijai Kumar K
2019-09-09 13:59     ` Baurzhan Ismagulov

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=85a07645-8597-8db5-bd29-a515a0842f0a@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=Vijaikumar_Kanagarajan@mentor.com \
    --cc=claudius.heine.ext@siemens.com \
    --cc=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=vijaikumar.kanagarajan@gmail.com \
    /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