From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 EC70C22333761 for ; Mon, 22 Jan 2018 17:55:52 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jan 2018 18:01:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,398,1511856000"; d="scan'208";a="23888728" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga004.fm.intel.com with ESMTP; 22 Jan 2018 18:01:19 -0800 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 22 Jan 2018 18:01:18 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 22 Jan 2018 18:01:18 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.152]) by shsmsx102.ccr.corp.intel.com ([169.254.2.189]) with mapi id 14.03.0319.002; Tue, 23 Jan 2018 10:01:16 +0800 From: "Gao, Liming" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch] BaseTools: update SKUID value to support both integer and Hex number Thread-Index: AQHTk0Nyj8bSJsfV0Uu4pDx6OS02EaOAtZDg Date: Tue, 23 Jan 2018 02:01:16 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1AA977@SHSMSX104.ccr.corp.intel.com> References: <1516599577-6864-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1516599577-6864-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools: update SKUID value to support both integer and Hex number 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: , X-List-Received-Date: Tue, 23 Jan 2018 01:55:53 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yo= nghong Zhu > Sent: Monday, January 22, 2018 1:40 PM > To: edk2-devel@lists.01.org > Subject: [edk2] [Patch] BaseTools: update SKUID value to support both int= eger and Hex number >=20 > This patch updated Skuid value to support both integer and hex value. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Yonghong Zhu > --- > BaseTools/Source/Python/Workspace/DscBuildData.py | 7 ++++--- > BaseTools/Source/Python/Workspace/MetaFileParser.py | 2 +- > 2 files changed, 5 insertions(+), 4 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTool= s/Source/Python/Workspace/DscBuildData.py > index 4a87fd1..752fe05 100644 > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py > @@ -580,17 +580,18 @@ class DscBuildData(PlatformBuildClassObject): > File=3Dself.MetaFile, Line=3DRecord[= -1]) > if Record[1] in [None, '']: > EdkLogger.error('build', FORMAT_INVALID, 'No Sku ID = name', > File=3Dself.MetaFile, Line=3DRecord[= -1]) > Pattern =3D re.compile('^[1-9]\d*|0$') > - if Pattern.match(Record[0]) =3D=3D None: > - EdkLogger.error('build', FORMAT_INVALID, "The format= of the Sku ID number is invalid. The correct format is > '{(0-9)} {(1-9)(0-9)+}'", > + HexPattern =3D re.compile(r'0[xX][0-9a-fA-F]+$') > + if Pattern.match(Record[0]) =3D=3D None and HexPattern.m= atch(Record[0]) =3D=3D None: > + EdkLogger.error('build', FORMAT_INVALID, "The format= of the Sku ID number is invalid. It only support > Integer and HexNumber", > File=3Dself.MetaFile, Line=3DRecord[= -1]) > if not IsValidWord(Record[1]): > EdkLogger.error('build', FORMAT_INVALID, "The format= of the Sku ID name is invalid. The correct format is > '(a-zA-Z0-9_)(a-zA-Z0-9_-.)*'", > File=3Dself.MetaFile, Line=3DRecord[= -1]) > - self._SkuIds[Record[1].upper()] =3D (Record[0], Record[1= ].upper(), Record[2].upper()) > + self._SkuIds[Record[1].upper()] =3D (str(self.ToInt(Reco= rd[0])), Record[1].upper(), Record[2].upper()) > if 'DEFAULT' not in self._SkuIds: > self._SkuIds['DEFAULT'] =3D ("0","DEFAULT","DEFAULT") > if 'COMMON' not in self._SkuIds: > self._SkuIds['COMMON'] =3D ("0","DEFAULT","DEFAULT") > return self._SkuIds > diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTo= ols/Source/Python/Workspace/MetaFileParser.py > index b2b0e28..e236732 100644 > --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py > +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py > @@ -1096,11 +1096,11 @@ class DscParser(MetaFileParser): >=20 > @ParseMacro > def _SkuIdParser(self): > TokenList =3D GetSplitValueList(self._CurrentLine, TAB_VALUE_SPL= IT) > if len(TokenList) not in (2,3): > - EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is= '|[|]'", > + EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is= '|[|]'", > ExtraData=3Dself._CurrentLine, File=3Dself.M= etaFile, Line=3Dself._LineIndex + 1) > self._ValueList[0:len(TokenList)] =3D TokenList > @ParseMacro > def _DefaultStoresParser(self): > TokenList =3D GetSplitValueList(self._CurrentLine, TAB_VALUE_SPL= IT) > -- > 2.6.1.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel