]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Core/IpiDb.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Core / IpiDb.py
index 3bce33748198362f36abe08f833e017bac8a770b..a781d358c86c0d742978ef6ee92366c0e791bc51 100644 (file)
@@ -1,11 +1,11 @@
 ## @file\r
 # This file is for installed package information database operations\r
 #\r
-# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #\r
-# This program and the accompanying materials are licensed and made available \r
-# under the terms and conditions of the BSD License which accompanies this \r
-# distribution. The full text of the license may be found at \r
+# This program and the accompanying materials are licensed and made available\r
+# under the terms and conditions of the BSD License which accompanies this\r
+# distribution. The full text of the license may be found at\r
 # http://opensource.org/licenses/bsd-license.php\r
 #\r
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
@@ -33,8 +33,8 @@ import platform as pf
 #\r
 # This class represents the installed package information database\r
 # Add/Remove/Get installed distribution package information here.\r
-# \r
-# \r
+#\r
+#\r
 # @param object:      Inherited from object class\r
 # @param DbPath:      A string for the path of the database\r
 #\r
@@ -71,16 +71,16 @@ class IpiDatabase(object):
                 SqlCommand = """\r
                 create table %s (\r
                 Dummy TEXT NOT NULL,\r
-                PRIMARY KEY (Dummy)                                               \r
+                PRIMARY KEY (Dummy)\r
                 )""" % self.DummyTable\r
                 self.Cur.execute(SqlCommand)\r
                 self.Conn.commit()\r
             except sqlite3.OperationalError:\r
