From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by mx.groups.io with SMTP id smtpd.web10.425.1689263770519484015 for ; Thu, 13 Jul 2023 08:56:10 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@bsdio.com header.s=fm1 header.b=JOBC3wfV; spf=pass (domain: bsdio.com, ip: 66.111.4.28, mailfrom: rebecca@bsdio.com) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id C2C285C005B; Thu, 13 Jul 2023 11:56:09 -0400 (EDT) Received: from imap43 ([10.202.2.93]) by compute5.internal (MEProxy); Thu, 13 Jul 2023 11:56:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdio.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1689263769; x=1689350169; bh=TH5bsjGiBUAZJdYDN1Pt53kQt2u/EdmrXd9 3iHXXie4=; b=JOBC3wfV1FhR7UXUjtH5xCSuS0a14YLhllXdpqx4majkFhxMesY D2PqSlS89CkbWytywRp+pXgluAwRr5+pZqE60o9mLun4XLSAxi2nbrkiex16hhzu JjZ5uCd5DNbpx4t97lbBakTLuDj0Pr/0u7WcfMLHXFG7fqILCzAVi+S5gmqBXEPT msosqZ7j6I4qHoETN4FqTST8rn7EDRcRQ8hGJkmY3gniZM7Lyy9p8hpmwJnpcmF8 AqAC5F0L1KBEKMET2joStGuJAm4AVVdn3WWE0p4hhc79oYnIUL3CqJ8isTMyF4RG DYwLdHKhgOFl3RN7MXc0rxwo9zFmbWLF89A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1689263769; x=1689350169; bh=TH5bsjGiBUAZJdYDN1Pt53kQt2u/EdmrXd9 3iHXXie4=; b=mKZgCWbeAFwcQaxkRHcMK6+d5alBCFa0Xpqjs+jFMo4ehA9o4vN FeDn4c6MlVeU0DFjcWx8dwL9IIWBBaZswGoaSRgpNomEkj7+Cg/xKmrhgxVQ4Pkc N869r30uVUX5qISywcCNi5n3kJEs1xrt/XLjXSsVol+vb7ixduNz4BQNKKoe393X JwdS2VBEEdyfV9tSfyNNVbwVkfb7z0652NZNOLD5IpNzi+iH4go/yVBgOT5gZSEz 8SNoeqX9i6nkdg91YlsIKw6XPd9GYb0JrR7Z5ihqPOINCPZsIjKolbEDGaf30NlT EHLL8bZRYJDStL3eeBk489Y4Nz2XtTfpkew== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrfeeggdelgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedftfgv sggvtggtrgcuvehrrghnfdcuoehrvggsvggttggrsegsshguihhordgtohhmqeenucggtf frrghtthgvrhhnpedthefgkeehjeeukeefhffhffetveffkeejheffjefhieejteegiefh kefgtedutdenucffohhmrghinhepghhrohhuphhsrdhiohenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrvggsvggttggrsegsshguihhordgt ohhm X-ME-Proxy: Feedback-ID: i5b994698:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id C45E62D4008E; Thu, 13 Jul 2023 11:56:08 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-531-gfdfa13a06d-fm-20230703.001-gfdfa13a0 Mime-Version: 1.0 Message-Id: <3c26dbf7-c177-4d42-8a8c-c26c0becba1f@app.fastmail.com> In-Reply-To: References: <20230627162722.1030-1-joey.vagedes@gmail.com> <20230627162722.1030-2-joey.vagedes@gmail.com> Date: Thu, 13 Jul 2023 09:56:07 -0600 From: "Rebecca Cran" To: devel@edk2.groups.io, joeyvagedes@microsoft.com, "Kinney, Michael D" Cc: gaoliming , "'Bob Feng'" , "'Yuwei Chen'" Subject: Re: [edk2-devel] [PATCH v1 1/1] BaseTools: BinToPcd: Resolve xdrlib deprecation Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Sorry I haven=E2=80=99t had a chance to look at it. I=E2=80=99ll try and fi= nd some time this weekend. On Thu, Jul 13, 2023, at 9:26 AM, Joey Vagedes via groups.io wrote: > Thank you for the review Michael. @Rebecca Cran=20 > , @Liming Gao=20 > have you had time to take a look at=20 > this? It is a fairly simple change, following the same logic as xdrlib=20 > with a few modifications to use some newer python functionality. > > Thanks, > Joey > > On Tue, Jun 27, 2023 at 10:21=E2=80=AFAM Kinney, Michael D=20 > wrote: >> Thank you for fixing this. >>=20 >> Reviewed-by: Michael D Kinney >>=20 >> > -----Original Message----- >> > From: Joey Vagedes >> > Sent: Tuesday, June 27, 2023 9:27 AM >> > To: devel@edk2.groups.io >> > Cc: Rebecca Cran ; Gao, Liming >> > ; Feng, Bob C ; Chen, >> > Christine ; Kinney, Michael D >> > >> > Subject: [PATCH v1 1/1] BaseTools: BinToPcd: Resolve xdrlib deprecatio= n >> >=20 >> > Removes the dependency on xdrlib and replaces it with custom logic to >> > pack a per the xdr requirements. Necessary as xdrlib is being deprecat= ed >> > in python 3.13. >> >=20 >> > Cc: Rebecca Cran >> > Cc: Liming Gao >> > Cc: Bob Feng >> > Cc: Yuwei Chen >> > Cc: Michael D Kinney >> > Signed-off-by: Joey Vagedes >> > --- >> > BaseTools/Scripts/BinToPcd.py | 19 +++++++++++++++---- >> > 1 file changed, 15 insertions(+), 4 deletions(-) >> >=20 >> > diff --git a/BaseTools/Scripts/BinToPcd.py b/BaseTools/Scripts/BinToPc= d.py >> > index 3bc557b8412c..460c08b7f7cd 100644 >> > --- a/BaseTools/Scripts/BinToPcd.py >> > +++ b/BaseTools/Scripts/BinToPcd.py >> > @@ -14,6 +14,9 @@ import sys >> > import argparse >> >=20 >> > import re >> >=20 >> > import xdrlib >> >=20 >> > +import io >> >=20 >> > +import struct >> >=20 >> > +import math >> >=20 >> >=20 >> >=20 >> > # >> >=20 >> > # Globals for help information >> >=20 >> > @@ -46,16 +49,24 @@ if __name__ =3D=3D '__main__': >> > raise argparse.ArgumentTypeError (Message) >> >=20 >> > return Argument >> >=20 >> >=20 >> >=20 >> > + def XdrPackBuffer (buffer): >> >=20 >> > + packed_bytes =3D io.BytesIO() >> >=20 >> > + for unpacked_bytes in buffer: >> >=20 >> > + n =3D len(unpacked_bytes) >> >=20 >> > + packed_bytes.write(struct.pack('>L',n)) >> >=20 >> > + data =3D unpacked_bytes[:n] >> >=20 >> > + n =3D math.ceil(n/4)*4 >> >=20 >> > + data =3D data + (n - len(data)) * b'\0' >> >=20 >> > + packed_bytes.write(data) >> >=20 >> > + return packed_bytes.getvalue() >> >=20 >> > + >> >=20 >> > def ByteArray (Buffer, Xdr =3D False): >> >=20 >> > if Xdr: >> >=20 >> > # >> >=20 >> > # If Xdr flag is set then encode data using the Variable- >> > Length Opaque >> >=20 >> > # Data format of RFC 4506 External Data Representation >> > Standard (XDR). >> >=20 >> > # >> >=20 >> > - XdrEncoder =3D xdrlib.Packer () >> >=20 >> > - for Item in Buffer: >> >=20 >> > - XdrEncoder.pack_bytes (Item) >> >=20 >> > - Buffer =3D bytearray (XdrEncoder.get_buffer ()) >> >=20 >> > + Buffer =3D bytearray (XdrPackBuffer (Buffer)) >> >=20 >> > else: >> >=20 >> > # >> >=20 >> > # If Xdr flag is not set, then concatenate all the data >> >=20 >> > -- >> > 2.41.0.windows.1 >>=20 >=20