From nobody Mon Apr 29 18:06:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1529887655915353.2044848670347; Sun, 24 Jun 2018 17:47:35 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 97E30209818D9; Sun, 24 Jun 2018 17:47:34 -0700 (PDT) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 81323208F79FF for ; Sun, 24 Jun 2018 17:47:32 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jun 2018 17:47:31 -0700 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.129]) by orsmga005.jf.intel.com with ESMTP; 24 Jun 2018 17:47:30 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,268,1526367600"; d="scan'208";a="235252021" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Mon, 25 Jun 2018 08:47:28 +0800 Message-Id: <1529887648-18624-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [edk2] [Patch] BaseTools: Fix parsing multiple nest !include issue X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yunhua Feng , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Yunhua Feng Case example: DSC components: !include Test1.txt Test1.txt: TestPkg/TestDriver.inf { PcdToken.PcdTest1 | "A" !include Test2.txt } Test2.txt: !include Test3.txt Test3.txt: PcdToken.PcdTest2 | "B" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- .../Source/Python/Workspace/MetaFileParser.py | 24 ++++++++----------= ---- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index 88c7bb3..f03b264 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -941,11 +941,14 @@ class DscParser(MetaFileParser): # subsection header elif Line[0] =3D=3D TAB_OPTION_START and Line[-1] =3D=3D TAB_O= PTION_END: self._SubsectionType =3D MODEL_META_DATA_SUBSECTION_HEADER # directive line elif Line[0] =3D=3D '!': - self._DirectiveParser() + for Arch, ModuleType, DefaultStore in self._Scope: + if self._SubsectionType !=3D MODEL_UNKNOWN and Arch in= OwnerId: + self._Owner[-1] =3D OwnerId[Arch] + self._DirectiveParser() continue if Line[0] =3D=3D TAB_OPTION_START and not self._InSubsection: EdkLogger.error("Parser", FILE_READ_FAILURE, "Missing the = '{' before %s in Line %s" % (Line, Index+1),ExtraData=3Dself.MetaFile) =20 if self._InSubsection: @@ -962,11 +965,11 @@ class DscParser(MetaFileParser): # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToIt= em=3D-1, BelongsToFile=3D-1, # LineBegin=3D-1, ColumnBegin=3D-1, LineEnd=3D-1, ColumnEnd=3D= -1, Enabled=3D-1 # for Arch, ModuleType, DefaultStore in self._Scope: Owner =3D self._Owner[-1] - if self._SubsectionType !=3D MODEL_UNKNOWN: + if self._SubsectionType !=3D MODEL_UNKNOWN and Arch in Own= erId: Owner =3D OwnerId[Arch] self._LastItem =3D self._Store( self._ItemType, self._ValueList[0], self._ValueList[1], @@ -1187,10 +1190,11 @@ class DscParser(MetaFileParser): @ParseMacro def _ComponentParser(self): if self._CurrentLine[-1] =3D=3D '{': self._ValueList[0] =3D self._CurrentLine[0:-1].strip() self._InSubsection =3D True + self._SubsectionType =3D MODEL_UNKNOWN else: self._ValueList[0] =3D self._CurrentLine =20 ## [LibraryClasses] section @ParseMacro @@ -1559,28 +1563,18 @@ class DscParser(MetaFileParser): =20 self.IncludedFiles.add (IncludedFile1) =20 # set the parser status with current status Parser._SectionName =3D self._SectionName - if self._InSubsection: - Parser._SectionType =3D self._SubsectionType - else: - Parser._SectionType =3D self._SectionType + Parser._SubsectionType =3D self._SubsectionType + Parser._InSubsection =3D self._InSubsection + Parser._SectionType =3D self._SectionType Parser._Scope =3D self._Scope Parser._Enabled =3D self._Enabled # Parse the included file Parser.Start() =20 - # update current status with sub-parser's status - self._SectionName =3D Parser._SectionName - if not self._InSubsection: - self._SectionType =3D Parser._SectionType - self._SubsectionType =3D Parser._SubsectionType - self._InSubsection =3D Parser._InSubsection - - self._Scope =3D Parser._Scope - self._Enabled =3D Parser._Enabled =20 # Insert all records in the table for the included file into d= sc file table Records =3D IncludedFileTable.GetAll() if Records: self._Content[self._ContentIndex:self._ContentIndex] =3D R= ecords --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel