Added conditional statement support for DSC file
[people/mcb30/basetools.git] / Source / Python / Workspace / WorkspaceDatabase.py
index 82778cf..fe75e52 100644 (file)
@@ -1295,7 +1295,7 @@ class InfBuildData(ModuleBuildClassObject):
         # \r
         # R8.x modules\r
         # \r
-        if self._AutoGenVersion < 0x00010005:\r
+        if self._AutoGenVersion < 0x00010005:   # _AutoGenVersion may be None, which is less than anything\r
             if self._ComponentType in self._MODULE_TYPE_:\r
                 self._ModuleType = self._MODULE_TYPE_[self._ComponentType]\r
             if self._ComponentType == 'LIBRARY':\r
@@ -1853,6 +1853,9 @@ class WorkspaceDatabase(object):
     def GetTimeStamp(self, FileId):\r
         return self.TblFile.GetFileTimeStamp(FileId)\r
 \r
+    def SetTimeStamp(self, FileId, TimeStamp):\r
+        return self.TblFile.SetFileTimeStamp(FileId, TimeStamp)\r
+\r
     def CheckIntegrity(self, TableName):\r
         Result = self.Cur.execute("select min(ID) from %s" % (TableName)).fetchall()\r
         if Result[0][0] != -1:\r
@@ -1868,10 +1871,12 @@ class WorkspaceDatabase(object):
     def __setitem__(self, FilePath, FileType):\r
         FileId = self.GetFileId(FilePath)\r
         if FileId != None:\r
+            TimeStamp = os.stat(FilePath)[8]\r
             TableName = self.GetTableName(FileType, FileId)\r
-            if self.CheckIntegrity(TableName):\r
-                TimeStamp = os.stat(FilePath)[8]\r
-                if TimeStamp == self.GetTimeStamp(FileId):\r
+            if TimeStamp != self.GetTimeStamp(FileId):\r
+                self.SetTimeStamp(FileId, TimeStamp)\r
+            else:\r
+                if self.CheckIntegrity(TableName) == True:\r
                     return\r
         else:\r
             FileId = self.TblFile.InsertFile(FilePath, FileType)\r