public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>,
	Kurt Kennett <Kurt.Kennett@microsoft.com>
Subject: [Patch] BaseTools: Fix a bug use 'COMMON' as CodeBase in BuildOptions section
Date: Wed, 17 Aug 2016 19:10:42 +0800	[thread overview]
Message-ID: <1471432242-97696-1-git-send-email-yonghong.zhu@intel.com> (raw)

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 <liming.gao@intel.com>
Cc: Kurt Kennett <Kurt.Kennett@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/Workspace/MetaFileTable.py     | 8 +++++++-
 BaseTools/Source/Python/Workspace/WorkspaceDatabase.py | 3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileTable.py b/BaseTools/Source/Python/Workspace/MetaFileTable.py
index ab18070..aedcaca 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileTable.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileTable.py
@@ -339,11 +339,17 @@ class PlatformTable(MetaFileTable):
         ValueString = "Value1,Value2,Value3,Scope1,Scope2,ID,StartLine"
 
         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
         else:
             ConditionString += " AND BelongsToItem<0"
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index 86d8c32..ceaa4b8 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -800,13 +800,14 @@ class DscBuildData(PlatformBuildClassObject):
             self._ModuleTypeOptions = sdict()
         if (Edk, ModuleType) not in self._ModuleTypeOptions:
             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
                     else:
                         options[Key] += ' ' + Option
-- 
2.6.1.windows.1



             reply	other threads:[~2016-08-17 11:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17 11:10 Yonghong Zhu [this message]
2016-08-19  5:26 ` [Patch] BaseTools: Fix a bug use 'COMMON' as CodeBase in BuildOptions section Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471432242-97696-1-git-send-email-yonghong.zhu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox