public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: hesschen <hesheng.chen@intel.com>
To: edk2-devel@lists.01.org
Subject: [patch 3/3] BaseTools/UPT: Fix a parser issue
Date: Sat,  1 Apr 2017 13:33:05 +0800	[thread overview]
Message-ID: <1491024785-9388-3-git-send-email-hesheng.chen@intel.com> (raw)
In-Reply-To: <1491024785-9388-1-git-send-email-hesheng.chen@intel.com>

Update the method to get PCD information and support empty section.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: hesschen <hesheng.chen@intel.com>
---
 BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py      |  5 +++--
 BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py | 13 ++++---------
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
index bb8a120..a376f56 100644
--- a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
+++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
@@ -568,8 +568,9 @@ def GenUserExtensions(ModuleObject):
         if UserExtension.GetIdentifier() == 'Depex':
             continue
         Statement = UserExtension.GetStatement()
-        if not Statement:
-            continue
+# Comment the code to support user extension without any statement just the section header in []
+#         if not Statement:
+#             continue
         ArchList = UserExtension.GetSupArchList()
         for Index in xrange(0, len(ArchList)):
             ArchList[Index] = ConvertArchForInstall(ArchList[Index])
diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py b/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py
index 0a8624c..3c6c9ee 100644
--- a/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py
+++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py
@@ -2,7 +2,7 @@
 #
 # This file contained the miscellaneous routines for GenMetaFile usage.
 #
-# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2017, 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 
@@ -108,33 +108,28 @@ def ObtainPcdName(Packages, TokenSpaceGuidValue, Token):
         TokenSpaceGuidName = ''
         PcdCName = ''
         TokenSpaceGuidNameFound = False
-        PcdCNameFound = False
 
         #
         # Get TokenSpaceGuidCName from Guids section 
         #
         for GuidKey in DecGuidsDict:
             GuidList = DecGuidsDict[GuidKey]
-            if TokenSpaceGuidNameFound:
-                break
             for GuidItem in GuidList:
                 if TokenSpaceGuidValue.upper() == GuidItem.GuidString.upper():
                     TokenSpaceGuidName = GuidItem.GuidCName
                     TokenSpaceGuidNameFound = True
                     break
-
+            if TokenSpaceGuidNameFound:
+                break
         #
         # Retrieve PcdCName from Pcds Section
         #
         for PcdKey in DecPcdsDict:
             PcdList = DecPcdsDict[PcdKey]
-            if PcdCNameFound:
-                return TokenSpaceGuidName, PcdCName
             for PcdItem in PcdList:
                 if TokenSpaceGuidName == PcdItem.TokenSpaceGuidCName and Token == PcdItem.TokenValue:
                     PcdCName = PcdItem.TokenCName
-                    PcdCNameFound = True
-                    break
+                    return TokenSpaceGuidName, PcdCName
 
     return TokenSpaceGuidName, PcdCName
 
-- 
2.7.2.windows.1



  parent reply	other threads:[~2017-04-01  5:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-01  5:33 [patch 1/3] BaseTools/UPT: Use a simple way to get package path hesschen
2017-04-01  5:33 ` [patch 2/3] BaseTools/UPT: Support Unicode path hesschen
2017-04-05  2:23   ` Zhu, Yonghong
2017-04-01  5:33 ` hesschen [this message]
2017-04-05  2:23   ` [patch 3/3] BaseTools/UPT: Fix a parser issue Zhu, Yonghong
2017-04-05  2:23 ` [patch 1/3] BaseTools/UPT: Use a simple way to get package path Zhu, Yonghong

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=1491024785-9388-3-git-send-email-hesheng.chen@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