From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web10.5078.1609853267232975329 for ; Tue, 05 Jan 2021 05:27:48 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([101.86.139.221]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Tue, 05 Jan 2021 21:27:43 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: "'Feng, Bob C'" , Cc: "'Chen, Christine'" , "'Liang, MingyueX'" References: <20201229121457.1066-1-bob.c.feng@intel.com> <000601d6e233$a6f5e2b0$f4e1a810$@byosoft.com.cn> <006301d6e274$007e01b0$017a0510$@byosoft.com.cn> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0g5Zue5aSNOiBbUGF0Y2ggMS8xXSBCYXNlVG9vbHM6IEZpeCB0aGUgaXNzdWUgY2F1c2VkIGJ5IHRvc3RyaW5nKCkgcmVtb3ZhbCBvbiBQeTM5?= Date: Tue, 5 Jan 2021 21:27:44 +0800 Message-ID: <013701d6e366$8d0a2530$a71e6f90$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQI0bIdVb7LpHYzyYhnCX6THhLH7mgKoK6vkAfO3WJ4BeVebigJGWNx6qRsW86A= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Bob: I agree its impact is not big. If no better solution, I am OK for this f= ix. Reviewed-by: Liming Gao Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: Feng, Bob C > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2021=E5=B9=B41=E6=9C=885=E6=97=A5 = 17:10 > =E6=94=B6=E4=BB=B6=E4=BA=BA: gaoliming ; devel= @edk2.groups.io > =E6=8A=84=E9=80=81: Chen, Christine ; Liang, Mingy= ueX > > =E4=B8=BB=E9=A2=98: RE: [edk2-devel] =E5=9B=9E=E5=A4=8D: [Patch 1/1] Bas= eTools: Fix the issue caused by > tostring() removal on Py39 >=20 > Hi Liming, >=20 > The method in this patch is just to avoid converting the SectionData to = a bytes > string because there is no compatible way to generate a bytes string fro= m a > array.array. > So I can't do the bytes strings comparison between the new content and t= he > content in the existing file. >=20 > Since the this block of code will only run in GenFds phase, the effect o= f the > incremental save is small, I think it can be fine to save the new conte= nt > anyway. >=20 > Thanks, > Bob >=20 > -----Original Message----- > From: gaoliming > Sent: Monday, January 4, 2021 4:32 PM > To: Feng, Bob C ; devel@edk2.groups.io > Cc: Chen, Christine ; Liang, MingyueX > > Subject: =E5=9B=9E=E5=A4=8D: [edk2-devel] =E5=9B=9E=E5=A4=8D: [Patch 1/1= ] BaseTools: Fix the issue > caused by tostring() removal on Py39 >=20 > Original SaveFileOnChange() saves the file only when the file is updated= . Can > this patch keep the same behavior? >=20 > Thanks > Liming > > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > > =E5=8F=91=E4=BB=B6=E4=BA=BA: Feng, Bob C > > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2021=E5=B9=B41=E6=9C=884=E6=97= =A5 10:27 > > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io; gaoliming@byosoft.c= om.cn > > =E6=8A=84=E9=80=81: Chen, Christine ; Liang, Min= gyueX > > > > =E4=B8=BB=E9=A2=98: RE: [edk2-devel] =E5=9B=9E=E5=A4=8D: [Patch 1/1] B= aseTools: Fix the issue caused > > by > > tostring() removal on Py39 > > > > Yes. it will always update .ui file. > > > > Thanks, > > Bob > > > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of > > gaoliming > > Sent: Monday, January 4, 2021 8:51 AM > > To: Feng, Bob C ; devel@edk2.groups.io > > Cc: Chen, Christine ; Liang, MingyueX > > > > Subject: [edk2-devel] =E5=9B=9E=E5=A4=8D: [Patch 1/1] BaseTools: Fix t= he issue caused > > by > > tostring() removal on Py39 > > > > Bob: > > > > > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > > > =E5=8F=91=E4=BB=B6=E4=BA=BA: Bob Feng > > > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2020=E5=B9=B412=E6=9C=8829=E6= =97=A5 20:15 > > > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io > > > =E6=8A=84=E9=80=81: Liming Gao ; Yuwei Che= n > > > ; Mingyue Liang > > > =E4=B8=BB=E9=A2=98: [Patch 1/1] BaseTools: Fix the issue caused by t= ostring() > > > removal on > > > Py39 > > > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3136 > > > > > > Python 3.9 remove the array.array.tostring and > > > array.array.fromstring() function. This patch is to use other method > > > to replace tostring() and > > > fromstring() > > > > > > Signed-off-by: Bob Feng > > > > > > Cc: Liming Gao > > > Cc: Yuwei Chen > > > Cc: Mingyue Liang > > > --- > > > .../Python/GenFds/GenFdsGlobalVariable.py | 23 > > > ++++++++++++++++--- > > > 1 file changed, 20 insertions(+), 3 deletions(-) > > > > > > diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > > b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > > index dc1727c4666d..3019ec63c3bb 100644 > > > --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > > +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > > @@ -25,14 +25,15 @@ from Common.Misc import SaveFileOnChange > > > > > > from Common.TargetTxtClassObject import TargetTxtDict from > > > Common.ToolDefClassObject import ToolDefDict from > > AutoGen.BuildEngine > > > import ToolBuildRule import Common.DataType as DataType -from > > > Common.Misc import PathClass > > > +from Common.Misc import PathClass,CreateDirectory > > > from Common.LongFilePathSupport import OpenLongFilePath as open > > from > > > Common.MultipleWorkspace import MultipleWorkspace as mws import > > > Common.GlobalData as GlobalData > > > +from Common.BuildToolError import * > > > > > > ## Global variables > > > # > > > # > > > class GenFdsGlobalVariable: > > > @@ -461,16 +462,32 @@ class GenFdsGlobalVariable: > > > Cmd +=3D ("-o", Output) > > > if ' '.join(Cmd).strip() not in > > > GenFdsGlobalVariable.SecCmdList: > > > GenFdsGlobalVariable.SecCmdList.append(' > > > '.join(Cmd).strip()) > > > else: > > > SectionData =3D array('B', [0, 0, 0, 0]) > > > - SectionData.fromstring(Ui.encode("utf_16_le")) > > > + > > > SectionData.fromlist(array('B',Ui.encode('utf-16-le')).tolist()) > > > SectionData.append(0) > > > SectionData.append(0) > > > Len =3D len(SectionData) > > > > > > GenFdsGlobalVariable.SectionHeader.pack_into(SectionData, 0, Len & > > > 0xff, (Len >> 8) & 0xff, (Len >> 16) & 0xff, 0x15) > > > - SaveFileOnChange(Output, SectionData.tostring()) > > > + > > > + > > > + DirName =3D os.path.dirname(Output) > > > + if not CreateDirectory(DirName): > > > + EdkLogger.error(None, FILE_CREATE_FAILURE, > > > "Could not create directory %s" % DirName) > > > + else: > > > + if DirName =3D=3D '': > > > + DirName =3D os.getcwd() > > > + if not os.access(DirName, os.W_OK): > > > + EdkLogger.error(None, > > PERMISSION_FAILURE, > > > "Do not have write permission on directory %s" % DirName) > > > + > > > + try: > > > + with open(Output, "wb") as Fd: > > > + SectionData.tofile(Fd) > > > + Fd.flush() > > > + except IOError as X: > > > + EdkLogger.error(None, FILE_CREATE_FAILURE, > > > ExtraData=3D'IOError %s' % X) > > > > Does this change always update the file time stamp even if the file > > content is not changed? > > > > Thanks > > Liming > > > > > > elif Ver: > > > Cmd +=3D ("-n", Ver) > > > if BuildNumber: > > > Cmd +=3D ("-j", BuildNumber) > > > -- > > > 2.29.1.windows.1 > > > > > > > > > > > >=20 > > >=20 >=20