From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 1628E21A00AC5 for ; Fri, 23 Jun 2017 00:51:34 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP; 23 Jun 2017 00:52:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,377,1493708400"; d="scan'208";a="1186097113" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 23 Jun 2017 00:52:42 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 23 Jun 2017 00:52:42 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 23 Jun 2017 00:52:41 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.146]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.56]) with mapi id 14.03.0319.002; Fri, 23 Jun 2017 15:52:38 +0800 From: "Gao, Liming" To: "Gao, Liming" , "Zhu, Yonghong" , "edk2-devel@lists.01.org" CC: "Feng, YunhuaX" Thread-Topic: [Patch] BaseTools: Enhance DEC Defines section format check Thread-Index: AQHS6y8IVGiJkbnRIkKR18LB/FAc5KIyFI4AgAAAQTA= Date: Fri, 23 Jun 2017 07:52:37 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D74DEAD@shsmsx102.ccr.corp.intel.com> References: <1498119023-8276-1-git-send-email-yonghong.zhu@intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14D74DE97@shsmsx102.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14D74DE97@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools: Enhance DEC Defines section format check X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jun 2017 07:51:34 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Please ignore the previous mail. It is my mistake. For this patch, Reviewed-by: Liming Gao >-----Original Message----- >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Gao= , >Liming >Sent: Friday, June 23, 2017 3:51 PM >To: Zhu, Yonghong ; edk2-devel@lists.01.org >Cc: Feng, YunhuaX >Subject: Re: [edk2] [Patch] BaseTools: Enhance DEC Defines section format >check > >c:\r9tip\allpkg\edk2\mdemodulepkg\universal\pcd\pei\Service.h > >>-----Original Message----- >>From: Zhu, Yonghong >>Sent: Thursday, June 22, 2017 4:10 PM >>To: edk2-devel@lists.01.org >>Cc: Feng, YunhuaX ; Gao, Liming >> >>Subject: [Patch] BaseTools: Enhance DEC Defines section format check >> >>From: Yunhua Feng >> >>1. break if Dec Defines Section is missing >>2. break if Dec have more than one Defines Section >>3. break if Dec Defines Section have arch attribute >>4. break if no section head, like as: >>#[Defines] >> DEC_SPECIFICATION =3D 0x00010005 >> PACKAGE_NAME =3D Nt32Pkg >> >>Cc: Liming Gao >>Cc: Yonghong Zhu >>Contributed-under: TianoCore Contribution Agreement 1.0 >>Signed-off-by: Yunhua Feng >>--- >> BaseTools/Source/Python/Workspace/MetaFileParser.py | 15 >>+++++++++++++++ >> 1 file changed, 15 insertions(+) >> >>diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py >>b/BaseTools/Source/Python/Workspace/MetaFileParser.py >>index d094403..6e236e6 100644 >>--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py >>+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py >>@@ -1654,10 +1654,11 @@ class DecParser(MetaFileParser): >> try: >> Content =3D open(str(self.MetaFile), 'r').readlines() >> except: >> EdkLogger.error("Parser", FILE_READ_FAILURE, >>ExtraData=3Dself.MetaFile) >> >>+ self._DefinesCount =3D 0 >> for Index in range(0, len(Content)): >> Line, Comment =3D CleanString2(Content[Index]) >> self._CurrentLine =3D Line >> self._LineIndex =3D Index >> >>@@ -1669,12 +1670,19 @@ class DecParser(MetaFileParser): >> continue >> >> # section header >> if Line[0] =3D=3D TAB_SECTION_START and Line[-1] =3D=3D TAB_= SECTION_END: >> self._SectionHeaderParser() >>+ if self._SectionName =3D=3D TAB_DEC_DEFINES.upper(): >>+ self._DefinesCount +=3D 1 >> self._Comments =3D [] >> continue >>+ if self._SectionType =3D=3D MODEL_UNKNOWN: >>+ EdkLogger.error("Parser", FORMAT_INVALID, >>+ "" >>+ "Not able to determine \"%s\" in which >>section."%self._CurrentLine, >>+ self.MetaFile, self._LineIndex + 1) >> elif len(self._SectionType) =3D=3D 0: >> self._Comments =3D [] >> continue >> >> # section content >>@@ -1718,10 +1726,14 @@ class DecParser(MetaFileParser): >> LineNo, >> - 1, >> 0 >> ) >> self._Comments =3D [] >>+ if self._DefinesCount > 1: >>+ EdkLogger.error('Parser', FORMAT_INVALID, 'Multiple [Defines= ] >>section is exist.', self.MetaFile ) >>+ if self._DefinesCount =3D=3D 0: >>+ EdkLogger.error('Parser', FORMAT_INVALID, 'No [Defines] sect= ion >>exist.',self.MetaFile) >> self._Done() >> >> >> ## Section header parser >> # >>@@ -1743,10 +1755,13 @@ class DecParser(MetaFileParser): >> self.MetaFile, self._LineIndex + 1, self= ._CurrentLine) >> ItemList =3D Item.split(TAB_SPLIT) >> >> # different types of PCD are permissible in one section >> self._SectionName =3D ItemList[0].upper() >>+ if self._SectionName =3D=3D TAB_DEC_DEFINES.upper() and >(len(ItemList) > >>1 or len(Line.split(TAB_COMMA_SPLIT)) > 1): >>+ EdkLogger.error("Parser", FORMAT_INVALID, "Defines secti= on >>format is invalid", >>+ self.MetaFile, self._LineIndex + 1, self= ._CurrentLine) >> if self._SectionName in self.DataType: >> if self.DataType[self._SectionName] not in self._Section= Type: >> self._SectionType.append(self.DataType[self._Section= Name]) >> else: >> EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is n= ot >a >>valid section name" % Item, >>-- >>2.6.1.windows.1 > >_______________________________________________ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel