From nobody Wed May 15 21:01:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+87732+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87732+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1647583831; cv=none; d=zohomail.com; s=zohoarc; b=Le2Ki8r3OQBPrdTQA7bQc61iNxwXH2IkzjkLINWV29pcXtk9Ptm96nfHlMMmTGBK2K4lF+/cEL1E2oUGLB8JZN8KcTtpzs0ihDi0oWcGqPUICOrgT4gYXJn2U/VCGDz0XiOTJXq91EexwXHWPGfax6v9CQbhQ3+pGm6Jm8O0JsY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647583831; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=KvaqVVddZV7FIJE43p8o6uv9OgKybzboziIoaFDwZM8=; b=NN71Js7xwQ65gw7RVMx7tJO1YK1cx+ENQg1VCfUR9qP3vbM9JesRGUTEARvPizdruFcfNNJdlTgibcEIgme157yYpXo6w9yCzRRh5pqrYUsbl53tB/8ww/vi7qiOCi8cx/Yk3uWiV9O+06Jt5nl8EBh9Ifae+FADatezxwhZrBI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87732+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1647583831457797.4317516787997; Thu, 17 Mar 2022 23:10:31 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id eDVoYY1788612xQBukBQ2KH1; Thu, 17 Mar 2022 23:10:30 -0700 X-Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mx.groups.io with SMTP id smtpd.web09.6658.1647583828713755353 for ; Thu, 17 Mar 2022 23:10:29 -0700 X-Received: from kwepemi100005.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KKYXJ2bBVzcb4h; Fri, 18 Mar 2022 14:10:24 +0800 (CST) X-Received: from kwepemm600004.china.huawei.com (7.193.23.242) by kwepemi100005.china.huawei.com (7.221.188.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 18 Mar 2022 14:10:26 +0800 X-Received: from kwephisprg16640.huawei.com (10.247.83.252) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 18 Mar 2022 14:10:25 +0800 From: "wenyi,xie via groups.io" To: , , , CC: , Subject: [edk2-devel] [PATCH EDK2 v1 1/1] BaseTools:Support decimal version number in ECC check Date: Fri, 18 Mar 2022 14:09:24 +0800 Message-ID: <20220318060924.480865-2-xiewenyi2@huawei.com> In-Reply-To: <20220318060924.480865-1-xiewenyi2@huawei.com> References: <20220318060924.480865-1-xiewenyi2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.247.83.252] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,xiewenyi2@huawei.com X-Gm-Message-State: zQqTg7wpr0Jg2IF6n51P3H2Nx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1647583830; bh=Gfima37Ygpj+xvkDJYiyfI80yoerqQ4yTQ09ppjkqOw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=RHzkMVQ5COs+dcH6LPxzwrKVqaj0UAXWRmMwQjNGzmSmDEHsWxPp5ZlmbZUpA1oox65 4zUCQmYOETJxlyEU87ewYjprgJuSvUjm9hEuwHs95yJFxiyJOwS+xEQL5bA7+02R3hrnV q5n/ePD2Ns4oqEc9iU7AlXRpaK64/0RNC1A= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1647583832481100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3872 When doing ecc inf version check, the decimal type version number like 1.27 is treated as invalid version. So the code should be updated to support decimal type version number. Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Signed-off-by: Wenyi Xie Reviewed-by: Bob Feng --- BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py | 18 +++++= ++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.p= y b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py index 9c27c8e16a05..2d98ac5eadb2 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py @@ -31,6 +31,10 @@ from GenFds.FdfParser import FdfParser from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import CodecOpenLongFilePath =20 +## RegEx for finding file versions +hexVersionPattern =3D re.compile(r'0[xX][\da-f-A-F]{5,8}') +decVersionPattern =3D re.compile(r'\d+\.\d+') + ## A decorator used to parse macro definition def ParseMacro(Parser): def MacroParser(self): @@ -331,11 +335,19 @@ class MetaFileParser(object): Name, Value =3D self._ValueList[1], self._ValueList[2] # Sometimes, we need to make differences between EDK and EDK2 modu= les if Name =3D=3D 'INF_VERSION': - try: + if hexVersionPattern.match(Value): self._Version =3D int(Value, 0) - except: + elif decVersionPattern.match(Value): + ValueList =3D Value.split('.') + Major =3D int(ValueList[0], 0) + Minor =3D int(ValueList[1], 0) + if Major > 0xffff or Minor > 0xffff: + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid ver= sion number", + ExtraData=3Dself._CurrentLine, File=3D= self.MetaFile, Line=3Dself._LineIndex + 1) + self._Version =3D int('0x{0:04x}{1:04x}'.format(Major, Min= or), 0) + else: EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version= number", - ExtraData=3Dself._CurrentLine, File=3Dself= .MetaFile, Line=3Dself._LineIndex+1) + ExtraData=3Dself._CurrentLine, File=3Dself= .MetaFile, Line=3Dself._LineIndex + 1) elif Name =3D=3D 'MODULE_UNI_FILE': UniFile =3D os.path.join(os.path.dirname(self.MetaFile), Value) if os.path.exists(UniFile): --=20 2.20.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87732): https://edk2.groups.io/g/devel/message/87732 Mute This Topic: https://groups.io/mt/89862756/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-