From nobody Thu May 2 21:50:05 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 Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1516600082790704.966517346032; Sun, 21 Jan 2018 21:48:02 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8603E2238B586; Sun, 21 Jan 2018 21:42:35 -0800 (PST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 8536922344357 for ; Sun, 21 Jan 2018 21:42:34 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jan 2018 21:47:59 -0800 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.129]) by FMSMGA003.fm.intel.com with ESMTP; 21 Jan 2018 21:47:59 -0800 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.120; helo=mga04.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.46,395,1511856000"; d="scan'208";a="21528267" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Mon, 22 Jan 2018 13:47:57 +0800 Message-Id: <1516600077-8784-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [edk2] [Patch] BaseTools: Add DefaultStore section format Check X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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" This patch add DefaultStore section format Check and it use same logic with SKUID section. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- BaseTools/Source/Python/Workspace/DscBuildData.py | 8 ++++++++ BaseTools/Source/Python/Workspace/MetaFileParser.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 752fe05..16fe608 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -606,10 +606,18 @@ class DscBuildData(PlatformBuildClassObject): EdkLogger.error('build', FORMAT_INVALID, 'No DefaultSt= ores ID number', File=3Dself.MetaFile, Line=3DRecord[-1= ]) if Record[1] in [None, '']: EdkLogger.error('build', FORMAT_INVALID, 'No DefaultSt= ores ID name', File=3Dself.MetaFile, Line=3DRecord[-1= ]) + Pattern =3D re.compile('^[1-9]\d*|0$') + HexPattern =3D re.compile(r'0[xX][0-9a-fA-F]+$') + if Pattern.match(Record[0]) =3D=3D None and HexPattern.mat= ch(Record[0]) =3D=3D None: + EdkLogger.error('build', FORMAT_INVALID, "The format o= f the DefaultStores ID number is invalid. It only support Integer and HexNu= mber", + File=3Dself.MetaFile, Line=3DRecord[-1= ]) + if not IsValidWord(Record[1]): + EdkLogger.error('build', FORMAT_INVALID, "The format o= f the DefaultStores ID name is invalid. The correct format is '(a-zA-Z0-9_)= (a-zA-Z0-9_-.)*'", + File=3Dself.MetaFile, Line=3DRecord[-1= ]) self.DefaultStores[Record[1].upper()] =3D (self.ToInt(Reco= rd[0]),Record[1].upper()) if TAB_DEFAULT_STORES_DEFAULT not in self.DefaultStores: self.DefaultStores[TAB_DEFAULT_STORES_DEFAULT] =3D (0,TAB_= DEFAULT_STORES_DEFAULT) GlobalData.gDefaultStores =3D self.DefaultStores.keys() if GlobalData.gDefaultStores: diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index e236732..202093a 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -1103,11 +1103,11 @@ class DscParser(MetaFileParser): self._ValueList[0:len(TokenList)] =3D TokenList @ParseMacro def _DefaultStoresParser(self): TokenList =3D GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) if len(TokenList) !=3D 2: - EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '= |'", + EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '= |'", ExtraData=3Dself._CurrentLine, File=3Dself.Met= aFile, Line=3Dself._LineIndex + 1) self._ValueList[0:len(TokenList)] =3D TokenList =20 ## Parse Edk style of library modules @ParseMacro --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel