From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web12.6700.1586915295537159632 for ; Tue, 14 Apr 2020 18:48:16 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: eric.dong@intel.com) IronPort-SDR: KMxrKLlQT/XLdOVvNfQvKb0rml0eMlehC6khq0C8FlNuysvv9ufnwi3ZTMIC5bUqvtxLTwbNJ4 u4uyiA5H1t/g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2020 18:48:14 -0700 IronPort-SDR: uzdup/UIoU+8285idfvVvFG0q+lc/HbVmGfcq3c7/DjODGTKvAi4pWr38WegGZaK4HO/UIlg+n 2zv5eITxn2ag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,385,1580803200"; d="scan'208,217";a="253374725" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 14 Apr 2020 18:48:13 -0700 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 14 Apr 2020 18:48:14 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 14 Apr 2020 18:48:13 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.138]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.191]) with mapi id 14.03.0439.000; Wed, 15 Apr 2020 09:48:09 +0800 From: "Dong, Eric" To: "Luo, Heng" , "Feng, Bob C" , "devel@edk2.groups.io" CC: "Ni, Ray" , "Gao, Liming" , "Chan, Amy" Subject: Re: [PATCH] Platform/Intel/Tools: Add scripts to set PACKAGES_PATH environment Thread-Topic: [PATCH] Platform/Intel/Tools: Add scripts to set PACKAGES_PATH environment Thread-Index: AQHWDtRaRIQqy+bBjkCWiQJ3ZUAxg6h43+QAgACGXkD//4K8gIAAiPzA Date: Wed, 15 Apr 2020 01:48:09 +0000 Message-ID: References: <20200410010549.866-1-heng.luo@intel.com> <8AA0A44780D72D4CABD3ED3688D16E3E78FD278E@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <8AA0A44780D72D4CABD3ED3688D16E3E78FD278E@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: eric.dong@intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_ED077930C258884BBCB450DB737E66225A023737shsmsx102ccrcor_" --_000_ED077930C258884BBCB450DB737E66225A023737shsmsx102ccrcor_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Pushed the change, detail below: SHA-1: beecaf5d933bfd49ec0654fe08a473002d27d49c * Platform/Intel/Tools: Add scripts to set PACKAGES_PATH environment Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2656 1. Add GetPackagesPath.py, it will be used to get package pathes from special directories. A sub directory is a qualified package path when an EDKII Package can be found under it. 2. Add AppendPackagesPath.bat and AppendPackagesPath.sh, these scripts call GetPackagesPath.py to collect all package paths under specified directories and append them to PACKAGES_PATH environment variable. Cc: Liming Gao Cc: Amy Chan Signed-off-by: Heng Luo Reviewed-by: Ray Ni Reviewed-by: Bob Feng Reviewed-by: Eric Dong Thanks, Eric From: Luo, Heng Sent: Wednesday, April 15, 2020 9:37 AM To: Dong, Eric ; Feng, Bob C ; d= evel@edk2.groups.io Cc: Ni, Ray ; Gao, Liming ; Chan, A= my Subject: RE: [PATCH] Platform/Intel/Tools: Add scripts to set PACKAGES_PATH= environment Attach the patch. Thank Bob and Eric. Best Regards Heng > -----Original Message----- > From: Dong, Eric > > Sent: Wednesday, April 15, 2020 9:07 AM > To: Feng, Bob C >; Luo,= Heng >; > devel@edk2.groups.io > Cc: Ni, Ray >; Gao, Liming >; Chan, > Amy > > Subject: RE: [PATCH] Platform/Intel/Tools: Add scripts to set > PACKAGES_PATH environment > > Thanks bob. > > > Heng, > > Please help to update the patch and send it to me, I will help to push i= t. > > Thanks, > Eric > > > -----Original Message----- > > From: Feng, Bob C > > Sent: Wednesday, April 15, 2020 9:05 AM > > To: Luo, Heng >; devel@ed= k2.groups.io > > Cc: Ni, Ray >; Dong, Eric >; Gao, > > Liming >; Chan, Amy <= amy.chan@intel.com> > > Subject: RE: [PATCH] Platform/Intel/Tools: Add scripts to set > > PACKAGES_PATH environment > > > > A typo in the Readme.md. Others are fine for me. > > **:+The old PACKAGES_PATH will be replaced by new one.s > > > > After fix that typo, > > Reviewed-by: Bob Feng > > > > > -----Original Message----- > > From: Luo, Heng > > > Sent: Friday, April 10, 2020 9:06 AM > > To: devel@edk2.groups.io > > Cc: Ni, Ray >; Dong, Eric >; Gao, > > Liming >; Feng, Bob C= >; > > Chan, Amy > > > Subject: [PATCH] Platform/Intel/Tools: Add scripts to set > > PACKAGES_PATH environment > > > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2656 > > > > 1. Add GetPackagesPath.py, it will be used to get package pathes from > > special directories. A sub directory is a qualified package path > > when an EDKII Package can be found under it. > > 2. Add AppendPackagesPath.bat and AppendPackagesPath.sh, these scripts > > call GetPackagesPath.py to collect all package paths under specified > > directories and append them to PACKAGES_PATH environment variable. > > > > Cc: Ray Ni > > > Cc: Eric Dong > > > Cc: Liming Gao > > > Cc: Bob Feng > > > Cc: Amy Chan > > > Signed-off-by: Heng Luo > > > --- > > Platform/Intel/Tools/AppendPackagesPath/AppendPackagesPath.bat | 33 > > +++++++++++++++++++++++++++++++++ > > Platform/Intel/Tools/AppendPackagesPath/AppendPackagesPath.sh | 42 > > ++++++++++++++++++++++++++++++++++++++++++ > > Platform/Intel/Tools/AppendPackagesPath/GetPackagesPath.py | 98 > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > ++++++++++++++++++++++++++++++++++++++++ > > Platform/Intel/Tools/AppendPackagesPath/Readme.md | 28 > > ++++++++++++++++++++++++++++ > > 4 files changed, 201 insertions(+) > > > > diff --git > > a/Platform/Intel/Tools/AppendPackagesPath/AppendPackagesPath.bat > > b/Platform/Intel/Tools/AppendPackagesPath/AppendPackagesPath.bat > > new file mode 100644 > > index 0000000000..da15d9c451 > > --- /dev/null > > +++ > b/Platform/Intel/Tools/AppendPackagesPath/AppendPackagesPath.bat > > @@ -0,0 +1,33 @@ > > +@REM @file+@REM Windows batch file to set PACKAGES_PATH > > environment+@REM+@REM Copyright (c) 2020, Intel Corporation. All > > environment+rights > > reserved.
+@REM SPDX-License-Identifier: BSD-2-Clause- > > Patent+@REM+@REM This script calls GetPackagesPath.py to collect all > > package paths under+@REM specified directories and appends them to > > PACKAGES_PATH environment+@REM variable. A sub directory is a > > qualified package path when an EDKII+@REM Package can be found under > > it.++@echo off+@if /I "%1"=3D=3D"" @goto Usage+@if /= I "%1"=3D=3D"-h" @goto > > Usage+@if /I "%1"=3D=3D"--help" @goto Usage+@if /I "%1"=3D=3D"/?" @goto > > Usage++for /f %%i in ('python %~dp0\GetPackagesPath.py %*') do (+ if > > defined PACKAGES_PATH (+ set > > "PACKAGES_PATH=3D%PACKAGES_PATH%;%%i"+ ) else (+ set > > "PACKAGES_PATH=3D%%i"+ )+)+@goto End++:Usage+@echo Usage: > > AppendPackagesPath.bat directory [directory ...]+@echo Copyright(c) 202= 0, > > Intel Corporation. All rights reserved.+@echo O= ptions:+@echo --help, -h > > Print this help screen and exit++:Enddiff --git > > a/Platform/Intel/Tools/AppendPackagesPath/AppendPackagesPath.sh > > b/Platform/Intel/Tools/AppendPackagesPath/AppendPackagesPath.sh > > new file mode 100644 > > index 0000000000..599c8d073b > > --- /dev/null > > +++ b/Platform/Intel/Tools/AppendPackagesPath/AppendPackagesPath.sh > > @@ -0,0 +1,42 @@ > > +#!/bin/bash > > + > > +# > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.
# > > +SPDX-License-Identifier: BSD-2-Clause-Patent # # This script calls > > +GetPackagesPath.py to collect all package paths under # specified > > +directories and appends them to PACKAGES_PATH environment # variable. > > A > > +sub directory is a qualified package path when an EDKII # Package can > > +be found under it. > > +# > > +# Note: This script must be \'sourced\' so the environment can be > changed: > > +# source SetPackagesPath.sh > > +# . AppendPackagesPath.sh > > + > > +function Usage() > > +{ > > + echo "Usage: source AppendPackagesPath.sh directory [directory ...= ]" > > + echo "Copyright(c) 2020, Intel Corporation. All rights reserved." > > + echo "Options:" > > + echo " --help, -h Print this help screen and exit" > > + echo "Please note: This script must be \'sourced\' so the > > +environment can > > be changed." > > + echo ". AppendPackagesPath.sh" > > + echo "source AppendPackagesPath.sh" > > +} > > + > > +function SetEnv() > > +{ > > + local tool_path=3D$(dirname "$BASH_SOURCE") > > + local paths=3D$(python $tool_path/GetPackagesPath.py $@) > > + if [ "$PACKAGES_PATH" ]; then > > + PACKAGES_PATH=3D$PACKAGES_PATH:$paths > > + else > > + PACKAGES_PATH=3D$paths > > + fi > > +} > > + > > +if [ $# -eq 0 -o "$1" =3D=3D "-h" -o "$1" =3D=3D "--help" -o "$1" =3D= =3D "/?" ]; then > > + Usage > > +else > > + SetEnv $@ > > +fi > > diff --git > > a/Platform/Intel/Tools/AppendPackagesPath/GetPackagesPath.py > > b/Platform/Intel/Tools/AppendPackagesPath/GetPackagesPath.py > > new file mode 100644 > > index 0000000000..31ed44cfa3 > > --- /dev/null > > +++ b/Platform/Intel/Tools/AppendPackagesPath/GetPackagesPath.py > > @@ -0,0 +1,98 @@ > > +## @file+# Get all recursive package paths from special > > +directories.+#+# > > Copyright (c) 2020, Intel Corporation. All rights reserved.
+# > > SPDX- > > License-Identifier: BSD-2-Clause-Patent+#++import os+import > > glob+import > > argparse++#+# Globals for help information+#+__prog__ =3D > > 'GetPackagesPath.py'+__copyright__ =3D 'Copyright (c) 2020, Intel > Corporation. > > All rights reserved.'+__description__ =3D 'Gets all recursive package p= aths in > > specified directory.\n'++def __get_packages_path(root):+ """ Gets al= l > > recursive package paths in specified directory.+ A directory is = a package > > path if it satisfies conditions below:+ 1. it is a directory+ = 2. it is not > an > > EDK II Package. An EDK II Package (directory) is+ a directory= that > > contains an EDK II package declaration (DEC) file.+ 3. it contai= ns at least > > one first level EDK II Package.+ Note: A directory is not packag= e path but > > its subdirectory could be.+ Example: edk2-platforms/Features is = not > > package path+ but edk2-platforms/Features/Intel is.++ :pa= ram root: > > The specified directory to find package paths in it,+ the ca= ller should > > ensure it is an valid directory+ :type root: String+ :ret= urns: Return all > > recursive package paths+ :rtype: String list+ """++ paths = =3D []+ > > contain_package =3D False+ for filename in os.listdir(root):+ = # skip files > > whose name starts with ".", such as ".git"+ if filename.startswi= th('.'):+ > > continue+ filepath =3D os.path.join(root, filename)+ if > > os.path.isdir(filepath):+ if glob.glob(os.path.join(filepath= , '*.dec')):+ > > # it is an EDK II Package+ contain_package =3D True+ = else:+ > > # get package paths for subdirectory if it is not package+ = paths =3D > > paths + __get_packages_path(filepath)++ if contain_package:+ = # root > is > > a package path because it contains EDK II Package+ # in first le= vel folder, > > inset it to head of list+ paths.insert(0, root)++ # return pa= ckage paths+ > > return paths++def get_packages_path(directories):+ """ For each dire= cory > > in directories, gets all recursive package paths+ in this direct= ory and > joins > > them into one string.++ :param directories: the list of > directory+ :type > > directories: String list+ :returns: Return string of package > paths+ :rtype: > > String+ """++ packages_path =3D ''+ for directory in directori= es:+ > > directory =3D os.path.abspath(directory)+ if (not os.path.exists= (directory)) > > or (not os.path.isdir(directory)):+ continue++ if > > glob.glob(os.path.join(directory, '*.dec')):+ # it is an EDK= II Package+ > > continue++ paths =3D __get_packages_path(directory)+ for = path in > > paths:+ if packages_path =3D=3D '':+ packages= _path =3D path+ > > else:+ packages_path +=3D os.pathsep + path+ return > > packages_path++if __name__ =3D=3D '__main__':+ # Create command line > > argument parser object+ parser =3D argparse.ArgumentParser(+ > > prog=3D__prog__,+ description=3D__description__ + __copyrigh= t__,+ > > conflict_handler=3D'resolve'+ )+ parser.add_argument('directory', > > nargs=3D'+',+ help=3D'Specified directory where package pack= ages are got > > from')+ args =3D parser.parse_args()+ > > print(get_packages_path(args.directory))diff --git > > a/Platform/Intel/Tools/AppendPackagesPath/Readme.md > > b/Platform/Intel/Tools/AppendPackagesPath/Readme.md > > new file mode 100644 > > index 0000000000..66aebee7cf > > --- /dev/null > > +++ b/Platform/Intel/Tools/AppendPackagesPath/Readme.md > > @@ -0,0 +1,28 @@ > > ++# How to use AppendPackagesPath++## Overview++This script calls > > GetPackagesPath.py to collect all package paths under specified > > directories and appends them to PACKAGES_PATH environment variable. A > > sub directory is a qualified package path when an EDKII Package can be > > found under it.++**Notice**:+The old PACKAGES_PATH will be replaced by > > new one.s++## The usage of the tool++### Windows++Usage: > > AppendPackagesPath.bat directory [directory ...]+Copyright(c) 2020, Int= el > > Corporation. All rights reserved.+Options:+ --help, -h Print this = help > screen > > and exit++### Ubuntu++Usage: source AppendPackagesPath.sh directory > > [directory ...]+Copyright(c) 2020, Intel Corporation. All rights > > reserved.+Options:+ --help, -h Print this help screen and exit+Ple= ase > note: > > This script must be \'sourced\' so the environment can be changed.+. > > AppendPackagesPath.sh+source AppendPackagesPath.sh-- > > 2.24.0.windows.2 > > --_000_ED077930C258884BBCB450DB737E66225A023737shsmsx102ccrcor_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Pushed the change, detail bel= ow:

 

