[edk2] [Patch] BaseTools: Fix the bug to search Fv.txt file relative to workspace

Yonghong Zhu posted 1 patch 6 years, 9 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/build/BuildReport.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
[edk2] [Patch] BaseTools: Fix the bug to search Fv.txt file relative to workspace
Posted by Yonghong Zhu 6 years, 9 months ago
when the SECTION FV_IMAGE = $(XX)/XX.Fv, the Fv file should relative to
WORKSPACE, so when we search the XX.Fv.txt file, we should search the
path relative to workspace first.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/build/BuildReport.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index b2cc6ee..2fb6ad0 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -1621,10 +1621,11 @@ class FdRegionReport(object):
         self.Size = FdRegion.Size
         self.FvList = []
         self.FvInfo = {}
         self._GuidsDb = {}
         self._FvDir = Wa.FvDir
+        self._WorkspaceDir = Wa.WorkspaceDir
 
         #
         # If the input FdRegion is not a firmware volume,
         # we are done.
         #
@@ -1724,17 +1725,19 @@ class FdRegionReport(object):
 
         if self.Type == "FV":
             FvTotalSize = 0
             FvTakenSize = 0
             FvFreeSize  = 0
-            if not os.path.isfile(FvName):
-                FvReportFileName = os.path.join(self._FvDir, FvName + ".Fv.txt")
+            if FvName.upper().endswith('.FV'):
+                FileExt = FvName + ".txt"
             else:
-                if FvName.upper().endswith('.FV'):
-                    FvReportFileName = FvName + ".txt"
-                else:
-                    FvReportFileName = FvName + ".Fv.txt"
+                FileExt = FvName + ".Fv.txt"
+
+            if not os.path.isfile(FileExt):
+                FvReportFileName = mws.join(self._WorkspaceDir, FileExt)
+                if not os.path.isfile(FvReportFileName):
+                    FvReportFileName = os.path.join(self._FvDir, FileExt)
             try:
                 #
                 # Collect size info in the firmware volume.
                 #
                 FvReport = open(FvReportFileName).read()
-- 
2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] BaseTools: Fix the bug to search Fv.txt file relative to workspace
Posted by Gao, Liming 6 years, 9 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yonghong Zhu
> Sent: Saturday, March 3, 2018 1:09 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch] BaseTools: Fix the bug to search Fv.txt file relative to workspace
> 
> when the SECTION FV_IMAGE = $(XX)/XX.Fv, the Fv file should relative to
> WORKSPACE, so when we search the XX.Fv.txt file, we should search the
> path relative to workspace first.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
> ---
>  BaseTools/Source/Python/build/BuildReport.py | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
> index b2cc6ee..2fb6ad0 100644
> --- a/BaseTools/Source/Python/build/BuildReport.py
> +++ b/BaseTools/Source/Python/build/BuildReport.py
> @@ -1621,10 +1621,11 @@ class FdRegionReport(object):
>          self.Size = FdRegion.Size
>          self.FvList = []
>          self.FvInfo = {}
>          self._GuidsDb = {}
>          self._FvDir = Wa.FvDir
> +        self._WorkspaceDir = Wa.WorkspaceDir
> 
>          #
>          # If the input FdRegion is not a firmware volume,
>          # we are done.
>          #
> @@ -1724,17 +1725,19 @@ class FdRegionReport(object):
> 
>          if self.Type == "FV":
>              FvTotalSize = 0
>              FvTakenSize = 0
>              FvFreeSize  = 0
> -            if not os.path.isfile(FvName):
> -                FvReportFileName = os.path.join(self._FvDir, FvName + ".Fv.txt")
> +            if FvName.upper().endswith('.FV'):
> +                FileExt = FvName + ".txt"
>              else:
> -                if FvName.upper().endswith('.FV'):
> -                    FvReportFileName = FvName + ".txt"
> -                else:
> -                    FvReportFileName = FvName + ".Fv.txt"
> +                FileExt = FvName + ".Fv.txt"
> +
> +            if not os.path.isfile(FileExt):
> +                FvReportFileName = mws.join(self._WorkspaceDir, FileExt)
> +                if not os.path.isfile(FvReportFileName):
> +                    FvReportFileName = os.path.join(self._FvDir, FileExt)
>              try:
>                  #
>                  # Collect size info in the firmware volume.
>                  #
>                  FvReport = open(FvReportFileName).read()
> --
> 2.6.1.windows.1
> 
> _______________________________________________
> 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