-                Logger.Error("UPT", \r
-                             UPT_ALREADY_RUNNING_ERROR, \r
+                Logger.Error("UPT",\r
+                             UPT_ALREADY_RUNNING_ERROR,\r
                              ST.ERR_UPT_ALREADY_RUNNING_ERROR\r
                              )\r
-        \r
+\r
         #\r
         # Create new table\r
         #\r
@@ -89,12 +89,12 @@ class IpiDatabase(object):
         DpGuid TEXT NOT NULL,DpVersion TEXT NOT NULL,\r
         InstallTime REAL NOT NULL,\r
         NewPkgFileName TEXT NOT NULL,\r
-        PkgFileName TEXT NOT NULL,                                               \r
+        PkgFileName TEXT NOT NULL,\r
         RePackage TEXT NOT NULL,\r
-        PRIMARY KEY (DpGuid, DpVersion)                                               \r
+        PRIMARY KEY (DpGuid, DpVersion)\r
         )""" % self.DpTable\r
         self.Cur.execute(SqlCommand)\r
-        \r
+\r
         SqlCommand = """\r
         create table IF NOT EXISTS %s (\r
         FilePath TEXT NOT NULL,\r
@@ -104,7 +104,7 @@ class IpiDatabase(object):
         PRIMARY KEY (FilePath)\r
         )""" % self.DpFileListTable\r
         self.Cur.execute(SqlCommand)\r
-        \r
+\r
         SqlCommand = """\r
         create table IF NOT EXISTS %s (\r
         PackageGuid TEXT NOT NULL,\r
@@ -116,7 +116,7 @@ class IpiDatabase(object):
         PRIMARY KEY (PackageGuid, PackageVersion, InstallPath)\r
         )""" % self.PkgTable\r
         self.Cur.execute(SqlCommand)\r
-                \r
+\r
         SqlCommand = """\r
         create table IF NOT EXISTS %s (\r
         ModuleGuid TEXT NOT NULL,\r
@@ -129,7 +129,7 @@ class IpiDatabase(object):
         PRIMARY KEY (ModuleGuid, ModuleVersion, ModuleName, InstallPath)\r
         )""" % self.ModInPkgTable\r
         self.Cur.execute(SqlCommand)\r
-        \r
+\r
         SqlCommand = """\r
         create table IF NOT EXISTS %s (\r
         ModuleGuid TEXT NOT NULL,\r
@@ -142,7 +142,7 @@ class IpiDatabase(object):
         PRIMARY KEY (ModuleGuid, ModuleVersion, ModuleName, InstallPath)\r
         )""" % self.StandaloneModTable\r
         self.Cur.execute(SqlCommand)\r
-        \r
+\r
         SqlCommand = """\r
         create table IF NOT EXISTS %s (\r
         ModuleGuid TEXT NOT NULL,\r
@@ -153,9 +153,9 @@ class IpiDatabase(object):
         DepexVersion TEXT\r
         )""" % self.ModDepexTable\r
         self.Cur.execute(SqlCommand)\r
-        \r
+\r
         self.Conn.commit()\r
-        \r
+\r
         Logger.Verbose(ST.MSG_INIT_IPI_FINISH)\r
 \r
     def RollBack(self):\r
@@ -199,7 +199,7 @@ class IpiDatabase(object):
                     self._AddDpFilePathList(DpObj.Header.GetGuid(), \\r
                                             DpObj.Header.GetVersion(), FilePath, \\r
                                             Md5Sum)\r
-    \r
+\r
             for ModKey in DpObj.ModuleSurfaceArea.keys():\r
                 ModGuid = ModKey[0]\r
                 ModVersion = ModKey[1]\r
@@ -219,17 +219,17 @@ class IpiDatabase(object):
                     self._AddDpFilePathList(DpObj.Header.GetGuid(), \\r
                                             DpObj.Header.GetVersion(), \\r
                                             Path, Md5Sum)\r
-    \r
+\r
             #\r
             # add tool/misc files\r
             #\r
             for (Path, Md5Sum) in DpObj.FileList:\r
                 self._AddDpFilePathList(DpObj.Header.GetGuid(), \\r
                                         DpObj.Header.GetVersion(), Path, Md5Sum)\r
-                                    \r
+\r
             self._AddDp(DpObj.Header.GetGuid(), DpObj.Header.GetVersion(), \\r
                         NewDpPkgFileName, DpPkgFileName, RePackage)\r
-    \r
+\r
         except sqlite3.IntegrityError as DetailMsg:\r
             Logger.Error("UPT",\r
                          UPT_DB_UPDATE_ERROR,\r
@@ -239,17 +239,17 @@ class IpiDatabase(object):
 \r
     ## Add a distribution install information\r
     #\r
-    # @param Guid         Guid of the distribution package  \r
-    # @param Version      Version of the distribution package  \r
+    # @param Guid         Guid of the distribution package\r
+    # @param Version      Version of the distribution package\r
     # @param NewDpFileName the saved filename of distribution package file\r
     # @param DistributionFileName the filename of distribution package file\r
     #\r
     def _AddDp(self, Guid, Version, NewDpFileName, DistributionFileName, \\r
                RePackage):\r
-        \r
+\r
         if Version is None or len(Version.strip()) == 0:\r
             Version = 'N/A'\r
-        \r
+\r
         #\r
         # Add newly installed DP information to DB.\r
         #\r
@@ -264,10 +264,10 @@ class IpiDatabase(object):
          DistributionFileName, str(RePackage).upper())\r
         self.Cur.execute(SqlCommand)\r
 \r
-        \r
+\r
     ## Add a file list from DP\r
     #\r
-    # @param DpGuid: A DpGuid \r
+    # @param DpGuid: A DpGuid\r
     # @param DpVersion: A DpVersion\r
     # @param Path: A Path\r
     # @param Path: A Md5Sum\r
@@ -284,26 +284,26 @@ class IpiDatabase(object):
         (self.DpFileListTable, Path, DpGuid, DpVersion, Md5Sum)\r
 \r
         self.Cur.execute(SqlCommand)\r
-            \r
+\r
     ## Add a package install information\r
     #\r
-    # @param Guid: A package guid \r
+    # @param Guid: A package guid\r
     # @param Version: A package version\r
-    # @param DpGuid: A DpGuid \r
+    # @param DpGuid: A DpGuid\r
     # @param DpVersion: A DpVersion\r
     # @param Path: A Path\r
     #\r
     def _AddPackage(self, Guid, Version, DpGuid=None, DpVersion=None, Path=''):\r
-        \r
+\r
         if Version is None or len(Version.strip()) == 0:\r
             Version = 'N/A'\r
-        \r
+\r
         if DpGuid is None or len(DpGuid.strip()) == 0:\r
             DpGuid = 'N/A'\r
-        \r
+\r
         if DpVersion is None or len(DpVersion.strip()) == 0:\r
             DpVersion = 'N/A'\r
-        \r
+\r
         #\r
         # Add newly installed package information to DB.\r
         #\r
@@ -312,10 +312,10 @@ class IpiDatabase(object):
         """insert into %s values('%s', '%s', %s, '%s', '%s', '%s')""" % \\r
         (self.PkgTable, Guid, Version, CurrentTime, DpGuid, DpVersion, Path)\r
         self.Cur.execute(SqlCommand)\r
-        \r
+\r
     ## Add a module that from a package install information\r
     #\r
-    # @param Guid:    Module Guid \r
+    # @param Guid:    Module Guid\r
     # @param Version: Module version\r
     # @param Name:    Module Name\r
     # @param PkgGuid: Package Guid\r
@@ -324,21 +324,21 @@ class IpiDatabase(object):
     #\r
     def _AddModuleInPackage(self, Guid, Version, Name, PkgGuid=None, \\r
                             PkgVersion=None, Path=''):\r
-        \r
+\r
         if Version is None or len(Version.strip()) == 0:\r
             Version = 'N/A'\r
-        \r
+\r
         if PkgGuid is None or len(PkgGuid.strip()) == 0:\r
             PkgGuid = 'N/A'\r
-        \r
+\r
         if PkgVersion is None or len(PkgVersion.strip()) == 0:\r
             PkgVersion = 'N/A'\r
-            \r
+\r
         if os.name == 'posix':\r
             Path = Path.replace('\\', os.sep)\r
         else:\r
             Path = Path.replace('/', os.sep)\r
-        \r
+\r
         #\r
         # Add module from package information to DB.\r
         #\r
@@ -348,7 +348,7 @@ class IpiDatabase(object):
         (self.ModInPkgTable, Guid, Version, Name, CurrentTime, PkgGuid, PkgVersion, \\r
          Path)\r
         self.Cur.execute(SqlCommand)\r
-    \r
+\r
     ## Add a module that is standalone install information\r
     #\r
     # @param Guid: a module Guid\r
@@ -360,16 +360,16 @@ class IpiDatabase(object):
     #\r
     def _AddStandaloneModule(self, Guid, Version, Name, DpGuid=None, \\r
                              DpVersion=None, Path=''):\r
-        \r
+\r
         if Version is None or len(Version.strip()) == 0:\r
             Version = 'N/A'\r
-        \r
+\r
         if DpGuid is None or len(DpGuid.strip()) == 0:\r
             DpGuid = 'N/A'\r
-        \r
+\r
         if DpVersion is None or len(DpVersion.strip()) == 0:\r
             DpVersion = 'N/A'\r
-        \r
+\r
         #\r
         # Add module standalone information to DB.\r
         #\r
@@ -379,7 +379,7 @@ class IpiDatabase(object):
         (self.StandaloneModTable, Guid, Version, Name, CurrentTime, DpGuid, \\r
          DpVersion, Path)\r
         self.Cur.execute(SqlCommand)\r
-    \r
+\r
     ## Add a module depex\r
     #\r
     # @param Guid: a module Guid\r
@@ -390,49 +390,49 @@ class IpiDatabase(object):
     #\r
     def _AddModuleDepex(self, Guid, Version, Name, Path, DepexGuid=None, \\r
                         DepexVersion=None):\r
-                \r
+\r
         if DepexGuid is None or len(DepexGuid.strip()) == 0:\r
             DepexGuid = 'N/A'\r
-        \r
+\r
         if DepexVersion is None or len(DepexVersion.strip()) == 0:\r
             DepexVersion = 'N/A'\r
-            \r
+\r
         if os.name == 'posix':\r
             Path = Path.replace('\\', os.sep)\r
         else:\r
             Path = Path.replace('/', os.sep)\r
-        \r
+\r
         #\r
         # Add module depex information to DB.\r
         #\r
         SqlCommand = """insert into %s values('%s', '%s', '%s', '%s', '%s', '%s')"""\\r
          % (self.ModDepexTable, Guid, Version, Name, Path, DepexGuid, DepexVersion)\r
         self.Cur.execute(SqlCommand)\r
-        \r
-    ## Remove a distribution install information, if no version specified, \r
+\r
+    ## Remove a distribution install information, if no version specified,\r
     # remove all DPs with this Guid.\r
     #\r
-    # @param DpGuid: guid of dpex \r
+    # @param DpGuid: guid of dpex\r
     # @param DpVersion: version of dpex\r
     #\r
     def RemoveDpObj(self, DpGuid, DpVersion):\r
-        \r
+\r
         PkgList = self.GetPackageListFromDp(DpGuid, DpVersion)\r
         #\r
         # delete from ModDepex the standalone module's dependency\r
         #\r
         SqlCommand = \\r
-        """delete from ModDepexInfo where ModDepexInfo.ModuleGuid in \r
-        (select ModuleGuid from StandaloneModInfo as B where B.DpGuid = '%s' \r
+        """delete from ModDepexInfo where ModDepexInfo.ModuleGuid in\r
+        (select ModuleGuid from StandaloneModInfo as B where B.DpGuid = '%s'\r
         and B.DpVersion = '%s')\r
         and ModDepexInfo.ModuleVersion in\r
-        (select ModuleVersion from StandaloneModInfo as B \r
+        (select ModuleVersion from StandaloneModInfo as B\r
         where B.DpGuid = '%s' and B.DpVersion = '%s')\r
         and ModDepexInfo.ModuleName in\r
-        (select ModuleName from StandaloneModInfo as B \r
+        (select ModuleName from StandaloneModInfo as B\r
         where B.DpGuid = '%s' and B.DpVersion = '%s')\r
         and ModDepexInfo.InstallPath in\r
-        (select InstallPath from StandaloneModInfo as B \r
+        (select InstallPath from StandaloneModInfo as B\r
         where B.DpGuid = '%s' and B.DpVersion = '%s') """ % \\r
         (DpGuid, DpVersion, DpGuid, DpVersion, DpGuid, DpVersion, DpGuid, DpVersion)\r
 \r
@@ -443,24 +443,24 @@ class IpiDatabase(object):
         for Pkg in PkgList:\r
 \r
             SqlCommand = \\r
-            """delete from ModDepexInfo where ModDepexInfo.ModuleGuid in \r
-            (select ModuleGuid from ModInPkgInfo \r
-            where ModInPkgInfo.PackageGuid ='%s' and \r
+            """delete from ModDepexInfo where ModDepexInfo.ModuleGuid in\r
+            (select ModuleGuid from ModInPkgInfo\r
+            where ModInPkgInfo.PackageGuid ='%s' and\r
             ModInPkgInfo.PackageVersion = '%s')\r
             and ModDepexInfo.ModuleVersion in\r
-            (select ModuleVersion from ModInPkgInfo \r
-            where ModInPkgInfo.PackageGuid ='%s' and \r
+            (select ModuleVersion from ModInPkgInfo\r
+            where ModInPkgInfo.PackageGuid ='%s' and\r
             ModInPkgInfo.PackageVersion = '%s')\r
             and ModDepexInfo.ModuleName in\r
-            (select ModuleName from ModInPkgInfo \r
-            where ModInPkgInfo.PackageGuid ='%s' and \r
+            (select ModuleName from ModInPkgInfo\r
+            where ModInPkgInfo.PackageGuid ='%s' and\r
             ModInPkgInfo.PackageVersion = '%s')\r
             and ModDepexInfo.InstallPath in\r
-            (select InstallPath from ModInPkgInfo where \r
-            ModInPkgInfo.PackageGuid ='%s' \r
+            (select InstallPath from ModInPkgInfo where\r
+            ModInPkgInfo.PackageGuid ='%s'\r
             and ModInPkgInfo.PackageVersion = '%s')""" \\r
                             % (Pkg[0], Pkg[1], Pkg[0], Pkg[1], Pkg[0], Pkg[1], Pkg[0], Pkg[1])\r
-            \r
+\r
             self.Cur.execute(SqlCommand)\r
         #\r
         # delete the standalone module\r
@@ -474,7 +474,7 @@ class IpiDatabase(object):
         #\r
         for Pkg in PkgList:\r
             SqlCommand = \\r
-            """delete from %s where %s.PackageGuid ='%s' \r
+            """delete from %s where %s.PackageGuid ='%s'\r
             and %s.PackageVersion = '%s'""" % \\r
             (self.ModInPkgTable, self.ModInPkgTable, Pkg[0], \\r
              self.ModInPkgTable, Pkg[1])\r
@@ -493,23 +493,23 @@ class IpiDatabase(object):
         """delete from %s where DpGuid ='%s' and DpVersion = '%s'""" % \\r
         (self.DpFileListTable, DpGuid, DpVersion)\r
         self.Cur.execute(SqlCommand)\r
-        #    \r
+        #\r
         # delete DP\r
         #\r
         SqlCommand = \\r
         """delete from %s where DpGuid ='%s' and DpVersion = '%s'""" % \\r
         (self.DpTable, DpGuid, DpVersion)\r
         self.Cur.execute(SqlCommand)\r
-        \r
+\r
         #self.Conn.commit()\r
-        \r
+\r
     ## Get a list of distribution install information.\r
     #\r
-    # @param Guid: distribution package guid  \r
-    # @param Version: distribution package version \r
+    # @param Guid: distribution package guid\r
+    # @param Version: distribution package version\r
     #\r
     def GetDp(self, Guid, Version):\r
-        \r
+\r
         if Version is None or len(Version.strip()) == 0:\r
             Version = 'N/A'\r
             Logger.Verbose(ST.MSG_GET_DP_INSTALL_LIST)\r
@@ -517,7 +517,7 @@ class IpiDatabase(object):
             SqlCommand = """select * from %s where DpGuid ='%s'""" % \\r
             (self.DpTable, DpGuid)\r
             self.Cur.execute(SqlCommand)\r
-        \r
+\r
         else:\r
             Logger.Verbose(ST.MSG_GET_DP_INSTALL_INFO_START)\r
             (DpGuid, DpVersion) = (Guid, Version)\r
@@ -533,14 +533,14 @@ class IpiDatabase(object):
             InstallTime = DpInfo[2]\r
             PkgFileName = DpInfo[3]\r
             DpList.append((DpGuid, DpVersion, InstallTime, PkgFileName))\r
-            \r
-        Logger.Verbose(ST.MSG_GET_DP_INSTALL_INFO_FINISH)    \r
+\r
+        Logger.Verbose(ST.MSG_GET_DP_INSTALL_INFO_FINISH)\r
         return DpList\r
-    \r
+\r
     ## Get a list of distribution install dirs\r
     #\r
-    # @param Guid: distribution package guid \r
-    # @param Version: distribution package version \r
+    # @param Guid: distribution package guid\r
+    # @param Version: distribution package version\r
     #\r
     def GetDpInstallDirList(self, Guid, Version):\r
         SqlCommand = """select InstallPath from PkgInfo where DpGuid = '%s' and DpVersion = '%s'""" % (Guid, Version)\r
@@ -562,11 +562,11 @@ class IpiDatabase(object):
 \r
     ## Get a list of distribution install file path information.\r
     #\r
-    # @param Guid: distribution package guid \r
-    # @param Version: distribution package version \r
+    # @param Guid: distribution package guid\r
+    # @param Version: distribution package version\r
     #\r
     def GetDpFileList(self, Guid, Version):\r
-        \r
+\r
         (DpGuid, DpVersion) = (Guid, Version)\r
         SqlCommand = \\r
         """select * from %s where DpGuid ='%s' and DpVersion = '%s'""" % \\r
@@ -578,7 +578,7 @@ class IpiDatabase(object):
             Path = Result[0]\r
             Md5Sum = Result[3]\r
             PathList.append((os.path.join(self.Workspace, Path), Md5Sum))\r
-        \r
+\r
         return PathList\r
 \r
     ## Get files' repackage attribute if present that are installed into current workspace\r
@@ -588,12 +588,12 @@ class IpiDatabase(object):
     def GetRePkgDict(self):\r
         SqlCommand = """select * from %s """ % (self.DpTable)\r
         self.Cur.execute(SqlCommand)\r
-        \r
+\r
         DpInfoList = []\r
         for Result in self.Cur:\r
             DpInfoList.append(Result)\r
 \r
-        FileDict = {}        \r
+        FileDict = {}\r
         for Result in DpInfoList:\r
             DpGuid = Result[0]\r
             DpVersion = Result[1]\r
@@ -606,12 +606,12 @@ class IpiDatabase(object):
             for FileInfo in self.GetDpFileList(DpGuid, DpVersion):\r
                 PathInfo = FileInfo[0]\r
                 FileDict[PathInfo] = DpGuid, DpVersion, NewDpFileName, RePackage\r
-                \r
+\r
         return FileDict\r
-    \r
+\r
     ## Get (Guid, Version) from distribution file name information.\r
     #\r
-    # @param DistributionFile: Distribution File  \r
+    # @param DistributionFile: Distribution File\r
     #\r
     def GetDpByName(self, DistributionFile):\r
         SqlCommand = """select * from %s where NewPkgFileName = '%s'""" % \\r
@@ -622,34 +622,34 @@ class IpiDatabase(object):
             DpGuid = Result[0]\r
             DpVersion = Result[1]\r
             NewDpFileName = Result[3]\r
-   \r
+\r
             return (DpGuid, DpVersion, NewDpFileName)\r
         else:\r
             return (None, None, None)\r
-        \r
+\r
     ## Get a list of package information.\r
     #\r
-    # @param Guid: package guid  \r
+    # @param Guid: package guid\r
     # @param Version: package version\r
     #\r
     def GetPackage(self, Guid, Version, DpGuid='', DpVersion=''):\r
-        \r
+\r
         if DpVersion == '' or DpGuid == '':\r
 \r
             (PackageGuid, PackageVersion) = (Guid, Version)\r
-            SqlCommand = """select * from %s where PackageGuid ='%s' \r
+            SqlCommand = """select * from %s where PackageGuid ='%s'\r
             and PackageVersion = '%s'""" % (self.PkgTable, PackageGuid, \\r
                                             PackageVersion)\r
             self.Cur.execute(SqlCommand)\r
-        \r
+\r
         elif Version is None or len(Version.strip()) == 0:\r
-            \r
+\r
             SqlCommand = """select * from %s where PackageGuid ='%s'""" % \\r
             (self.PkgTable, Guid)\r
             self.Cur.execute(SqlCommand)\r
         else:\r
             (PackageGuid, PackageVersion) = (Guid, Version)\r
-            SqlCommand = """select * from %s where PackageGuid ='%s' and \r
+            SqlCommand = """select * from %s where PackageGuid ='%s' and\r
             PackageVersion = '%s'\r
                             and DpGuid = '%s' and DpVersion = '%s'""" % \\r
                             (self.PkgTable, PackageGuid, PackageVersion, \\r
@@ -664,10 +664,10 @@ class IpiDatabase(object):
             InstallPath = PkgInfo[5]\r
             PkgList.append((PkgGuid, PkgVersion, InstallTime, DpGuid, \\r
                             DpVersion, InstallPath))\r
-        \r
+\r
         return PkgList\r
\r
-       \r
+\r
+\r
     ## Get a list of module in package information.\r
     #\r
     # @param Guid: A module guid\r
@@ -676,15 +676,15 @@ class IpiDatabase(object):
     def GetModInPackage(self, Guid, Version, Name, Path, PkgGuid='', PkgVersion=''):\r
         (ModuleGuid, ModuleVersion, ModuleName, InstallPath) = (Guid, Version, Name, Path)\r
         if PkgVersion == '' or PkgGuid == '':\r
-            SqlCommand = """select * from %s where ModuleGuid ='%s' and \r
-            ModuleVersion = '%s' and InstallPath = '%s' \r
+            SqlCommand = """select * from %s where ModuleGuid ='%s' and\r
+            ModuleVersion = '%s' and InstallPath = '%s'\r
             and ModuleName = '%s'""" % (self.ModInPkgTable, ModuleGuid, \\r
                                        ModuleVersion, InstallPath, ModuleName)\r
             self.Cur.execute(SqlCommand)\r
         else:\r
-            SqlCommand = """select * from %s where ModuleGuid ='%s' and \r
-            ModuleVersion = '%s' and InstallPath = '%s' \r
-            and ModuleName = '%s' and PackageGuid ='%s' \r
+            SqlCommand = """select * from %s where ModuleGuid ='%s' and\r
+            ModuleVersion = '%s' and InstallPath = '%s'\r
+            and ModuleName = '%s' and PackageGuid ='%s'\r
             and PackageVersion = '%s'\r
                             """ % (self.ModInPkgTable, ModuleGuid, \\r
                                    ModuleVersion, InstallPath, ModuleName, PkgGuid, PkgVersion)\r
@@ -698,26 +698,26 @@ class IpiDatabase(object):
             InstallPath = ModInfo[5]\r
             ModList.append((ModGuid, ModVersion, InstallTime, PkgGuid, \\r
                             PkgVersion, InstallPath))\r
-        \r
+\r
         return ModList\r
-    \r
+\r
     ## Get a list of module standalone.\r
     #\r
-    # @param Guid: A module guid \r
-    # @param Version: A module version \r
+    # @param Guid: A module guid\r
+    # @param Version: A module version\r
     #\r
     def GetStandaloneModule(self, Guid, Version, Name, Path, DpGuid='', DpVersion=''):\r
         (ModuleGuid, ModuleVersion, ModuleName, InstallPath) = (Guid, Version, Name, Path)\r
         if DpGuid == '':\r
-            SqlCommand = """select * from %s where ModuleGuid ='%s' and \r
-            ModuleVersion = '%s' and InstallPath = '%s' \r
+            SqlCommand = """select * from %s where ModuleGuid ='%s' and\r
+            ModuleVersion = '%s' and InstallPath = '%s'\r
             and ModuleName = '%s'""" % (self.StandaloneModTable, ModuleGuid, \\r
                                        ModuleVersion, InstallPath, ModuleName)\r
             self.Cur.execute(SqlCommand)\r
-        \r
+\r
         else:\r
-            SqlCommand = """select * from %s where ModuleGuid ='%s' and \r
-            ModuleVersion = '%s' and InstallPath = '%s' and ModuleName = '%s' and DpGuid ='%s' and DpVersion = '%s' \r
+            SqlCommand = """select * from %s where ModuleGuid ='%s' and\r
+            ModuleVersion = '%s' and InstallPath = '%s' and ModuleName = '%s' and DpGuid ='%s' and DpVersion = '%s'\r
                             """ % (self.StandaloneModTable, ModuleGuid, \\r
                                    ModuleVersion, ModuleName, InstallPath, DpGuid, DpVersion)\r
             self.Cur.execute(SqlCommand)\r
@@ -730,18 +730,18 @@ class IpiDatabase(object):
             InstallPath = ModInfo[5]\r
             ModList.append((ModGuid, ModVersion, InstallTime, DpGuid, \\r
                             DpVersion, InstallPath))\r
-        \r
+\r
         return ModList\r
-    \r
+\r
     ## Get a list of module information that comes from DP.\r
     #\r
-    # @param DpGuid: A Distrabution Guid \r
-    # @param DpVersion: A Distrabution version  \r
+    # @param DpGuid: A Distrabution Guid\r
+    # @param DpVersion: A Distrabution version\r
     #\r
     def GetSModInsPathListFromDp(self, DpGuid, DpVersion):\r
 \r
         PathList = []\r
-        SqlCommand = """select InstallPath from %s where DpGuid ='%s' \r
+        SqlCommand = """select InstallPath from %s where DpGuid ='%s'\r
         and DpVersion = '%s'\r
                         """ % (self.StandaloneModTable, DpGuid, DpVersion)\r
         self.Cur.execute(SqlCommand)\r
@@ -749,17 +749,17 @@ class IpiDatabase(object):
         for Result in self.Cur:\r
             InstallPath = Result[0]\r
             PathList.append(InstallPath)\r
-        \r
+\r
         return PathList\r
-    \r
+\r
     ## Get a list of package information.\r
     #\r
-    # @param DpGuid: A Distrabution Guid \r
-    # @param DpVersion: A Distrabution version \r
+    # @param DpGuid: A Distrabution Guid\r
+    # @param DpVersion: A Distrabution version\r
     #\r
     def GetPackageListFromDp(self, DpGuid, DpVersion):\r
 \r
-        SqlCommand = """select * from %s where DpGuid ='%s' and \r
+        SqlCommand = """select * from %s where DpGuid ='%s' and\r
         DpVersion = '%s' """ % (self.PkgTable, DpGuid, DpVersion)\r
         self.Cur.execute(SqlCommand)\r
 \r
@@ -769,31 +769,31 @@ class IpiDatabase(object):
             PkgVersion = PkgInfo[1]\r
             InstallPath = PkgInfo[5]\r
             PkgList.append((PkgGuid, PkgVersion, InstallPath))\r
-        \r
+\r
         return PkgList\r
-    \r
+\r
     ## Get a list of modules that depends on package information from a DP.\r
     #\r
-    # @param DpGuid: A Distrabution Guid \r
-    # @param DpVersion: A Distrabution version \r
+    # @param DpGuid: A Distrabution Guid\r
+    # @param DpVersion: A Distrabution version\r
     #\r
     def GetDpDependentModuleList(self, DpGuid, DpVersion):\r
-        \r
+\r
         ModList = []\r
         PkgList = self.GetPackageListFromDp(DpGuid, DpVersion)\r
         if len(PkgList) > 0:\r
             return ModList\r
-        \r
+\r
         for Pkg in PkgList:\r
             #\r
-            # get all in-package modules that depends on current \r
-            # Pkg (Guid match, Version match or NA) but not belong to \r
+            # get all in-package modules that depends on current\r
+            # Pkg (Guid match, Version match or NA) but not belong to\r
             # current Pkg\r
             #\r
-            SqlCommand = """select t1.ModuleGuid, t1.ModuleVersion, \r
-            t1.InstallPath from %s as t1, %s as t2 where \r
-            t1.ModuleGuid = t2.ModuleGuid and \r
-            t1.ModuleVersion = t2.ModuleVersion and t2.DepexGuid ='%s' \r
+            SqlCommand = """select t1.ModuleGuid, t1.ModuleVersion,\r
+            t1.InstallPath from %s as t1, %s as t2 where\r
+            t1.ModuleGuid = t2.ModuleGuid and\r
+            t1.ModuleVersion = t2.ModuleVersion and t2.DepexGuid ='%s'\r
             and (t2.DepexVersion = '%s' or t2.DepexVersion = 'N/A') and\r
             t1.PackageGuid != '%s' and t1.PackageVersion != '%s'\r
                         """ % (self.ModInPkgTable, \\r
@@ -807,13 +807,13 @@ class IpiDatabase(object):
                 ModList.append((ModGuid, ModVersion, InstallPath))\r
 \r
             #\r
-            # get all modules from standalone modules that depends on current \r
+            # get all modules from standalone modules that depends on current\r
             #Pkg (Guid match, Version match or NA) but not in current dp\r
             #\r
             SqlCommand = \\r
-            """select t1.ModuleGuid, t1.ModuleVersion, t1.InstallPath \r
-            from %s as t1, %s as t2 where t1.ModuleGuid = t2.ModuleGuid and \r
-            t1.ModuleVersion = t2.ModuleVersion and t2.DepexGuid ='%s' \r
+            """select t1.ModuleGuid, t1.ModuleVersion, t1.InstallPath\r
+            from %s as t1, %s as t2 where t1.ModuleGuid = t2.ModuleGuid and\r
+            t1.ModuleVersion = t2.ModuleVersion and t2.DepexGuid ='%s'\r
             and (t2.DepexVersion = '%s' or t2.DepexVersion = 'N/A') and\r
                             t1.DpGuid != '%s' and t1.DpVersion != '%s'\r
                         """ % \\r
@@ -825,75 +825,75 @@ class IpiDatabase(object):
                 ModVersion = ModInfo[1]\r
                 InstallPath = ModInfo[2]\r
                 ModList.append((ModGuid, ModVersion, InstallPath))\r
-        \r
-        \r
+\r
+\r
         return ModList\r
 \r
     ## Get Dp's list of modules.\r
     #\r
-    # @param DpGuid: A Distrabution Guid \r
-    # @param DpVersion: A Distrabution version \r
+    # @param DpGuid: A Distrabution Guid\r
+    # @param DpVersion: A Distrabution version\r
     #\r
-    def GetDpModuleList(self, DpGuid, DpVersion):      \r
+    def GetDpModuleList(self, DpGuid, DpVersion):\r
         ModList = []\r
         #\r
         # get Dp module list from the DpFileList table\r
         #\r
-        SqlCommand = """select FilePath \r
+        SqlCommand = """select FilePath\r
                         from %s\r
-                        where DpGuid = '%s' and DpVersion = '%s' and \r
+                        where DpGuid = '%s' and DpVersion = '%s' and\r
                         FilePath like '%%.inf'\r
                     """ % (self.DpFileListTable, DpGuid, DpVersion)\r
         self.Cur.execute(SqlCommand)\r
         for ModuleInfo in self.Cur:\r
             FilePath = ModuleInfo[0]\r
             ModList.append(os.path.join(self.Workspace, FilePath))\r
-            \r
-        return ModList        \r
 \r
-        \r
+        return ModList\r
+\r
+\r
     ## Get a module depex\r
     #\r
-    # @param DpGuid: A module Guid \r
-    # @param DpVersion: A module version \r
+    # @param DpGuid: A module Guid\r
+    # @param DpVersion: A module version\r
     # @param Path:\r
     #\r
     def GetModuleDepex(self, Guid, Version, Path):\r
-                \r
+\r
         #\r
         # Get module depex information to DB.\r
         #\r
-        SqlCommand = """select * from %s where ModuleGuid ='%s' and \r
+        SqlCommand = """select * from %s where ModuleGuid ='%s' and\r
         ModuleVersion = '%s' and InstallPath ='%s'\r
                             """ % (self.ModDepexTable, Guid, Version, Path)\r
         self.Cur.execute(SqlCommand)\r
 \r
-        \r
+\r
         DepexList = []\r
         for DepInfo in self.Cur:\r
             DepexGuid = DepInfo[3]\r
             DepexVersion = DepInfo[4]\r
             DepexList.append((DepexGuid, DepexVersion))\r
-        \r
+\r
         return DepexList\r
\r
+\r
     ## Inventory the distribution installed to current workspace\r
     #\r
     # Inventory the distribution installed to current workspace\r
-    #   \r
+    #\r
     def InventoryDistInstalled(self):\r
         SqlCommand = """select * from %s """ % (self.DpTable)\r
         self.Cur.execute(SqlCommand)\r
-        \r
+\r
         DpInfoList = []\r
         for Result in self.Cur:\r
             DpGuid = Result[0]\r
             DpVersion = Result[1]\r
             DpAliasName = Result[3]\r
-            DpFileName = Result[4]            \r
+            DpFileName = Result[4]\r
             DpInfoList.append((DpGuid, DpVersion, DpFileName, DpAliasName))\r
-        \r
-        return DpInfoList     \r
+\r
+        return DpInfoList\r
 \r
     ## Close entire database\r
     #\r
@@ -904,18 +904,18 @@ class IpiDatabase(object):
         # drop the dummy table\r
         #\r
         SqlCommand = """\r
-        drop table IF EXISTS %s \r
+        drop table IF EXISTS %s\r
         """ % self.DummyTable\r
         self.Cur.execute(SqlCommand)\r
         self.Conn.commit()\r
-        \r
+\r
         self.Cur.close()\r
         self.Conn.close()\r
 \r
     ## Convert To Sql String\r
     #\r
     # 1. Replace "'" with "''" in each item of StringList\r
-    # \r
+    #\r
     # @param StringList:  A list for strings to be converted\r
     #\r
     def __ConvertToSqlString(self, StringList):\r
@@ -925,4 +925,4 @@ class IpiDatabase(object):
 \r
 \r
 \r
-    
\ No newline at end of file
+\r