]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/build/BuildReport.py
BaseTools: Fixed an error reported during generating report.
[mirror_edk2.git] / BaseTools / Source / Python / build / BuildReport.py
index d5ea3bd3e5fa077dc9c2e7eb7e98b480f43dfbcf..264607b0036002da0f25223ec7218da7b46dd854 100644 (file)
@@ -4,7 +4,7 @@
 # This module contains the functionality to generate build report after\r
 # build all target completes successfully.\r
 #\r
-# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -16,7 +16,7 @@
 \r
 ## Import Modules\r
 #\r
-import os\r
+import Common.LongFilePathOs as os\r
 import re\r
 import platform\r
 import textwrap\r
@@ -40,6 +40,7 @@ from Common.DataType import TAB_SPACE_SPLIT
 from Common.DataType import TAB_BRG_PCD\r
 from Common.DataType import TAB_BRG_LIBRARY\r
 from Common.DataType import TAB_BACK_SLASH\r
+from Common.LongFilePathSupport import OpenLongFilePath as open\r
 \r
 ## Pattern to extract contents in EDK DXS files\r
 gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL)\r
@@ -72,6 +73,9 @@ gGlueLibEntryPoint = re.compile(r"__EDKII_GLUE_MODULE_ENTRY_POINT__\s*=\s*(\w+)"
 ## Tags for MaxLength of line in report\r
 gLineMaxLength = 120\r
 \r
+## Tags for end of line in report\r
+gEndOfLine = "\r\n"\r
+\r
 ## Tags for section start, end and separator\r
 gSectionStart = ">" + "=" * (gLineMaxLength-2) + "<"\r
 gSectionEnd = "<" + "=" * (gLineMaxLength-2) + ">" + "\n"\r
@@ -91,9 +95,9 @@ gPcdTypeMap = {
   'Dynamic'          : ('DYN',    'Dynamic'),\r
   'DynamicHii'       : ('DYNHII', 'Dynamic'),\r
   'DynamicVpd'       : ('DYNVPD', 'Dynamic'),\r
-  'DynamicEx'        : ('DEX',    'Dynamic'),\r
-  'DynamicExHii'     : ('DEXHII', 'Dynamic'),\r
-  'DynamicExVpd'     : ('DEXVPD', 'Dynamic'),\r
+  'DynamicEx'        : ('DEX',    'DynamicEx'),\r
+  'DynamicExHii'     : ('DEXHII', 'DynamicEx'),\r
+  'DynamicExVpd'     : ('DEXVPD', 'DynamicEx'),\r
   }\r
 \r
 ## The look up table to map module type to driver type\r
@@ -128,7 +132,7 @@ gOpCodeList = ["BEFORE", "AFTER", "PUSH", "AND", "OR", "NOT", "TRUE", "FALSE", "
 def FileWrite(File, String, Wrapper=False):\r
     if Wrapper:\r
         String = textwrap.fill(String, 120)\r
-    File.write(String + "\r\n")\r
+    File.write(String + gEndOfLine)\r
 \r
 ##\r
 # Find all the header file that the module source directly includes.\r
@@ -203,6 +207,8 @@ def FileLinesSplit(Content=None, MaxLength=None):
             NewContentList.append(Line)\r
     for NewLine in NewContentList:\r
         NewContent += NewLine + TAB_LINE_BREAK\r
+    \r
+    NewContent = NewContent.replace(TAB_LINE_BREAK, gEndOfLine).replace('\r\r\n', gEndOfLine)\r
     return NewContent\r
     \r
     \r
@@ -254,7 +260,7 @@ class DepexParser(object):
             Statement = gOpCodeList[struct.unpack("B", OpCode)[0]]\r
             if Statement in ["BEFORE", "AFTER", "PUSH"]:\r
                 GuidValue = "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X" % \\r
-                            struct.unpack("LHHBBBBBBBB", DepexFile.read(16))\r
+                            struct.unpack("=LHHBBBBBBBB", DepexFile.read(16))\r
                 GuidString = self._GuidDb.get(GuidValue, GuidValue)\r
                 Statement = "%s %s" % (Statement, GuidString)\r
             DepexStatement.append(Statement)\r
@@ -694,7 +700,8 @@ class PcdReport(object):
         # Collect PCDs defined in DSC common section\r
         #\r
         self.DscPcdDefault = {}\r
-        for Platform in Wa.BuildDatabase.WorkspaceDb.PlatformList:\r
+        for Arch in Wa.ArchList:\r
+            Platform = Wa.BuildDatabase[Wa.MetaFile, Arch, Wa.BuildTarget, Wa.ToolChain]\r
             for (TokenCName, TokenSpaceGuidCName) in Platform.Pcds:\r
                 DscDefaultValue = Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DefaultValue\r
                 if DscDefaultValue:\r
@@ -1230,10 +1237,10 @@ class FdRegionReport(object):
         #\r
         # Collect PCDs defined in DSC common section\r
         #\r
-        for Platform in Wa.BuildDatabase.WorkspaceDb.PlatformList:\r
-            for (TokenCName, TokenSpaceGuidCName) in Platform.Pcds:\r
-                DscDefaultValue = Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DefaultValue\r
-                PlatformPcds[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue\r
+        Platform = Wa.BuildDatabase[Wa.MetaFile, 'COMMON']\r
+        for (TokenCName, TokenSpaceGuidCName) in Platform.Pcds:\r
+            DscDefaultValue = Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DefaultValue\r
+            PlatformPcds[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue\r
 \r
         #\r
         # Add PEI and DXE a priori files GUIDs defined in PI specification.\r