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.web11.3122.1575359910081285680 for ; Mon, 02 Dec 2019 23:58:30 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: liming.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Dec 2019 23:58:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,272,1571727600"; d="scan'208";a="213335842" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga003.jf.intel.com with ESMTP; 02 Dec 2019 23:58:29 -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, 2 Dec 2019 23:58:28 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX161.amr.corp.intel.com (10.18.125.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 2 Dec 2019 23:58:28 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.90]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.29]) with mapi id 14.03.0439.000; Tue, 3 Dec 2019 15:58:25 +0800 From: "Liming Gao" To: =?iso-8859-1?Q?Philippe_Mathieu-Daud=E9?= , "Feng, Bob C" , "devel@edk2.groups.io" CC: "Shi, Steven" Subject: Re: [Patch V2] GenBiosId: Enable GenBiosId to set timestamp as zero Thread-Topic: [Patch V2] GenBiosId: Enable GenBiosId to set timestamp as zero Thread-Index: AQHVpEBqN7SLzrtauUufqKuCSbBbjaecvvkAgAtXYyA= Date: Tue, 3 Dec 2019 07:58:25 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E55B068@SHSMSX104.ccr.corp.intel.com> References: <20191126100038.36712-1-bob.c.feng@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: Philippe Mathieu-Daud=E9 [mailto:philmd@redhat.com] >Sent: Tuesday, November 26, 2019 6:47 PM >To: Feng, Bob C ; devel@edk2.groups.io >Cc: Gao, Liming ; Shi, Steven >Subject: Re: [Patch V2] GenBiosId: Enable GenBiosId to set timestamp as ze= ro > >On 11/26/19 11:00 AM, Bob Feng wrote: >> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2384 >> >> We need eliminate the effect of timestamp to verify >> the reproducible build. >> >> This patch is to add the support for GenBiosId to set >> timestamp as zero. >> >> Cc: Liming Gao >> Cc: Steven Shi >> Cc: Philippe Mathieu-Daude >> Signed-off-by: Bob Feng >> --- >> V2: >> 1. Change command line argument to lowercase. >> 2. Add white space before NoTimestamp > >Thanks for the cleanup. > >Reviewed-by: Philippe Mathieu-Daude > >> Platform/Intel/Tools/GenBiosId/GenBiosId.py | 18 +++++++++++------- >> 1 file changed, 11 insertions(+), 7 deletions(-) >> >> diff --git a/Platform/Intel/Tools/GenBiosId/GenBiosId.py >b/Platform/Intel/Tools/GenBiosId/GenBiosId.py >> index 31abb24d31..8cecb1c76f 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'I= nputFile', >help=3D"Input Config file") >> parser.add_argument('-o', '--out', metavar=3D'FILENAME', >dest=3D'OutputFile', help=3D"Output file") >> parser.add_argument('-ot', '--text', metavar=3D'FILENAME', >dest=3D'OutputTextFile', help=3D"Output Text file") >> + parser.add_argument('-nt', '--notimestamp', dest=3D'NoTimestamp', >action=3D'store_true', default=3DFalse, help=3D"Set timestamp to zero") >> Options =3D parser.parse_args() >> return Options >> >> >> # 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] a= nd >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 >> >> # 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 >> >> >> # Parse the input file and extract the information >> -def ParserInputFile(InputDict): >> +def ParserInputFile(InputDict, NoTimestamp): >> for Item in InputDict: >> if Item not in _ConfigItem: >> EdkLogger("GenBiosId", FORMAT_INVALID, >ExtraData=3D_ConfigItemInvalid % Item) >> _ConfigItem[Item]['Value'] =3D InputDict[Item] >> if len(_ConfigItem[Item]['Value']) !=3D _ConfigItem[Item]['Len= gth']: >> EdkLogger("GenBiosId", FORMAT_INVALID, >ExtraData=3D_ConfigLenInvalid % Item) >> for Item in _ConfigItem: >> if not _ConfigItem[Item]['Value']: >> EdkLogger("GenBiosId", FORMAT_UNKNOWN_ERROR, >ExtraData=3D"Item %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_REV']['Value'] + '.' + _ConfigItem['BOARD_EXT'][ >> 'Value'] + '.' + _ConfigItem['VERSION_MAJOR']['Value'] + \ >> '.' + _ConfigItem["BUILD_TYPE"]['Value'] + >_ConfigItem['VERSION_MINOR']['Value'] + '.' + TimeStamp >> return Id_Str >> >> @@ -169,13 +173,13 @@ def PrintOutputFile(OutputFile, OutputTextFile, >Id_Str): >> >> >> # Tool entrance method >> def Main(): >> Options =3D MyOptionParser() >> - InputFile, OutputFile, OutputTextFile =3D CheckOptions(Options) >> + InputFile, OutputFile, OutputTextFile, NoTimestamp =3D >CheckOptions(Options) >> InputDict =3D ReadInputFile(InputFile) >> - Id_Str =3D ParserInputFile(InputDict) >> + Id_Str =3D ParserInputFile(InputDict, NoTimestamp) >> PrintOutputFile(OutputFile, OutputTextFile, Id_Str) >> return 0 >> >> >> if __name__ =3D=3D '__main__': >>