From: Yonghong Zhu Date: Wed, 17 Aug 2016 10:52:51 +0000 (+0800) Subject: BaseTools: Fix a bug use 'COMMON' as CodeBase in BuildOptions section X-Git-Tag: edk2-stable201903~5964 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=35dc964bf1eab3f0725389811d2316b1331d6cee;p=mirror_edk2.git BaseTools: Fix a bug use 'COMMON' as CodeBase in BuildOptions section Current BaseTools query the BuildOptions not cover the case that use 'COMMON' as CodeBase, while DSC spec allow this usage. This Patch add support for such 'common.DXE_RUNTIME_DRIVER' as the Scope2 in the query Condition. Cc: Liming Gao Cc: Kurt Kennett Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- diff --git a/BaseTools/Source/Python/Workspace/MetaFileTable.py b/BaseTools/Source/Python/Workspace/MetaFileTable.py index ab1807046e..aedcacada1 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileTable.py +++ b/BaseTools/Source/Python/Workspace/MetaFileTable.py @@ -341,7 +341,13 @@ class PlatformTable(MetaFileTable): if Scope1 != None and Scope1 != 'COMMON': ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Scope1 if Scope2 != None and Scope2 != 'COMMON': - ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT')" % Scope2 + # Cover the case that CodeBase is 'COMMON' for BuildOptions section + if '.' in Scope2: + Index = Scope2.index('.') + NewScope = 'COMMON'+ Scope2[Index:] + ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT' OR Scope2='%s')" % (Scope2, NewScope) + else: + ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT')" % Scope2 if BelongsToItem != None: ConditionString += " AND BelongsToItem=%s" % BelongsToItem diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py index 86d8c3256c..ceaa4b8e0a 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py @@ -802,9 +802,10 @@ class DscBuildData(PlatformBuildClassObject): options = sdict() self._ModuleTypeOptions[Edk, ModuleType] = options DriverType = '%s.%s' % (Edk, ModuleType) + CommonDriverType = '%s.%s' % ('COMMON', ModuleType) RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, DriverType] for ToolChainFamily, ToolChain, Option, Arch, Type, Dummy3, Dummy4 in RecordList: - if Type == DriverType: + if Type == DriverType or Type == CommonDriverType: Key = (ToolChainFamily, ToolChain, Edk) if Key not in options or not ToolChain.endswith('_FLAGS') or Option.startswith('='): options[Key] = Option