DependencyRules.py revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
## @file
# This file is for installed package information database operations
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The full text of the license may be found at
#
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
'''
Dependency
'''
##
# Import Modules
#
## IpiDb
#
# This class represents the installed package information database
#
#
# @param object: Inherited from object class
#
class DependencyRules(object):
## Check whether a module exists in current workspace.
#
# @param Guid: Guid of a module
# @param Version: Version of a module
#
if ReturnCode:
pass
return True
else:
return False
## Check whether a module depex satisfied by current workspace or dist.
#
# @param ModuleObj: A module object
# @param DpObj: A depex object
#
if ReturnCode:
pass
Dep = None
#
# first check whether the dependency satisfied by current workspace
#
#
# check whether satisfied by current distribution
#
if not Exist:
if DpObj == None:
break
if Dep.GetVersion() == None or \
break
break
else:
break
if not Result:
Dep.GetPackageFilePath(), \
Dep.GetVersion()))
return Result
## Check whether a package exists in current workspace.
#
# @param Guid: Guid of a package
# @param Version: Version of a package
#
pass
#
# if version is not empty and not equal, then not match
#
return False
else:
return True
else:
return False
## Check whether a package depex satisfied by current workspace.
#
# @param PkgObj: A package object
# @param DpObj: A package depex object
#
continue
else:
return False
return True
## Check whether a DP exists in current workspace.
#
# @param Guid: Guid of a module
# @param Version: Version of a module
#
if ReturnCode:
pass
return True
else:
return False
## Check whether a DP depex satisfied by current workspace.
#
# @param DpObj: Depex object
# @param ReturnCode: ReturnCode
#
continue
else:
return False
continue
else:
return False
return True
## Check whether a DP depex satisfied by current workspace. Return False
# if Can not remove (there is dependency), True else
#
# @param DpGuid: File's guid
# @param DpVersion: File's version
# @param ReturnCode: ReturnCode
#
if ReturnCode:
pass
DependModuleList = []
#
# remove modules that included in current DP
# List of item (FilePath)
for Module in DpModuleList:
if Module in WsModuleList:
else:
#
# get packages in current Dp and find the install path
# List of item (PkgGuid, PkgVersion, InstallPath)
DpPackagePathList = []
if PkgName:
pass
DecFileRelaPath = \
else:
#
# the left items in DpPackageList are the packages that installed but not found anymore
#
#
# check modules to see if has dependency on package of current DP
#
for Module in WsModuleList:
return (Removable, DependModuleList)
## check whether module depends on packages in DpPackagePathList, return True
# if found, False else
#
# @param Path: a module path
# @param DpPackagePathList: a list of Package Paths
#
#
# use InfParser to parse inf, then get the information for now,
# later on, may consider only parse to get the package dependency info
# (Need to take care how to deal wit Macros)
#
try:
return True
else:
return False
except FatalError, ErrCode:
return False
else:
return False