]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Core/DependencyRules.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Core / DependencyRules.py
index 406a8a7e92de100a1fc9ca7f53c4fdd4e8c3d19a..9c3baa1b12d8d2f9e9f1322b258a3c5593ecf86f 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
 #\r
@@ -40,7 +40,7 @@ DEPEX_CHECK_PACKAGE_NOT_FOUND, DEPEX_CHECK_DP_NOT_FOUND) = (0, 1, 2, 3)
 ## DependencyRules\r
 #\r
 # This class represents the dependency rule check mechanism\r
-# \r
+#\r
 # @param object:      Inherited from object class\r
 #\r
 class DependencyRules(object):\r
@@ -53,7 +53,7 @@ class DependencyRules(object):
 \r
         # Add package info from the DIST to be installed.\r
         self.PkgsToBeDepend.extend(self.GenToBeInstalledPkgList(ToBeInstalledPkgList))\r
-        \r
+\r
     def GenToBeInstalledPkgList(self, ToBeInstalledPkgList):\r
         if not ToBeInstalledPkgList:\r
             return []\r
@@ -81,7 +81,7 @@ class DependencyRules(object):
             return True\r
         else:\r
             return False\r
-        \r
+\r
     ## Check whether a module depex satisfied.\r
     #\r
     # @param ModuleObj: A module object\r
@@ -101,7 +101,7 @@ class DependencyRules(object):
             #\r
             Exist = self.CheckPackageExists(Dep.GetGuid(), Dep.GetVersion())\r
             #\r
-            # check whether satisfied by current distribution \r
+            # check whether satisfied by current distribution\r
             #\r
             if not Exist:\r
                 if DpObj is None:\r
@@ -119,7 +119,7 @@ class DependencyRules(object):
                 else:\r
                     Result = False\r
                     break\r
-        \r
+\r
         if not Result:\r
             Logger.Error("CheckModuleDepex", UNKNOWN_ERROR, \\r
                          ST.ERR_DEPENDENCY_NOT_MATCH % (ModuleObj.GetName(), \\r
@@ -127,7 +127,7 @@ class DependencyRules(object):
                                                         Dep.GetGuid(), \\r
                                                         Dep.GetVersion()))\r
         return Result\r
-            \r
+\r
     ## Check whether a package exists in a package list specified by PkgsToBeDepend.\r
     #\r
     # @param Guid: Guid of a package\r
@@ -154,7 +154,7 @@ class DependencyRules(object):
 \r
         Logger.Verbose(ST.MSG_CHECK_PACKAGE_FINISH)\r
         return Found\r
-         \r
+\r
     ## Check whether a package depex satisfied.\r
     #\r
     # @param PkgObj: A package object\r
@@ -171,7 +171,7 @@ class DependencyRules(object):
             else:\r
                 return False\r
         return True\r
-        \r
+\r
     ## Check whether a DP exists.\r
     #\r
     # @param Guid: Guid of a Distribution\r
@@ -216,7 +216,7 @@ class DependencyRules(object):
         return True, DpObj\r
 \r
 \r
-    ## Check whether a DP depex satisfied by current workspace \r
+    ## Check whether a DP depex satisfied by current workspace\r
     #  (excluding the original distribution's packages to be replaced) for Replace\r
     #\r
     # @param DpObj:  A distribution object\r
@@ -243,17 +243,17 @@ class DependencyRules(object):
                 continue\r
             else:\r
                 return False\r
-            \r
+\r
         for ModKey in DpObj.ModuleSurfaceArea.keys():\r
             ModObj = DpObj.ModuleSurfaceArea[ModKey]\r
             if self.CheckModuleDepexSatisfied(ModObj, DpObj):\r
                 continue\r
             else:\r
                 return False\r
-        \r
+\r
         return True\r
-    \r
-    ## Check whether a DP could be removed from current workspace. \r
+\r
+    ## Check whether a DP could be removed from current workspace.\r
     #\r
     # @param DpGuid:  File's guid\r
     # @param DpVersion: File's version\r
@@ -267,7 +267,7 @@ class DependencyRules(object):
         #\r
         # remove modules that included in current DP\r
         # List of item (FilePath)\r
-        DpModuleList = self.IpiDb.GetDpModuleList(DpGuid, DpVersion) \r
+        DpModuleList = self.IpiDb.GetDpModuleList(DpGuid, DpVersion)\r
         for Module in DpModuleList:\r
             if Module in WsModuleList:\r
                 WsModuleList.remove(Module)\r
@@ -277,7 +277,7 @@ class DependencyRules(object):
         #\r
         # get packages in current Dp and find the install path\r
         # List of item (PkgGuid, PkgVersion, InstallPath)\r
-        DpPackageList = self.IpiDb.GetPackageListFromDp(DpGuid, DpVersion) \r
+        DpPackageList = self.IpiDb.GetPackageListFromDp(DpGuid, DpVersion)\r
         DpPackagePathList = []\r
         WorkSP = GlobalData.gWORKSPACE\r
         for (PkgName, PkgGuid, PkgVersion, DecFile) in self.WsPkgList:\r
@@ -290,18 +290,18 @@ class DependencyRules(object):
             else:\r
                 InstallPath = DecPath\r
                 DecFileRelaPath = DecFile\r
-                \r
+\r
             if (PkgGuid, PkgVersion, InstallPath) in DpPackageList:\r
                 DpPackagePathList.append(DecFileRelaPath)\r
                 DpPackageList.remove((PkgGuid, PkgVersion, InstallPath))\r
-        \r
+\r
         #\r
         # the left items in DpPackageList are the packages that installed but not found anymore\r
         #\r
         for (PkgGuid, PkgVersion, InstallPath) in DpPackageList:\r
             Logger.Warn("UPT",\r
                         ST.WARN_INSTALLED_PACKAGE_NOT_FOUND%(PkgGuid, PkgVersion, InstallPath))\r
-        \r
+\r
         #\r
         # check modules to see if has dependency on package of current DP\r
         #\r
@@ -320,7 +320,7 @@ class DependencyRules(object):
     # @param NewDpPkgList: a list of package information (Guid, Version) in new Dp\r
     # @retval Replaceable: True if distribution could be replaced, False Else\r
     # @retval DependModuleList: the list of modules that make distribution can not be replaced\r
-    # \r
+    #\r
     def CheckDpDepexForReplace(self, OrigDpGuid, OrigDpVersion, NewDpPkgList):\r
         Replaceable = True\r
         DependModuleList = []\r
@@ -328,19 +328,19 @@ class DependencyRules(object):
         #\r
         # remove modules that included in current DP\r
         # List of item (FilePath)\r
-        DpModuleList = self.IpiDb.GetDpModuleList(OrigDpGuid, OrigDpVersion) \r
+        DpModuleList = self.IpiDb.GetDpModuleList(OrigDpGuid, OrigDpVersion)\r
         for Module in DpModuleList:\r
             if Module in WsModuleList:\r
                 WsModuleList.remove(Module)\r
             else:\r
                 Logger.Warn("UPT\n",\r
                             ST.ERR_MODULE_NOT_INSTALLED % Module)\r
-        \r
+\r
         OtherPkgList = NewDpPkgList\r
         #\r
         # get packages in current Dp and find the install path\r
         # List of item (PkgGuid, PkgVersion, InstallPath)\r
-        DpPackageList = self.IpiDb.GetPackageListFromDp(OrigDpGuid, OrigDpVersion) \r
+        DpPackageList = self.IpiDb.GetPackageListFromDp(OrigDpGuid, OrigDpVersion)\r
         DpPackagePathList = []\r
         WorkSP = GlobalData.gWORKSPACE\r
         for (PkgName, PkgGuid, PkgVersion, DecFile) in self.WsPkgList:\r
@@ -353,7 +353,7 @@ class DependencyRules(object):
             else:\r
                 InstallPath = DecPath\r
                 DecFileRelaPath = DecFile\r
-                \r
+\r
             if (PkgGuid, PkgVersion, InstallPath) in DpPackageList:\r
                 DpPackagePathList.append(DecFileRelaPath)\r
                 DpPackageList.remove((PkgGuid, PkgVersion, InstallPath))\r
@@ -366,7 +366,7 @@ class DependencyRules(object):
         for (PkgGuid, PkgVersion, InstallPath) in DpPackageList:\r
             Logger.Warn("UPT",\r
                         ST.WARN_INSTALLED_PACKAGE_NOT_FOUND%(PkgGuid, PkgVersion, InstallPath))\r
-        \r
+\r
         #\r
         # check modules to see if it can be satisfied by package not belong to removed DP\r
         #\r
@@ -376,8 +376,8 @@ class DependencyRules(object):
                 DependModuleList.append(Module)\r
         return (Replaceable, DependModuleList)\r
 \r
-    \r
-## check whether module depends on packages in DpPackagePathList, return True \r
+\r
+## check whether module depends on packages in DpPackagePathList, return True\r
 # if found, False else\r
 #\r
 # @param Path: a module path\r
@@ -432,7 +432,7 @@ def GetPackagePath(InfPath):
 # @param DpPackagePathList:  a list of Package Paths\r
 # @param OtherPkgList:       a list of Package Information (Guid, Version)\r
 # @retval:  False: module depends on package in DpPackagePathList and can not be satisfied by OtherPkgList\r
-#           True:  either module doesn't depend on DpPackagePathList or module depends on DpPackagePathList \r
+#           True:  either module doesn't depend on DpPackagePathList or module depends on DpPackagePathList\r
 #                 but can be satisfied by OtherPkgList\r
 #\r
 def VerifyReplaceModuleDep(Path, DpPackagePathList, OtherPkgList):\r