## @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
## 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
\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
return True\r
else:\r
return False\r
- \r
+\r
## Check whether a module depex satisfied.\r
#\r
# @param ModuleObj: A module object\r
#\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
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
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
\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
else:\r
return False\r
return True\r
- \r
+\r
## Check whether a DP exists.\r
#\r
# @param Guid: Guid of a Distribution\r
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
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
#\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
#\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
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
# @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
#\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
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
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
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
# @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