From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web09.8084.1574750066605346392 for ; Mon, 25 Nov 2019 22:34:26 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: bob.c.feng@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Nov 2019 22:34:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,244,1571727600"; d="scan'208";a="408561557" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga005.fm.intel.com with ESMTP; 25 Nov 2019 22:34:22 -0800 Received: from fmsmsx161.amr.corp.intel.com (10.18.125.9) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 25 Nov 2019 22:34:22 -0800 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by FMSMSX161.amr.corp.intel.com (10.18.125.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 25 Nov 2019 22:34:21 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.127]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.215]) with mapi id 14.03.0439.000; Tue, 26 Nov 2019 14:34:19 +0800 From: "Bob Feng" To: =?iso-8859-1?Q?Philippe_Mathieu-Daud=E9?= , "devel@edk2.groups.io" CC: "Gao, Liming" , "Shi, Steven" Subject: Re: [edk2-devel] [Patch] GenBiosId: Enable GenBiosId to set timestamp as zero Thread-Topic: [edk2-devel] [Patch] GenBiosId: Enable GenBiosId to set timestamp as zero Thread-Index: AQHVo37mqDL3udmbPUSPv4oG5fzczaec/7Rg Date: Tue, 26 Nov 2019 06:34:19 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D16156C030@SHSMSX104.ccr.corp.intel.com> References: <20191125080506.37368-1-bob.c.feng@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I agree. Thanks for your comments. I'll update it in patch v2. -----Original Message----- From: Philippe Mathieu-Daud=E9 [mailto:philmd@redhat.com]=20 Sent: Monday, November 25, 2019 6:56 PM To: devel@edk2.groups.io; Feng, Bob C Cc: Gao, Liming ; Shi, Steven Subject: Re: [edk2-devel] [Patch] GenBiosId: Enable GenBiosId to set timest= amp as zero Hi Bob, On 11/25/19 9:05 AM, Bob Feng via Groups.Io wrote: > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2384 >=20 > We need eliminate the effect of timestamp to verify the reproducible=20 > build. >=20 > This patch is to add the support for GenBiosId to set timestamp as=20 > zero. >=20 > Cc: Liming Gao > Cc: Steven Shi > Signed-off-by: Bob Feng > --- > Platform/Intel/Tools/GenBiosId/GenBiosId.py | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) >=20 > diff --git a/Platform/Intel/Tools/GenBiosId/GenBiosId.py=20 > b/Platform/Intel/Tools/GenBiosId/GenBiosId.py > index 31abb24d31..1b25621104 100644 > --- a/Platform/Intel/Tools/GenBiosId/GenBiosId.py > +++ b/Platform/Intel/Tools/GenBiosId/GenBiosId.py > @@ -100,26 +100,28 @@ def MyOptionParser(): > parser.add_argument('-v', '--version', action=3D'version', version= =3D__version__, > help=3D"show program's version number and exit"= ) > parser.add_argument('-i', '--int', metavar=3D'FILENAME', dest=3D'In= putFile', help=3D"Input Config file") > parser.add_argument('-o', '--out', metavar=3D'FILENAME', dest=3D'Ou= tputFile', help=3D"Output file") > parser.add_argument('-ot', '--text', metavar=3D'FILENAME',=20 > dest=3D'OutputTextFile', help=3D"Output Text file") > + parser.add_argument('-NT', '--NoTimeStamp', dest=3D'NoTimestamp',=20 > + action=3D'store_true', default=3DFalse, help=3D"Set timestamp to zero") All other options are in lowercase, why use CamelCase here? Can we use '-nt= ', '--notimestamp' to keep the style? Two minor style comment below; except the style comments the patch looks go= od. > Options =3D parser.parse_args() > return Options > =20 > =20 > # Check the Tool for missing variables > def CheckOptions(Options): > - if len(sys.argv) !=3D 5 and not (len(sys.argv) =3D=3D 7 and Options.= OutputTextFile): > + if len(sys.argv) not in [5,6] and not (len(sys.argv) not in [7,8] an= d Options.OutputTextFile): > EdkLogger("GenBiosId", OPTION_MISSING, ExtraData=3D_Usage) > elif not Options.InputFile or not Options.OutputFile: > EdkLogger("GenBiosId", OPTION_MISSING, ExtraData=3D_Usage) > InputFile =3D Options.InputFile > OutputFile =3D Options.OutputFile > OutputTextFile =3D Options.OutputTextFile > + NoTimestamp =3D Options.NoTimestamp > if not os.path.exists(InputFile): > EdkLogger("GenBiosId", FILE_NOT_FOUND, ExtraData=3D"Input file = not found") > - return InputFile, OutputFile, OutputTextFile > + return InputFile, OutputFile, OutputTextFile,NoTimestamp Missing space before NoTimestamp. > =20 > # Read input file and get config > def ReadInputFile(InputFile): > InputDict =3D OrderedDict() > with open(InputFile) as File: > @@ -132,23 +134,25 @@ def ReadInputFile(InputFile): > InputDict[Key.strip()] =3D Value.strip() > return InputDict > =20 > =20 > # Parse the input file and extract the information -def=20 > ParserInputFile(InputDict): > +def ParserInputFile(InputDict,NoTimestamp): > for Item in InputDict: > if Item not in _ConfigItem: > EdkLogger("GenBiosId", FORMAT_INVALID, ExtraData=3D_ConfigI= temInvalid % Item) > _ConfigItem[Item]['Value'] =3D InputDict[Item] > if len(_ConfigItem[Item]['Value']) !=3D _ConfigItem[Item]['Leng= th']: > EdkLogger("GenBiosId", FORMAT_INVALID, ExtraData=3D_ConfigL= enInvalid % Item) > for Item in _ConfigItem: > if not _ConfigItem[Item]['Value']: > EdkLogger("GenBiosId", FORMAT_UNKNOWN_ERROR, ExtraData=3D"I= tem %s is missing" % Item) > utcnow =3D datetime.datetime.utcnow() > - TimeStamp =3D time.strftime("%y%m%d%H%M", utcnow.timetuple()) > - > + if NoTimestamp: > + TimeStamp =3D "\0\0\0\0\0\0\0\0\0\0" > + else: > + TimeStamp =3D time.strftime("%y%m%d%H%M", utcnow.timetuple()) > Id_Str =3D _ConfigItem['BOARD_ID']['Value'] + _ConfigItem['BOARD_RE= V']['Value'] + '.' + _ConfigItem['BOARD_EXT'][ > 'Value'] + '.' + _ConfigItem['VERSION_MAJOR']['Value'] + \ > '.' + _ConfigItem["BUILD_TYPE"]['Value'] + _ConfigItem['VE= RSION_MINOR']['Value'] + '.' + TimeStamp > return Id_Str > =20 > @@ -169,13 +173,13 @@ def PrintOutputFile(OutputFile, OutputTextFile, Id_= Str): > =20 > =20 > # Tool entrance method > def Main(): > Options =3D MyOptionParser() > - InputFile, OutputFile, OutputTextFile =3D CheckOptions(Options) > + InputFile, OutputFile, OutputTextFile,NoTimestamp =3D=20 > + CheckOptions(Options) Missing space before NoTimestamp. > InputDict =3D ReadInputFile(InputFile) > - Id_Str =3D ParserInputFile(InputDict) > + Id_Str =3D ParserInputFile(InputDict,NoTimestamp) > PrintOutputFile(OutputFile, OutputTextFile, Id_Str) > return 0 > =20 > =20 > if __name__ =3D=3D '__main__': >=20