public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zhu, Yonghong" <yonghong.zhu@intel.com>
To: "Chen, Hesheng" <hesheng.chen@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [patch] BaseTool/UPT: Not expand macro for UserExtension
Date: Tue, 2 Aug 2016 06:16:57 +0000	[thread overview]
Message-ID: <B9726D6DCCFB8B4CA276A9169B02216D113656FB@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1470065134-86368-1-git-send-email-hesheng.chen@intel.com>

Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong


-----Original Message-----
From: Chen, Hesheng 
Sent: Monday, August 01, 2016 11:26 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [patch] BaseTool/UPT: Not expand macro for UserExtension

All MACRO values defined by the DEFINE statements n any section (except [Userextensions] sections other than TianoCore."ExtraFiles) of the INF or DEC file must be expanded before processing of the file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: hesschen <hesheng.chen@intel.com>
---
 BaseTools/Source/Python/UPT/Parser/DecParser.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/UPT/Parser/DecParser.py b/BaseTools/Source/Python/UPT/Parser/DecParser.py
index e6658a9..937047f 100644
--- a/BaseTools/Source/Python/UPT/Parser/DecParser.py
+++ b/BaseTools/Source/Python/UPT/Parser/DecParser.py
@@ -270,7 +270,21 @@ class _DecBase:
                     self._LoggerError(ST.ERR_DECPARSE_BACKSLASH_EMPTY)
                 CatLine += Line
          
-        self._RawData.CurrentLine = self._ReplaceMacro(CatLine)
+        #
+        # All MACRO values defined by the DEFINE statements in any section
+        # (except [Userextensions] sections for Intel) of the INF or DEC file
+        # must be expanded before processing of the file.
+        #
+        __IsReplaceMacro = True
+        Header = self._RawData.CurrentScope[0] if self._RawData.CurrentScope else None
+        if Header and len(Header) > 2:
+            if Header[0].upper() == 'USEREXTENSIONS' and not (Header[1] == 'TianoCore' and Header[2] == '"ExtraFiles"'):
+                __IsReplaceMacro = False
+        if __IsReplaceMacro:
+            self._RawData.CurrentLine = self._ReplaceMacro(CatLine)
+        else:
+            self._RawData.CurrentLine = CatLine
+
         return CatLine, CommentList
     
     ## Parse
--
2.7.2.windows.1



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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01 15:25 [patch] BaseTool/UPT: Not expand macro for UserExtension hesschen
2016-08-02  6:16 ` Zhu, Yonghong [this message]

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=B9726D6DCCFB8B4CA276A9169B02216D113656FB@SHSMSX103.ccr.corp.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