[edk2-devel] [Patch] BaseTools: Remove the file timestamp checking during parsing

Bob Feng posted 1 patch 3 years, 9 months ago
Failed in applying to current master (apply log)
.../Source/Python/Workspace/MetaFileTable.py     | 12 ++----------
.../Source/Python/Workspace/WorkspaceDatabase.py | 16 ----------------
2 files changed, 2 insertions(+), 26 deletions(-)
[edk2-devel] [Patch] BaseTools: Remove the file timestamp checking during parsing
Posted by Bob Feng 3 years, 9 months ago
During build, the meta files are not changed, so it's no need
to check file timestamp.

This patch is to remove useless logic.

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 .../Source/Python/Workspace/MetaFileTable.py     | 12 ++----------
 .../Source/Python/Workspace/WorkspaceDatabase.py | 16 ----------------
 2 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileTable.py b/BaseTools/Source/Python/Workspace/MetaFileTable.py
index 0555c91ccc..20cb80e36e 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileTable.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileTable.py
@@ -44,29 +44,21 @@ class MetaFileTable():
             self.TableName = "_%s_%s_%s" % (FileType, len(DB.TblFile), uuid.uuid4().hex)
         else:
             self.TableName = "_%s_%s" % (FileType, len(DB.TblFile))
 
     def IsIntegrity(self):
+        Result = False
         try:
             TimeStamp = self.MetaFile.TimeStamp
             if not self.CurrentContent:
                 Result = False
             else:
                 Result = self.CurrentContent[-1][0] < 0
-            if not Result:
-                # update the timestamp in database
-                self.DB.SetFileTimeStamp(self.FileId, TimeStamp)
-                return False
-
-            if TimeStamp != self.DB.GetFileTimeStamp(self.FileId):
-                # update the timestamp in database
-                self.DB.SetFileTimeStamp(self.FileId, TimeStamp)
-                return False
         except Exception as Exc:
             EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc))
             return False
-        return True
+        return Result
 
     def SetEndFlag(self):
         self.CurrentContent.append(self._DUMMY_)
 
     def GetAll(self):
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index 9420eaa608..d955c78b25 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -156,16 +156,10 @@ class WorkspaceDatabase(object):
 
         # conversion object for build or file format conversion purpose
         self.BuildObject = WorkspaceDatabase.BuildObjectFactory(self)
         self.TransformObject = WorkspaceDatabase.TransformObjectFactory(self)
 
-    def SetFileTimeStamp(self,FileId,TimeStamp):
-        self.TblFile[FileId-1][6] = TimeStamp
-
-    def GetFileTimeStamp(self,FileId):
-        return self.TblFile[FileId-1][6]
-
 
     ## Summarize all packages in the database
     def GetPackageList(self, Platform, Arch, TargetName, ToolChainTag):
         self.Platform = Platform
         PackageList = []
@@ -191,20 +185,10 @@ class WorkspaceDatabase(object):
                 continue
             PackageList.append(Package)
 
         return PackageList
 
-    ## Summarize all platforms in the database
-    def PlatformList(self):
-        RetVal = []
-        for PlatformFile in [item[3] for item in self.TblFile if item[5] == MODEL_FILE_DSC]:
-            try:
-                RetVal.append(self.BuildObject[PathClass(PlatformFile), TAB_COMMON])
-            except:
-                pass
-        return RetVal
-
     def MapPlatform(self, Dscfile):
         Platform = self.BuildObject[PathClass(Dscfile), TAB_COMMON]
         if Platform is None:
             EdkLogger.error('build', PARSER_ERROR, "Failed to parser DSC file: %s" % Dscfile)
         return Platform
-- 
2.20.1.windows.1


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

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

Re: [edk2-devel] [Patch] BaseTools: Remove the file timestamp checking during parsing
Posted by Liming Gao 3 years, 9 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Feng, Bob C <bob.c.feng@intel.com>
> Sent: Thursday, July 16, 2020 7:22 PM
> To: devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: [Patch] BaseTools: Remove the file timestamp checking during parsing
> 
> During build, the meta files are not changed, so it's no need
> to check file timestamp.
> 
> This patch is to remove useless logic.
> 
> Signed-off-by: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> ---
>  .../Source/Python/Workspace/MetaFileTable.py     | 12 ++----------
>  .../Source/Python/Workspace/WorkspaceDatabase.py | 16 ----------------
>  2 files changed, 2 insertions(+), 26 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Workspace/MetaFileTable.py b/BaseTools/Source/Python/Workspace/MetaFileTable.py
> index 0555c91ccc..20cb80e36e 100644
> --- a/BaseTools/Source/Python/Workspace/MetaFileTable.py
> +++ b/BaseTools/Source/Python/Workspace/MetaFileTable.py
> @@ -44,29 +44,21 @@ class MetaFileTable():
>              self.TableName = "_%s_%s_%s" % (FileType, len(DB.TblFile), uuid.uuid4().hex)
>          else:
>              self.TableName = "_%s_%s" % (FileType, len(DB.TblFile))
> 
>      def IsIntegrity(self):
> +        Result = False
>          try:
>              TimeStamp = self.MetaFile.TimeStamp
>              if not self.CurrentContent:
>                  Result = False
>              else:
>                  Result = self.CurrentContent[-1][0] < 0
> -            if not Result:
> -                # update the timestamp in database
> -                self.DB.SetFileTimeStamp(self.FileId, TimeStamp)
> -                return False
> -
> -            if TimeStamp != self.DB.GetFileTimeStamp(self.FileId):
> -                # update the timestamp in database
> -                self.DB.SetFileTimeStamp(self.FileId, TimeStamp)
> -                return False
>          except Exception as Exc:
>              EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc))
>              return False
> -        return True
> +        return Result
> 
>      def SetEndFlag(self):
>          self.CurrentContent.append(self._DUMMY_)
> 
>      def GetAll(self):
> diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
> b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
> index 9420eaa608..d955c78b25 100644
> --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
> +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
> @@ -156,16 +156,10 @@ class WorkspaceDatabase(object):
> 
>          # conversion object for build or file format conversion purpose
>          self.BuildObject = WorkspaceDatabase.BuildObjectFactory(self)
>          self.TransformObject = WorkspaceDatabase.TransformObjectFactory(self)
> 
> -    def SetFileTimeStamp(self,FileId,TimeStamp):
> -        self.TblFile[FileId-1][6] = TimeStamp
> -
> -    def GetFileTimeStamp(self,FileId):
> -        return self.TblFile[FileId-1][6]
> -
> 
>      ## Summarize all packages in the database
>      def GetPackageList(self, Platform, Arch, TargetName, ToolChainTag):
>          self.Platform = Platform
>          PackageList = []
> @@ -191,20 +185,10 @@ class WorkspaceDatabase(object):
>                  continue
>              PackageList.append(Package)
> 
>          return PackageList
> 
> -    ## Summarize all platforms in the database
> -    def PlatformList(self):
> -        RetVal = []
> -        for PlatformFile in [item[3] for item in self.TblFile if item[5] == MODEL_FILE_DSC]:
> -            try:
> -                RetVal.append(self.BuildObject[PathClass(PlatformFile), TAB_COMMON])
> -            except:
> -                pass
> -        return RetVal
> -
>      def MapPlatform(self, Dscfile):
>          Platform = self.BuildObject[PathClass(Dscfile), TAB_COMMON]
>          if Platform is None:
>              EdkLogger.error('build', PARSER_ERROR, "Failed to parser DSC file: %s" % Dscfile)
>          return Platform
> --
> 2.20.1.windows.1


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

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