Revision: 17709
          http://sourceforge.net/p/edk2/code/17709
Author:   hchen30
Date:     2015-06-25 08:05:42 +0000 (Thu, 25 Jun 2015)
Log Message:
-----------
BaseTools/Ecc: Fix a bug in parser

Fix a bug to not break when parsing a macro and not find its value

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <[email protected]>
Reviewed-by: YangX Li <[email protected]>

Modified Paths:
--------------
    trunk/edk2/BaseTools/Source/Python/Common/String.py
    trunk/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py

Modified: trunk/edk2/BaseTools/Source/Python/Common/String.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/Common/String.py 2015-06-25 08:01:59 UTC 
(rev 17708)
+++ trunk/edk2/BaseTools/Source/Python/Common/String.py 2015-06-25 08:05:42 UTC 
(rev 17709)
@@ -1,7 +1,7 @@
 ## @file
 # This file is used to define common string related functions used in parsing 
process
 #
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2015, 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
@@ -272,7 +272,8 @@
                 if SelfReplacement:
                     String = String.replace("$(%s)" % Macro, '')
                 continue
-            String = String.replace("$(%s)" % Macro, MacroDefinitions[Macro])
+            if "$(%s)" % Macro not in MacroDefinitions[Macro]:
+                String = String.replace("$(%s)" % Macro, 
MacroDefinitions[Macro])
         # in case there's macro not defined
         if String == LastString:
             break

Modified: 
trunk/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py  
2015-06-25 08:01:59 UTC (rev 17708)
+++ trunk/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py  
2015-06-25 08:05:42 UTC (rev 17709)
@@ -1312,6 +1312,9 @@
                                 File=self._FileWithError, ExtraData=' 
'.join(self._ValueList), 
                                 Line=self._LineIndex+1)
                 Result = Excpt.result
+            except BadExpression, Exc:
+                EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), 
self._ValueList[1])
+                Result = False
 
         if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
                               MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,


------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to