Andrew:
  To be consisted with system PATH style in windows and linux, we choose to use 
: in windows, and : in linux. 

  For error handing, I agree to enhance BaseTools report the meaning warning if 
the path in PACKAGES_PATH doesn't exist. 

Thanks
Liming
> -----Original Message-----
> From: af...@apple.com [mailto:af...@apple.com]
> Sent: Tuesday, May 17, 2016 1:24 AM
> To: Gao, Liming <liming....@intel.com>
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] [BaseTools] Does PACKAGES_PATH support !include ?
> 
> 
> > On May 16, 2016, at 9:56 AM, Andrew Fish <af...@apple.com> wrote:
> >
> >>
> >> On May 16, 2016, at 6:55 AM, Andrew Fish <af...@apple.com> wrote:
> >>
> >>
> >>> On May 15, 2016, at 11:48 PM, Gao, Liming <liming....@intel.com>
> wrote:
> >>>
> >>> PACKAGES_PATH
> >>
> >> It seems to depend on sequence? I'm using master non Windows so
> running the Python directly. I just moved StdLib and MdeModulePkg
> >>
> >
> > Liming,
> >
> > I think I figured it out. I was using the wrong path separator. So I was 
> > failing
> if I had more than one entry in PACKAGES_PATH as that we being treated as
> a single filename.
> >
> > os.pathsep
> > The character conventionally used by the operating system to separate
> search path components (as in PATH), such as ':' for POSIX or ';'for Windows.
> Also available via os.path.
> >
> 
> Liming,
> 
> The more I think about this issue I don't understand the value in using an OS
> specific path separator? I don't think it is really solving any problem as 
> ':' and
> ';' are valid filenames on the Unix side. Having a different path path 
> separator
> makes it more complex to explain the usage of PACKAGES_PATH, so would it
> just be easier to standardize on `;` as the separator? I would rather trade
> ease of use for being pedantically correct.
> 
> Thanks,
> 
> Andrew Fish
> 
> > This was really hard to track down as there is NO error checking of
> PACKAGES_PATH. The build should throw and error if the PACKAGES_PATH
> entries don't exist. In my case the error would have shown that the file
> /Users/andrewfish/work/src/edk2/edk2;/Users/andrewfish/work/src/edk2/
> edk22 does not exist, and I would have probably figured out the separator
> issue. I think Windows has a lot more restrictions on what a filename can be,
> but Linux and Mac are very flexible, so maybe that is why extra error
> checking is needed?
> >
> >    ## convertPackagePath()
> >    #
> >    #   Convert path to match workspace.
> >    #
> >    #   @param  cls          The class pointer
> >    #   @param  Ws           The current WORKSPACE
> >    #   @param  Path         Path to be converted to match workspace.
> >    #
> >    @classmethod
> >    def convertPackagePath(cls, Ws, Path):
> >        if str(os.path.normcase (Path)).startswith(Ws):
> >            return os.path.join(Ws, os.path.relpath(Path, Ws))
> >        return Path
> >
> >    ## setWs()
> >    #
> >    #   set WORKSPACE and PACKAGES_PATH environment
> >    #
> >    #   @param  cls          The class pointer
> >    #   @param  Ws           initialize WORKSPACE variable
> >    #   @param  PackagesPath initialize PackagesPath variable
> >    #
> >    @classmethod
> >    def setWs(cls, Ws, PackagesPath=None):
> >        cls.WORKSPACE = Ws
> >        if PackagesPath:
> >            cls.PACKAGES_PATH = [cls.convertPackagePath (Ws,
> os.path.normpath(Path.strip())) for Path in PackagesPath.split(os.pathsep)]
> >        else:
> >            cls.PACKAGES_PATH = []
> >
> > Thanks,
> >
> > Andrew Fish
> >
> >
> >> ~/work/src/edk2/
> >> BaseTools
> >> Conf
> >> edk2/StdLib
> >> edk22/MdeModulePkg
> >> ....
> >>
> >> Added !include StdLib/StdLib.inc to
> edk22/MdeModulePkg/MdeModulePkg.dsc
> >>
> >> export WORKSPACE = "/Users/andrewfish/work/src/edk2"
> >> export PACKAGES_PATH="$WORKSPACE/edk2;$WORKSPACE/edk22"
> >>
> >> ~/work/src/edk2(master)>build -p
> edk22/MdeModulePkg/MdeModulePkg.dsc -a X64 -t XCODE5
> >>> build -p edk22/MdeModulePkg/MdeModulePkg.dsc -a X64 -t XCODE5
> >> Build environment: Darwin-15.3.0-x86_64-i386-64bit
> >> Build start time: 06:28:48, May.16 2016
> >>
> >> WORKSPACE        = /Users/andrewfish/work/src/edk2
> >> PACKAGES_PATH    =
> /Users/andrewfish/work/src/edk2/edk2;/Users/andrewfish/work/src/edk2/
> edk22
> >> ECP_SOURCE       =
> /Users/andrewfish/work/src/edk2/EdkCompatibilityPkg
> >> EDK_SOURCE       =
> /Users/andrewfish/work/src/edk2/EdkCompatibilityPkg
> >> EFI_SOURCE       = /Users/andrewfish/work/src/edk2/EdkCompatibilityPkg
> >> EDK_TOOLS_PATH   = /Users/andrewfish/work/src/edk2/BaseTools
> >> Validate: edk22/MdeModulePkg/MdeModulePkg.dsc |
> /Users/andrewfish/work/src/edk2 |
> edk22/MdeModulePkg/MdeModulePkg.dsc |
> /Users/andrewfish/work/src/edk2 |  |
> >> Validate: None | None | StdLib/StdLib.inc |
> /Users/andrewfish/work/src/edk2/edk22/MdeModulePkg |  |
> >> Validate: None | None | StdLib/StdLib.inc |
> /Users/andrewfish/work/src/edk2 |  |
> >>
> >>
> >> build.py...
> >>
> /Users/andrewfish/work/src/edk2/edk22/MdeModulePkg/MdeModulePkg.
> dsc(27): error 000E: File/directory not found in workspace
> >>    StdLib/StdLib.inc is not found in packages path:
> >>
>       /Users/andrewfish/work/src/edk2/edk2;/Users/andrewfish/work/sr
> c/edk2/edk22
> >> StdLib/StdLib.inc is not found in packages path:
> >>
>       /Users/andrewfish/work/src/edk2/edk2;/Users/andrewfish/work/sr
> c/edk2/edk22
> >>
> >>
> >> I added some debug prints to the Python:
> BaseTools/Source/Python/Common/Misc.py
> >>
> >>   def Validate(self, Type='', CaseSensitive=True):
> >>       if GlobalData.gCaseInsensitive:
> >>           CaseSensitive = False
> >>       if Type and Type.lower() != self.Type:
> >>           return FILE_TYPE_MISMATCH, '%s (expect %s but got %s)' %
> (self.File, Type, self.Type)
> >>
> >>       RealFile, RealRoot = RealPath2(self.File, self.Root, self.AlterRoot)
> >>       print "Validate:", RealFile, '|', RealRoot, '|',self.File, 
> >> '|',self.Root, '|',
> self.AlterRoot, '|'
> >>       if not RealRoot and not RealFile:
> >>           RealFile = self.File
> >>           if self.AlterRoot:
> >>               RealFile = os.path.join(self.AlterRoot, self.File)
> >>           elif self.Root:
> >>               RealFile = os.path.join(self.Root, self.File)
> >>           if len (mws.getPkgPath()) == 0:
> >>               return FILE_NOT_FOUND, os.path.join(self.AlterRoot, RealFile)
> >>           else:
> >>               return FILE_NOT_FOUND, "%s is not found in packages
> path:\n\t%s" % (self.File, '\n\t'.join(mws.getPkgPath()))
> >>
> >>
> >> Thanks,
> >>
> >> Andrew Fish
> >>
> >> PS I see there are some changes from today
> https://github.com/tianocore/edk2-BaseTools-win32
> >> I tried with that version too:
> >>> build -p edk22/MdeModulePkg/MdeModulePkg.dsc -a X64 -t XCODE5
> >> Build environment: Darwin-15.3.0-x86_64-i386-64bit
> >> Build start time: 06:50:53, May.16 2016
> >>
> >> WORKSPACE        = /Users/andrewfish/work/src/edk2
> >> PACKAGES_PATH    =
> /Users/andrewfish/work/src/edk2/edk2;/Users/andrewfish/work/src/edk2/
> edk22
> >> ECP_SOURCE       =
> /Users/andrewfish/work/src/edk2/EdkCompatibilityPkg
> >> EDK_SOURCE       =
> /Users/andrewfish/work/src/edk2/EdkCompatibilityPkg
> >> EFI_SOURCE       = /Users/andrewfish/work/src/edk2/EdkCompatibilityPkg
> >> EDK_TOOLS_PATH   = /Users/andrewfish/work/src/edk2/BaseTools
> >>
> >>
> >> build.py...
> >>
> /Users/andrewfish/work/src/edk2/edk22/MdeModulePkg/MdeModulePkg.
> dsc(27): error 000E: File/directory not found in workspace
> >>    StdLib/StdLib.inc is not found in packages path:
> >>
>       /Users/andrewfish/work/src/edk2/edk2;/Users/andrewfish/work/sr
> c/edk2/edk22
> >> StdLib/StdLib.inc is not found in packages path:
> >>
>       /Users/andrewfish/work/src/edk2/edk2;/Users/andrewfish/work/sr
> c/edk2/edk22
> >>
> >> - Failed -
> >> Build end time: 06:50:54, May.16 2016
> >> Build total time: 00:00:00
> >>
> >> ~/work/src/edk2(master)>find . -iname StdLib.inc
> >> ./edk2/StdLib/StdLib.inc
> >> ~/work/src/edk2(master)>pwd
> >> /Users/andrewfish/work/src/edk2
> >>
> >>
> >>
> >>
> >
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to