SHA-1: beecaf5d933bfd49ec0654= fe08a473002d27d49c

 

* Platform/Intel/Tools: Ad= d scripts to set PACKAGES_PATH environment

 

Ref: https://bugzilla.tianoco= re.org/show_bug.cgi?id=3D2656

 

1. Add GetPackagesPath.py, it= will be used to get package pathes from

  special directories. A= sub directory is a qualified package path

  when an EDKII Package = can be found under it.

2. Add AppendPackagesPath.bat= and AppendPackagesPath.sh, these scripts

  call GetPackagesPath.p= y to collect all package paths under specified

  directories and append= them to PACKAGES_PATH environment variable.

 

Cc: Liming Gao <liming.gao= @intel.com>

Cc: Amy Chan <amy.chan@int= el.com>

Signed-off-by: Heng Luo <h= eng.luo@intel.com>

Reviewed-by: Ray Ni <ray.n= i@intel.com>

Reviewed-by: Bob Feng <bob= .c.feng@intel.com>

Reviewed-by: Eric Dong <er= ic.dong@intel.com>

 

Thanks,

Eric

From: Luo, Heng
Sent: Wednesday, April 15, 2020 9:37 AM
To: Dong, Eric <eric.dong@intel.com>; Feng, Bob C <bob.c.fe= ng@intel.com>; devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Gao, Liming <liming.gao@int= el.com>; Chan, Amy <amy.chan@intel.com>
Subject: RE: [PATCH] Platform/Intel/Tools: Add scripts to set PACKAG= ES_PATH environment

 

