From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6727677240025284608 Date: Wed, 21 Aug 2019 11:44:37 -0700 (PDT) From: vijai kumar To: isar-users Message-Id: In-Reply-To: <199abc3d-5887-7011-c4be-b08b909c1a04@siemens.com> References: <20190821174327.3369-1-Vijaikumar_Kangarajan@mentor.com> <199abc3d-5887-7011-c4be-b08b909c1a04@siemens.com> Subject: Re: [PATCH] scripts: Avoid adding duplicate entries to PATH MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_38_2125714567.1566413077900" X-Google-Token: EJWi9uoFwjnnwZR379o0 X-Google-IP: 192.94.34.34 X-TUID: A1hGcYZ/O61N ------=_Part_38_2125714567.1566413077900 Content-Type: multipart/alternative; boundary="----=_Part_39_328339739.1566413077900" ------=_Part_39_328339739.1566413077900 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Wednesday, August 21, 2019 at 11:19:22 PM UTC+5:30, Jan Kiszka wrote: > > On 21.08.19 19:43, vijaikumar...@gmail.com wrote: > > From: Vijai Kumar K > > > > > 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 > > > --- > > scripts/isar-buildenv-internal | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/scripts/isar-buildenv-internal > b/scripts/isar-buildenv-internal > > index 2186e40..8b941a2 100755 > > --- a/scripts/isar-buildenv-internal > > +++ b/scripts/isar-buildenv-internal > > @@ -60,7 +60,14 @@ 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 > > + > > export PATH > > > > BBPATH="${BUILDDIR}" > > > > That's taken from OE - makes sense. OE does "unset newpath" afterwards. > Yes. Right from OE. Ah, it does. Will add in v2. > > Is there more relevant stuff that we may lack? For now, this is it. Just came across this issue. Found out that oe has handled it, so brought in the same. > > Jan > > -- > Siemens AG, Corporate Technology, CT RDA IOT SES-DE > Corporate Competence Center Embedded Linux > ------=_Part_39_328339739.1566413077900 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


On Wednesday, August 21, 2019 at 11:19:22 PM UTC+5= :30, Jan Kiszka wrote:
On 21.08= .19 19:43, vijaikumar...@gmail.com wrote:
> From: Vijai Kumar K <Vijaikumar_...@mentor.com>
>=20
> If the setup script is run multiple times in the same shell sessio= n,
> PATH variable gets overpopulated with duplicate entries. Remove an= y
> existing entries before adding.
>=20
> Signed-off-by: Vijai Kumar K <Vijaikumar_...@mentor.com>
> ---
> =C2=A0 scripts/isar-buildenv-internal | 9 ++++++++-
> =C2=A0 1 file changed, 8 insertions(+), 1 deletion(-)
>=20
> diff --git a/scripts/isar-buildenv-internal b/scripts/isar-bu= ildenv-internal
> index 2186e40..8b941a2 100755
> --- a/scripts/isar-buildenv-internal
> +++ b/scripts/isar-buildenv-internal
> @@ -60,7 +60,14 @@ unset BDIR
> =C2=A0=20
> =C2=A0 export BUILDDIR
> =C2=A0=20
> -PATH=3D$ISARROOT/bitbake/bin:$ISARROOT/scripts:$PATH
> +for newpath in "$ISARROOT/bitbake/bin" "$ISARROOT/= scripts"; do
> + =C2=A0 =C2=A0# Remove any existences of $newpath from $PATH
> + =C2=A0 =C2=A0PATH=3D$(echo $PATH | sed -re "s#(^|:)$newpath= (:|$)#\2#g;s#^:##")
> +
> + =C2=A0 =C2=A0# Add $newpath to $PATH
> + =C2=A0 =C2=A0PATH=3D"$newpath:$PATH"
> +done
> +
> =C2=A0 export PATH
> =C2=A0=20
> =C2=A0 BBPATH=3D"${BUILDDIR}"
>=20

That's taken from OE - makes sense. OE does "unset newpath&quo= t; afterwards.

Yes. Right from OE. Ah, it does. Will = add in v2.
=C2=A0

Is there more relevant stuff that we may lack?

For now, this is it. Just came across this issue. Found out that oe= has handled it, so brought in the same.=C2=A0



Jan

--=20
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
------=_Part_39_328339739.1566413077900-- ------=_Part_38_2125714567.1566413077900--