## @file\r
# This file is used to parse meta files\r
#\r
-# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.<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
Name, Value = self._ValueList[1], self._ValueList[2]\r
# Sometimes, we need to make differences between EDK and EDK2 modules \r
if Name == 'INF_VERSION':\r
- try:\r
- self._Version = int(Value, 0)\r
- except:\r
+ if re.match(r'0[xX][\da-f-A-F]{5,8}', Value):\r
+ self._Version = int(Value, 0) \r
+ elif re.match(r'\d+\.\d+', Value):\r
+ ValueList = Value.split('.')\r
+ Major = '%04o' % int(ValueList[0], 0)\r
+ Minor = '%04o' % int(ValueList[1], 0)\r
+ self._Version = int('0x' + Major + Minor, 0)\r
+ else:\r
EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",\r
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r
\r
"ISO_LANGUAGES",\r
"TIME_STAMP_FILE",\r
"VPD_TOOL_GUID",\r
- "FIX_LOAD_TOP_MEMORY_ADDRESS"\r
+ "FIX_LOAD_TOP_MEMORY_ADDRESS",\r
+ "PREBUILD",\r
+ "POSTBUILD"\r
]\r
\r
SubSectionDefineKeywords = [\r
File=self.MetaFile, Line=self._LineIndex + 1,\r
ExtraData=self._CurrentLine)\r
self._DirectiveStack.append((ItemType, self._LineIndex + 1, self._CurrentLine))\r
- elif self._From > 0:\r
- EdkLogger.error('Parser', FORMAT_INVALID,\r
- "No '!include' allowed in included file",\r
- ExtraData=self._CurrentLine, File=self.MetaFile,\r
- Line=self._LineIndex + 1)\r
\r
#\r
# Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,\r
Parser = DscParser(IncludedFile1, self._FileType, IncludedFileTable,\r
Owner=Owner, From=Owner)\r
\r
+ # Does not allow lower level included file to include upper level included file\r
+ if Parser._From != Owner and int(Owner) > int (Parser._From):\r
+ EdkLogger.error('parser', FILE_ALREADY_EXIST, File=self._FileWithError,\r
+ Line=self._LineIndex + 1, ExtraData="{0} is already included at a higher level.".format(IncludedFile1))\r
+\r
+\r
# set the parser status with current status\r
Parser._SectionName = self._SectionName\r
Parser._SectionType = self._SectionType\r
\r
ValList, Valid, Index = AnalyzeDscPcd(self._ValueList[2], self._ItemType)\r
if not Valid:\r
- EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect.", File=self._FileWithError, Line=self._LineIndex+1,\r
+ EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect.", File=self._FileWithError, Line=self._LineIndex + 1,\r
ExtraData="%s.%s|%s" % (self._ValueList[0], self._ValueList[1], self._ValueList[2]))\r
PcdValue = ValList[Index]\r
if PcdValue:\r