Attach the patch.
Thank Bob and Eric.

Best Regards
Heng

> -----Original Message-----
> From: Dong, Eric <= eric.dong@intel.com> > Sent: Wednesday, April&nbs= p;15, 2020 9:07 AM
> To: Feng, Bob C = <bob.c.feng@intel.com>;&n= bsp;Luo, Heng <heng.luo@= intel.com>;
devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Gao, Lim= ing <liming.gao@intel.com>; Chan,
> Amy <
amy.chan@intel.com>

> Subject: RE: [PATCH] = Platform/Intel/Tools: Add scripts to set
> PACKAGES_PATH environment


> Thanks bob.


> Heng,

> Please help to update=  the patch and send it to me, I&nbs= p;will  help to push it.

> Thanks,
> Eric

> > -----Original Message--= ---
> > From: Feng, Bob&nb= sp;C
> > Sent: Wednesday, A= pril 15, 2020 9:05 AM
> > To: Luo, Heng = ;<heng.luo@intel.com>; = ;devel@edk2.groups.io > > Cc: Ni, Ray &= lt;ray.ni@intel.com>; Dong,=  Eric <eric.dong@intel.= com>; Gao,
> > Liming <liming.gao@intel.com>; Chan, A= my <amy.chan@intel.com>= ;
> > Subject: RE: [PATC= H] Platform/Intel/Tools: Add scripts to set=
> > PACKAGES_PATH environme= nt
> >
> > A typo in the=  Readme.md. Others are fine for me. > > **:+The old PA= CKAGES_PATH will be replaced by new one.s
> >
> > After fix that&nbs= p;typo,
> > Reviewed-by: Bob F= eng <bob.c.feng@intel.com>
> >
> > -----Original Message--= ---
> > From: Luo, Heng&nb= sp;<
heng.luo@intel.com>
> > Sent: Friday, Apri= l 10, 2020 9:06 AM
> > To: devel@edk2.groups.io
> > Cc: Ni, Ray &= lt;ray.ni@intel.com>; Dong,=  Eric <eric.dong@intel.= com>; Gao,
> > Liming <liming.gao@intel.com>; Feng, B= ob C <bob.c.feng@intel= .com>;
> > Chan, Amy <amy.chan@intel.com>
> > Subject: [PATCH] P= latform/Intel/Tools: Add scripts to set
> > PACKAGES_PATH environme= nt
> >
> > Ref: https://bugzilla.tianocore.= org/show_bug.cgi?id=3D2656
> >
> > 1. Add GetPackages= Path.py, it will be used to get package&= nbsp;pathes from
> >   special dir= ectories. A sub directory is a qualified = ;package path
> >   when an&nbs= p;EDKII Package can be found under it.=
> > 2. Add AppendPacka= gesPath.bat and AppendPackagesPath.sh, these scripts
> >   call GetPac= kagesPath.py to collect all package paths und= er specified
> >   directories = ;and append them to PACKAGES_PATH environment = ;variable.
> >
> > Cc: Ray Ni &l= t;ray.ni@intel.com>
> > Cc: Eric Dong = ;<eric.dong@intel.com>
> > Cc: Liming Gao&nbs= p;<liming.gao@intel.com><= /span>
> > Cc: Bob Feng = <bob.c.feng@intel.com>
> > Cc: Amy Chan = <amy.chan@intel.com>=
> > Signed-off-by: Heng&nbs= p;Luo <heng.luo@intel.com= >
> > ---
> >  Platform/Intel/Tools/A= ppendPackagesPath/AppendPackagesPath.bat | 33
> > +++++= 3;++++++++++++++= 3;++++++++++++
> > Platform/Intel/Tools/AppendP= ackagesPath/AppendPackagesPath.sh  | 42
> > +++++= 3;++++++++++++++= 3;++++++++++++++= 3;++++++
> >  Platform/Intel/Tools/A= ppendPackagesPath/GetPackagesPath.py     | 98=
> > +++++= 3;++++++++++++++= 3;++++++++++++++= 3;++++++++++++++= 3;+++++++
> > +++++= 3;++++++++++++++= 3;++++++++++++++= 3;++++
> >  Platform/Intel/Tools/A= ppendPackagesPath/Readme.md        =       | 28
> > +++++= 3;++++++++++++++= 3;+++++++
> >  4 files chan= ged, 201 insertions(+)
> >
> > diff --git
> > a/Platform/Intel/Tools/Appen= dPackagesPath/AppendPackagesPath.bat
> > b/Platform/Intel/Tools/Appen= dPackagesPath/AppendPackagesPath.bat
> > new file mode = ;100644
> > index 0000000000..da15d= 9c451
> > --- /dev/null > > +++
> b/Platform/Intel/Tools/AppendPackage= sPath/AppendPackagesPath.bat
> > @@ -0,0 +1,33&= nbsp;@@
> > +@REM @file+@RE= M Windows batch file to set PACKAGES_PATH
> > environment+@REM+@RE= M Copyright (c) 2020, Intel Corporation. All<= /span>
> > environment+rights
> > reserved.<BR>+@REM=  SPDX-License-Identifier: BSD-2-Clause-
> > Patent+@REM+@REM&nbs= p;This script calls GetPackagesPath.py to collect&= nbsp;all
> > package paths unde= r+@REM specified directories and appends them&= nbsp;to
> > PACKAGES_PATH environme= nt+@REM variable. A sub directory is a
> > qualified package = path when an EDKII+@REM Package can be&nb= sp;found under
> > it.++@echo off+@if /I "%1&quo= t;=3D=3D"" @goto Usage+@if /I "%1&qu= ot;=3D=3D"-h" @goto
> > Usage+@if /I &= quot;%1"=3D=3D"--help" @goto Usage+@if /I=  "%1"=3D=3D"/?" @goto
> > Usage++for /f&n= bsp;%%i in ('python %~dp0\GetPackagesPath.py %*') = do (+    if
> > defined PACKAGES_PATH&n= bsp;(+        set
> > "PACKAGES_PATH=3D%PACKA= GES_PATH%;%%i"+    ) else (+&nbs= p;       set
> > "PACKAGES_PATH=3D%%i&qu= ot;+    )+)+@goto End++:Usage&= #43;@echo Usage:
> > AppendPackagesPath.bat = directory [directory ...]+@echo Copyright(c) 2020,<= /span>
> > Intel Corporation. = ;All rights reserved.+= @echo Options:+@echo   --help, -h > > Print this help&nb= sp;screen and exit++:Enddiff --git
> > a/Platform/Intel/Tools/Appen= dPackagesPath/AppendPackagesPath.sh
> > b/Platform/Intel/Tools/Appen= dPackagesPath/AppendPackagesPath.sh
> > new file mode = ;100644
> > index 0000000000..599c8= d073b
> > --- /dev/null > > +++ b/Platf= orm/Intel/Tools/AppendPackagesPath/AppendPackagesPath.sh
> > @@ -0,0 +1,42&= nbsp;@@
> > +#!/bin/bash
> > +
> > +#
> > +# Copyright (= c) 2020, Intel Corporation. All rights reserv= ed.<BR> #
> > +SPDX-License-Identifier= : BSD-2-Clause-Patent # # This script calls
> > +GetPackagesPath.py = ;to collect all package paths under # sp= ecified
> > +directories and&nb= sp;appends them to PACKAGES_PATH environment #&nbs= p;variable.
> > A
> > +sub directory = ;is a qualified package path when an EDK= II # Package can
> > +be found unde= r it.
> > +#
> > +# Note: This&= nbsp;script must be \'sourced\' so the enviro= nment can be
> changed:
> > +# source SetP= ackagesPath.sh
> > +# . AppendPac= kagesPath.sh
> > +
> > +function Usage()
> > +{
> > +    = ;echo "Usage: source AppendPackagesPath.sh directo= ry [directory ...]"
> > +    = ;echo "Copyright(c) 2020, Intel Corporation. = All rights reserved."
> > +    = ;echo "Options:"
> > +    = ;echo "  --help, -h     P= rint this help screen and exit"
> > +    = ;echo "Please note: This script must be&= nbsp;\'sourced\' so the
> > +environment can
> > be changed."
> > +    = ;echo ". AppendPackagesPath.sh"
> > +    = ;echo "source AppendPackagesPath.sh"
> > +}
> > +
> > +function SetEnv()<= /span>
> > +{
> > +    = ;local tool_path=3D$(dirname "$BASH_SOURCE")
> > +    = ;local paths=3D$(python $tool_path/GetPackagesPath.py $@)
> > +    = ;if [ "$PACKAGES_PATH" ]; then
> > +    = ;    PACKAGES_PATH=3D$PACKAGES_PATH:$paths
> > +    = ;else
> > +    = ;    PACKAGES_PATH=3D$paths
> > +    = ;fi
> > +}
> > +
> > +if [ $# = -eq 0 -o "$1" =3D=3D "-h" = ;-o "$1" =3D=3D "--help" -o &q= uot;$1" =3D=3D "/?" ]; then
> > +    = ;Usage
> > +else
> > +    = ;SetEnv $@
> > +fi
> > diff --git
> > a/Platform/Intel/Tools/Appen= dPackagesPath/GetPackagesPath.py
> > b/Platform/Intel/Tools/Appen= dPackagesPath/GetPackagesPath.py
> > new file mode = ;100644
> > index 0000000000..31ed4= 4cfa3
> > --- /dev/null > > +++ b/Platf= orm/Intel/Tools/AppendPackagesPath/GetPackagesPath.py
> > @@ -0,0 +1,98&= nbsp;@@
> > +## @file+#&nbs= p;Get all recursive package paths from specia= l
> > +directories.+#+= #
> > Copyright (c) 2020= , Intel Corporation. All rights reserved.<BR>= ;+#
> > SPDX-
> > License-Identifier: BSD= -2-Clause-Patent+#++import os+import
> > glob+import
> > argparse++#+#&nb= sp;Globals for help information+#+__prog__ =3D<= /span>
> > 'GetPackagesPath.py'+__c= opyright__ =3D 'Copyright (c) 2020, Intel > Corporation.
> > All rights reserve= d.'+__description__ =3D 'Gets all recursive pa= ckage paths in
> > specified directory.\n'= ++def __get_packages_path(root):+    &= quot;"" Gets all
> > recursive package = paths in specified directory.+    &n= bsp;   A directory is a package > > path if it sa= tisfies conditions below:+      = ;  1. it is a directory+   = ;     2. it is not
> an
> > EDK II Package.&nb= sp;An EDK II Package (directory) is+ &nbs= p;         a directory&nb= sp;that
> > contains an EDK&nb= sp;II package declaration (DEC) file.+  &= nbsp;     3. it contains at le= ast
> > one first level&nb= sp;EDK II Package.+       =  Note: A directory is not package path&n= bsp;but
> > its subdirectory c= ould be.+        Example:&= nbsp;edk2-platforms/Features is not
> > package path+ =        but edk2-platforms/Features/= Intel is.++        :pa= ram root:
> > The specified dire= ctory to find package paths in it,+ =            the = caller should
> > ensure it is = an valid directory+       =  :type root: String+      =   :returns: Return all
> > recursive package = paths+        :rtype: Stri= ng list+    """++ =    paths =3D []+
> > contain_package =3D&nbs= p;False+    for filename in os.listd= ir(root):+        # skip&n= bsp;files
> > whose name starts&= nbsp;with ".", such as ".git"+&= nbsp;       if filename.startswith(= '.'):+
> > continue+  &nb= sp;     filepath =3D os.path.join(root,&= nbsp;filename)+        if
> > os.path.isdir(filepath):+= ;            if=  glob.glob(os.path.join(filepath, '*.dec')):+
> > # it is an&nb= sp;EDK II Package+       &= nbsp;        contain_package = =3D True+         &nb= sp;  else:+
> > # get package = ;paths for subdirectory if it is not pac= kage+           =      paths =3D
> > paths + __get_= packages_path(filepath)++    if contain_pa= ckage:+        # root
> is
> > a package path&nbs= p;because it contains EDK II Package+ &nb= sp;      # in first level = ;folder,
> > inset it to h= ead of list+        p= aths.insert(0, root)++    # return&nb= sp;package paths+
> > return paths++d= ef get_packages_path(directories):+    "&= quot;" For each direcory
> > in directories, ge= ts all recursive package paths+   &n= bsp;    in this directory and
> joins
> > them into one = ;string.++        :param&nb= sp;directories: the list of
> directory+   &nbs= p;    :type
> > directories: String&nbs= p;list+        :returns: R= eturn string of package
> paths+    &n= bsp;   :rtype:
> > String+   = ; """++    packages_path&nb= sp;=3D ''+    for directory in = directories:+
> > directory =3D os.p= ath.abspath(directory)+        = if (not os.path.exists(directory))
> > or (not os.path.is= dir(directory)):+         =    continue++      &nb= sp; if
> > glob.glob(os.path.join(direc= tory, '*.dec')):+        &= nbsp;   # it is an EDK II Pack= age+
> > continue++ &nbs= p;      paths =3D __get_packages_pa= th(directory)+        for = path in
> > paths:+   = ;         if packages_pat= h =3D=3D '':+        =         packages_path =3D = ;path+
> > else:+   =             &nb= sp;packages_path +=3D os.pathsep + path+&nb= sp;   return
> > packages_path++if&nb= sp;__name__ =3D=3D '__main__':+    # = ;Create command line
> > argument parser ob= ject+    parser =3D argparse.ArgumentPars= er(+
> > prog=3D__prog__,+ &= nbsp;          descriptio= n=3D__description__ + __copyright__,+
> > conflict_handler=3D'resolve'= +    )+    parser.add_argum= ent('directory',
> > nargs=3D'+',+ &= nbsp;          help=3D'Sp= ecified directory where package packages are = got
> > from')+   = ; args =3D parser.parse_args()+
> > print(get_packages_path(args= .directory))diff --git
> > a/Platform/Intel/Tools/Appen= dPackagesPath/Readme.md
> > b/Platform/Intel/Tools/Appen= dPackagesPath/Readme.md
> > new file mode = ;100644
> > index 0000000000..66aeb= ee7cf
> > --- /dev/null > > +++ b/Platf= orm/Intel/Tools/AppendPackagesPath/Readme.md
> > @@ -0,0 +1,28&= nbsp;@@
> > ++# How to=  use AppendPackagesPath++## Overview++This&n= bsp;script calls
> > GetPackagesPath.py to&n= bsp;collect all package paths under specified
> > directories and ap= pends them to PACKAGES_PATH environment variable.&= nbsp;A
> > sub directory is&n= bsp;a qualified package path when an EDKII&nb= sp;Package can be
> > found under it.= 3;+**Notice**:+The old PACKAGES_PATH will be&nb= sp;replaced by
> > new one.s++##&n= bsp;The usage of the tool++### Windows+= ;+Usage:
> > AppendPackagesPath.bat = directory [directory ...]+Copyright(c) 2020, Intel<= /span>
> > Corporation. All r= ights reserved.+Options:+  --help, -h &nbs= p;   Print this help
> screen
> > and exit++###&n= bsp;Ubuntu++Usage: source AppendPackagesPath.sh dire= ctory
> > [directory ...]+Cop= yright(c) 2020, Intel Corporation. All rights
> > reserved.+Options:+&= nbsp; --help, -h     Print this&nbs= p;help screen and exit+Please
> note:
> > This script must&n= bsp;be \'sourced\' so the environment can be&= nbsp;changed.+.
> > AppendPackagesPath.sh+so= urce AppendPackagesPath.sh--
> > 2.24.0.windows.2
> >

--_000_ED077930C258884BBCB450DB737E66225A023737shsmsx102ccrcor_--