Revision: 18746
          http://sourceforge.net/p/edk2/code/18746
Author:   yzhu52
Date:     2015-11-09 07:43:07 +0000 (Mon, 09 Nov 2015)
Log Message:
-----------
BaseTools: Allow decimal values in the EDK II meta-data file

Because the EDK II meta-data specifications already allow using decimal
values in the EDK II Meta-data file [Defines] section, this patch update
code to allow this usage.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Modified Paths:
--------------
    trunk/edk2/BaseTools/Source/Python/Workspace/MetaFileParser.py
    trunk/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py

Modified: trunk/edk2/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/Workspace/MetaFileParser.py      
2015-11-09 07:00:20 UTC (rev 18745)
+++ trunk/edk2/BaseTools/Source/Python/Workspace/MetaFileParser.py      
2015-11-09 07:43:07 UTC (rev 18746)
@@ -343,9 +343,14 @@
         Name, Value = self._ValueList[1], self._ValueList[2]
         # Sometimes, we need to make differences between EDK and EDK2 modules 
         if Name == 'INF_VERSION':
-            try:
-                self._Version = int(Value, 0)
-            except:
+            if re.match(r'0[xX][\da-f-A-F]{5,8}', Value):
+                self._Version = int(Value, 0)   
+            elif re.match(r'\d+\.\d+', Value):
+                ValueList = Value.split('.')
+                Major = '%04o' % int(ValueList[0], 0)
+                Minor = '%04o' % int(ValueList[1], 0)
+                self._Version = int('0x' + Major + Minor, 0)
+            else:
                 EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version 
number",
                                 ExtraData=self._CurrentLine, 
File=self.MetaFile, Line=self._LineIndex + 1)
 

Modified: trunk/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py   
2015-11-09 07:00:20 UTC (rev 18745)
+++ trunk/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py   
2015-11-09 07:43:07 UTC (rev 18746)
@@ -1955,7 +1955,13 @@
             RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, 
self._Platform]
             for Record in RecordList:
                 if Record[1] == TAB_INF_DEFINES_INF_VERSION:
-                    self._AutoGenVersion = int(Record[2], 0)
+                    if '.' in Record[2]:
+                        ValueList = Record[2].split('.')
+                        Major = '%04o' % int(ValueList[0], 0)
+                        Minor = '%04o' % int(ValueList[1], 0)
+                        self._AutoGenVersion = int('0x' + Major + Minor, 0)
+                    else:
+                        self._AutoGenVersion = int(Record[2], 0)
                     break
             if self._AutoGenVersion == None:
                 self._AutoGenVersion = 0x00010000


------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a 
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to