]>
Commit | Line | Data |
---|---|---|
1e57a462 | 1 | #\r |
2 | # Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r | |
1e57a462 | 3 | #\r |
3402aac7 RC |
4 | # This program and the accompanying materials\r |
5 | # are licensed and made available under the terms and conditions of the BSD License\r | |
6 | # which accompanies this distribution. The full text of the license may be found at\r | |
7 | # http://opensource.org/licenses/bsd-license.php\r | |
8 | #\r | |
9 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
1e57a462 | 11 | #\r |
12 | \r | |
13 | import re\r | |
14 | \r | |
15 | class BuildReport:\r | |
16 | PCDs = {}\r | |
3402aac7 | 17 | \r |
1e57a462 | 18 | def parse_platform_summary(self, file):\r |
19 | pass\r | |
3402aac7 | 20 | \r |
1e57a462 | 21 | def parse_pcd_report(self, report_file):\r |
22 | pcd_reg = re.compile(" (\*P|\*F|\*M| ) (\w+)(\ +)\: (.*) \((\w+)\) = (.*)\n")\r | |
3402aac7 | 23 | \r |
1e57a462 | 24 | for line in report_file.xreadlines():\r |
25 | stripped_line = line.strip()\r | |
26 | if re.match("\<=+\>", stripped_line):\r | |
27 | return\r | |
28 | elif re.match("g.*Guid", stripped_line):\r | |
29 | guid = stripped_line\r | |
30 | self.PCDs[guid] = {}\r | |
31 | else:\r | |
32 | m = pcd_reg.match(line)\r | |
33 | if m:\r | |
34 | self.PCDs[guid][m.group(2)] = (m.group(6).strip(),m.group(5))\r | |
3402aac7 | 35 | \r |
1e57a462 | 36 | def parse_firmware_device(self, file):\r |
37 | pass\r | |
3402aac7 | 38 | \r |
1e57a462 | 39 | def parse_module_summary(self, file):\r |
40 | #print "Module Summary"\r | |
41 | pass\r | |
3402aac7 | 42 | \r |
1e57a462 | 43 | CONST_SECTION_HEADERS = [('Platform Summary', parse_platform_summary),\r |
44 | ('Platform Configuration Database Report',parse_pcd_report),\r | |
45 | ('Firmware Device (FD)',parse_firmware_device),\r | |
46 | ('Module Summary',parse_module_summary)]\r | |
3402aac7 | 47 | \r |
1e57a462 | 48 | def __init__(self, filename = 'report.log'):\r |
49 | report_file = open(filename, 'r')\r | |
50 | for line in report_file.xreadlines():\r | |
51 | for section_header in BuildReport.CONST_SECTION_HEADERS:\r | |
52 | if line.strip() == section_header[0]:\r | |
53 | section_header[1](self, report_file)\r | |
54 | #print self.PCDs\r |