summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/Workspace/MetaFileParser.py
diff options
context:
space:
mode:
authorCecil Sheng <cecil.sheng@hp.com>2015-08-26 06:28:59 +0000
committeryingke <yingke@Edk2>2015-08-26 06:28:59 +0000
commit118bf0960c203f25f08b5c02000cade5149ac8eb (patch)
tree8d029418115bfbe7f97fecf316a6bc7174fb5156 /BaseTools/Source/Python/Workspace/MetaFileParser.py
parent5ca29abe529794c1c2a2663378b0719e902c1077 (diff)
downloadedk2-platforms-118bf0960c203f25f08b5c02000cade5149ac8eb.tar.xz
BaseTools: Nested !include support in DSC and FDF files
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Cecil Sheng <cecil.sheng@hp.com> Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hp.com> Reviewed-by: Yingke Liu <yingke.d.liu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18317 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/Workspace/MetaFileParser.py')
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index eb02b664a6..fe1f7fd6f6 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -2,6 +2,7 @@
# This file is used to parse meta files
#
# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.<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
@@ -1010,11 +1011,6 @@ class DscParser(MetaFileParser):
File=self.MetaFile, Line=self._LineIndex + 1,
ExtraData=self._CurrentLine)
self._DirectiveStack.append((ItemType, self._LineIndex + 1, self._CurrentLine))
- elif self._From > 0:
- EdkLogger.error('Parser', FORMAT_INVALID,
- "No '!include' allowed in included file",
- ExtraData=self._CurrentLine, File=self.MetaFile,
- Line=self._LineIndex + 1)
#
# Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,
@@ -1479,6 +1475,12 @@ class DscParser(MetaFileParser):
Parser = DscParser(IncludedFile1, self._FileType, IncludedFileTable,
Owner=Owner, From=Owner)
+ # Does not allow lower level included file to include upper level included file
+ if Parser._From != Owner and int(Owner) > int (Parser._From):
+ EdkLogger.error('parser', FILE_ALREADY_EXIST, File=self._FileWithError,
+ Line=self._LineIndex + 1, ExtraData="{0} is already included at a higher level.".format(IncludedFile1))
+
+
# set the parser status with current status
Parser._SectionName = self._SectionName
Parser._SectionType = self._SectionType