From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web09.797.1575444895685222846 for ; Tue, 03 Dec 2019 23:34:55 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: bob.c.feng@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2019 23:34:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,276,1571727600"; d="scan'208";a="412486845" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga006.fm.intel.com with ESMTP; 03 Dec 2019 23:34:55 -0800 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 3 Dec 2019 23:34:55 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 3 Dec 2019 23:34:54 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.90]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.222]) with mapi id 14.03.0439.000; Wed, 4 Dec 2019 15:34:53 +0800 From: "Bob Feng" To: "Fan, ZhijuX" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [PATCH] BaseTools:Enhance the way to handling included dsc file Thread-Topic: [PATCH] BaseTools:Enhance the way to handling included dsc file Thread-Index: AdWpuKZqHHRpiPmTQ1SghliWTUMOcQAvJ1pg Date: Wed, 4 Dec 2019 07:34:52 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D16157B1C8@SHSMSX104.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng -----Original Message----- From: Fan, ZhijuX=20 Sent: Tuesday, December 3, 2019 5:04 PM To: devel@edk2.groups.io Cc: Gao, Liming ; Feng, Bob C Subject: [PATCH] BaseTools:Enhance the way to handling included dsc file BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2400 In Dsc Parser, included dsc file is parsed always no matter if its conditio= n is False gUefiOvmfPkgTokenSpaceGuid.test1|FALSE !if gUefiOvmfPkgTokenSpaceGuid.test1 =3D=3D FALSE !include OvmfPkg/test1.dsc !else !include OvmfPkg/test2.dsc !endif In the above case, since the conditional result is FALSE, "test2.dsc" is no= t parsed. The patch avoids processing redundant dsc files and improves the way Tool h= andles them. Cc: Liming Gao Cc: Bob Feng Signed-off-by: Zhiju.Fan --- .../Source/Python/Workspace/MetaFileParser.py | 79 +++++++++++-------= ---- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index 8a665b118e..a3b6edbd15 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -1612,46 +1612,47 @@ class DscParser(MetaFileParser): # First search the include file under the same directory as DS= C file # IncludedFile1 =3D PathClass(IncludedFile, self.MetaFile.Dir) - ErrorCode, ErrorInfo1 =3D IncludedFile1.Validate() - if ErrorCode !=3D 0: - # - # Also search file under the WORKSPACE directory - # - IncludedFile1 =3D PathClass(IncludedFile, GlobalData.gWork= space) - ErrorCode, ErrorInfo2 =3D IncludedFile1.Validate() + if self._Enabled: + ErrorCode, ErrorInfo1 =3D IncludedFile1.Validate() if ErrorCode !=3D 0: - EdkLogger.error('parser', ErrorCode, File=3Dself._File= WithError, - Line=3Dself._LineIndex + 1, ExtraData= =3DErrorInfo1 + "\n" + ErrorInfo2) - - self._FileWithError =3D IncludedFile1 - - FromItem =3D self._Content[self._ContentIndex - 1][0] - if self._InSubsection: - Owner =3D self._Content[self._ContentIndex - 1][8] - else: - Owner =3D self._Content[self._ContentIndex - 1][0] - IncludedFileTable =3D MetaFileStorage(self._RawTable.DB, Inclu= dedFile1, MODEL_FILE_DSC, False, FromItem=3DFromItem) - Parser =3D DscParser(IncludedFile1, self._FileType, self._Arch= , IncludedFileTable, - Owner=3DOwner, From=3DFromItem) - - self.IncludedFiles.add (IncludedFile1) - - # set the parser status with current status - Parser._SectionName =3D self._SectionName - 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.StartParse() - # 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 - self._Content.pop(self._ContentIndex - 1) - self._ValueList =3D None - self._ContentIndex -=3D 1 + # + # Also search file under the WORKSPACE directory + # + IncludedFile1 =3D PathClass(IncludedFile, GlobalData.g= Workspace) + ErrorCode, ErrorInfo2 =3D IncludedFile1.Validate() + if ErrorCode !=3D 0: + EdkLogger.error('parser', ErrorCode, File=3Dself._= FileWithError, + Line=3Dself._LineIndex + 1,=20 + ExtraData=3DErrorInfo1 + "\n" + ErrorInfo2) + + self._FileWithError =3D IncludedFile1 + + FromItem =3D self._Content[self._ContentIndex - 1][0] + if self._InSubsection: + Owner =3D self._Content[self._ContentIndex - 1][8] + else: + Owner =3D self._Content[self._ContentIndex - 1][0] + IncludedFileTable =3D MetaFileStorage(self._RawTable.DB, I= ncludedFile1, MODEL_FILE_DSC, False, FromItem=3DFromItem) + Parser =3D DscParser(IncludedFile1, self._FileType, self._= Arch, IncludedFileTable, + Owner=3DOwner, From=3DFromItem) + + self.IncludedFiles.add (IncludedFile1) + + # set the parser status with current status + Parser._SectionName =3D self._SectionName + 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.StartParse() + # Insert all records in the table for the included file in= to dsc file table + Records =3D IncludedFileTable.GetAll() + if Records: + self._Content[self._ContentIndex:self._ContentIndex] = =3D Records + self._Content.pop(self._ContentIndex - 1) + self._ValueList =3D None + self._ContentIndex -=3D 1 =20 def __ProcessPackages(self): self._ValueList[0] =3D ReplaceMacro(self._ValueList[0], self._Macr= os) -- 2.14.1.windows.1