[edk2-devel] [PATCH V2] BaseTools:GuidedSectionTools.txt is not generated correctly

Fan, ZhijuX posted 1 patch 4 years, 1 month ago
Failed in applying to current master (apply log)
There is a newer version of this series
BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 4 +++-
BaseTools/Source/Python/build/build.py             | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
[edk2-devel] [PATCH V2] BaseTools:GuidedSectionTools.txt is not generated correctly
Posted by Fan, ZhijuX 4 years, 1 month ago
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2538

For LzmaCompress or BrotliCompress, the platform may use the different
options and add their batch file, such as LzmaCompressPlatform.
Then, specify it in platform.dsc [BuildOptions] to override the default
one in tools_def.txt.

*_*_*_LZMA_PATH = LzmaCompressPlatform

This override tool will be used. But, its name is not specified in the
generated GuidedSectionTools.txt.

Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
---
Changed an issue with an incorrect full path in GuidedSectionTools

 BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 4 +++-
 BaseTools/Source/Python/build/build.py             | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
index d32178b00c93..478a5116fd7a 100644
--- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
@@ -866,7 +866,9 @@ class PlatformAutoGen(AutoGen):
                             Value += " " + self._BuildOptionWithToolDef(RetVal)[Tool][Attr]
                         else:
                             Value = self._BuildOptionWithToolDef(RetVal)[Tool][Attr]
-
+                            Def = '_'.join([self.BuildTarget, self.ToolChain, self.Arch, Tool, Attr])
+                            if self.Workspace.ToolDef.ToolsDefTxtDictionary.get(Def):
+                                self.Workspace.ToolDef.ToolsDefTxtDictionary[Def] = Value
                 if Attr == "PATH":
                     # Don't put MAKE definition in the file
                     if Tool != "MAKE":
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index d841fefdc502..01c4c6fe2b84 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -2367,7 +2367,8 @@ class Build():
             # PATH environment variable.
             for dirInPath in os.environ['PATH'].split(os.pathsep):
                 foundPath = os.path.join(dirInPath, tool)
-                if os.path.exists(foundPath):
+                BaseName, Ext = os.path.splitext(foundPath)
+                if os.path.isdir(foundPath) or Ext:
                     return os.path.realpath(foundPath)
 
         # If the tool was not found in the path then we just return
-- 
2.14.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#55571): https://edk2.groups.io/g/devel/message/55571
Mute This Topic: https://groups.io/mt/71766931/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH V2] BaseTools:GuidedSectionTools.txt is not generated correctly
Posted by Bob Feng 4 years, 1 month ago
Zhiju,

+                BaseName, Ext = os.path.splitext(foundPath)
+                if os.path.isdir(foundPath) or Ext:

Did you check the tool behavior under Linux? The file under Linux can have no extension file name.

Thanks,
Bob

-----Original Message-----
From: Fan, ZhijuX 
Sent: Friday, March 6, 2020 1:31 PM
To: devel@edk2.groups.io
Cc: Fan, ZhijuX <zhijux.fan@intel.com>; Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
Subject: [PATCH V2] BaseTools:GuidedSectionTools.txt is not generated correctly

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2538

For LzmaCompress or BrotliCompress, the platform may use the different options and add their batch file, such as LzmaCompressPlatform.
Then, specify it in platform.dsc [BuildOptions] to override the default one in tools_def.txt.

*_*_*_LZMA_PATH = LzmaCompressPlatform

This override tool will be used. But, its name is not specified in the generated GuidedSectionTools.txt.

Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
---
Changed an issue with an incorrect full path in GuidedSectionTools

 BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 4 +++-
 BaseTools/Source/Python/build/build.py             | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
index d32178b00c93..478a5116fd7a 100644
--- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
@@ -866,7 +866,9 @@ class PlatformAutoGen(AutoGen):
                             Value += " " + self._BuildOptionWithToolDef(RetVal)[Tool][Attr]
                         else:
                             Value = self._BuildOptionWithToolDef(RetVal)[Tool][Attr]
-
+                            Def = '_'.join([self.BuildTarget, self.ToolChain, self.Arch, Tool, Attr])
+                            if self.Workspace.ToolDef.ToolsDefTxtDictionary.get(Def):
+                                
+ self.Workspace.ToolDef.ToolsDefTxtDictionary[Def] = Value
                 if Attr == "PATH":
                     # Don't put MAKE definition in the file
                     if Tool != "MAKE":
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index d841fefdc502..01c4c6fe2b84 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -2367,7 +2367,8 @@ class Build():
             # PATH environment variable.
             for dirInPath in os.environ['PATH'].split(os.pathsep):
                 foundPath = os.path.join(dirInPath, tool)
-                if os.path.exists(foundPath):
+                BaseName, Ext = os.path.splitext(foundPath)
+                if os.path.isdir(foundPath) or Ext:
                     return os.path.realpath(foundPath)
 
         # If the tool was not found in the path then we just return
--
2.14.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#55672): https://edk2.groups.io/g/devel/message/55672
Mute This Topic: https://groups.io/mt/71766931/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH V2] BaseTools:GuidedSectionTools.txt is not generated correctly
Posted by Liming Gao 4 years, 1 month ago
Zhiju:
  I expect the output tool name is same to the one specified in tools_def.txt or [BuildOptions] in platform.dsc file. 

Thanks
Liming
> -----Original Message-----
> From: Feng, Bob C <bob.c.feng@intel.com>
> Sent: Monday, March 9, 2020 1:54 PM
> To: Fan, ZhijuX <zhijux.fan@intel.com>; devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: RE: [PATCH V2] BaseTools:GuidedSectionTools.txt is not generated correctly
> 
> Zhiju,
> 
> +                BaseName, Ext = os.path.splitext(foundPath)
> +                if os.path.isdir(foundPath) or Ext:
> 
> Did you check the tool behavior under Linux? The file under Linux can have no extension file name.
> 
> Thanks,
> Bob
> 
> -----Original Message-----
> From: Fan, ZhijuX
> Sent: Friday, March 6, 2020 1:31 PM
> To: devel@edk2.groups.io
> Cc: Fan, ZhijuX <zhijux.fan@intel.com>; Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
> Subject: [PATCH V2] BaseTools:GuidedSectionTools.txt is not generated correctly
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2538
> 
> For LzmaCompress or BrotliCompress, the platform may use the different options and add their batch file, such as
> LzmaCompressPlatform.
> Then, specify it in platform.dsc [BuildOptions] to override the default one in tools_def.txt.
> 
> *_*_*_LZMA_PATH = LzmaCompressPlatform
> 
> This override tool will be used. But, its name is not specified in the generated GuidedSectionTools.txt.
> 
> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Bob Feng <bob.c.feng@intel.com>
> ---
> Changed an issue with an incorrect full path in GuidedSectionTools
> 
>  BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 4 +++-
>  BaseTools/Source/Python/build/build.py             | 3 ++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> index d32178b00c93..478a5116fd7a 100644
> --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> @@ -866,7 +866,9 @@ class PlatformAutoGen(AutoGen):
>                              Value += " " + self._BuildOptionWithToolDef(RetVal)[Tool][Attr]
>                          else:
>                              Value = self._BuildOptionWithToolDef(RetVal)[Tool][Attr]
> -
> +                            Def = '_'.join([self.BuildTarget, self.ToolChain, self.Arch, Tool, Attr])
> +                            if self.Workspace.ToolDef.ToolsDefTxtDictionary.get(Def):
> +
> + self.Workspace.ToolDef.ToolsDefTxtDictionary[Def] = Value
>                  if Attr == "PATH":
>                      # Don't put MAKE definition in the file
>                      if Tool != "MAKE":
> diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
> index d841fefdc502..01c4c6fe2b84 100755
> --- a/BaseTools/Source/Python/build/build.py
> +++ b/BaseTools/Source/Python/build/build.py
> @@ -2367,7 +2367,8 @@ class Build():
>              # PATH environment variable.
>              for dirInPath in os.environ['PATH'].split(os.pathsep):
>                  foundPath = os.path.join(dirInPath, tool)
> -                if os.path.exists(foundPath):
> +                BaseName, Ext = os.path.splitext(foundPath)
> +                if os.path.isdir(foundPath) or Ext:
>                      return os.path.realpath(foundPath)
> 
>          # If the tool was not found in the path then we just return
> --
> 2.14.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#55740): https://edk2.groups.io/g/devel/message/55740
Mute This Topic: https://groups.io/mt/71766931/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-