From nobody Fri Apr 19 06:33:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51268+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51268+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1574762448; cv=none; d=zohomail.com; s=zohoarc; b=KyneZrojLnn6wBejgAwbkXS2kV/dVLu31MVpypW3bG6LRH9cMeHmWILiJAUGKaQQ5rkAFfj8PTBDOkNqILLZv8og7uZPZfk4F4PUgpblz0Q16P3ojSOozjIQWkLI8Bc9AojoYgo3cqhsdG0v/mkis0G/GwqXquMSUx3e17aNjzM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574762448; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=PwMJwtb/ZBHPBbDYxBnbtOTTS4rmk0g7dVJriwDG9kk=; b=j9Z0bW9wn09OtTKBvjws+v2YKjYbgfOKgz4YbC3w0K9pefCZJfXFXMMT3/tF0lvCv80z+UjnrFjYqyYO3SPQtkXh5s5omZCb1qvO8/rPyFvoECFvngqPaw7n3XXGnM2NABh6HXYSrkLeQO4RChb54ns8vqxI3FceVHjsQdE+0/s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51268+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574762448622158.39239367669165; Tue, 26 Nov 2019 02:00:48 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Tue, 26 Nov 2019 02:00:47 -0800 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.9592.1574762446431481391 for ; Tue, 26 Nov 2019 02:00:46 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2019 02:00:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,245,1571727600"; d="scan'208";a="211364796" X-Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.47]) by orsmga006.jf.intel.com with ESMTP; 26 Nov 2019 02:00:44 -0800 From: "Bob Feng" To: devel@edk2.groups.io Cc: Liming Gao , Steven Shi , Philippe Mathieu-Daude Subject: [edk2-devel] [Patch V2] GenBiosId: Enable GenBiosId to set timestamp as zero Date: Tue, 26 Nov 2019 18:00:38 +0800 Message-Id: <20191126100038.36712-1-bob.c.feng@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,bob.c.feng@intel.com X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1574762447; bh=2P9Hn4mivWEA1ecQoiAHj2oIMtklV5uZzlh4zl3oDlQ=; h=Cc:Date:From:Reply-To:Subject:To; b=LsSSYO9rMEqGmpcO66JDNuKDmzKwBIyS7jgUi62yfzlsf3CYMM0rBMZjn4atF0iKI5D GyRYiNDQa9Pvf6BVWYyoqUskf/kxd2P0xi2PgziCvUxxuD/KoFJML3FcCxlkj2zmNMRBN fgEovW2nYnObGtrWdFz48S5Xge3lwpyBw5s= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Liming Gao Reviewed-by: Philippe Mathieu-Daude --- V2:=20 1. Change command line argument to lowercase. 2. Add white space before NoTimestamp 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/T= ools/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'Input= File', help=3D"Input Config file") parser.add_argument('-o', '--out', metavar=3D'FILENAME', dest=3D'Outpu= tFile', help=3D"Output file") parser.add_argument('-ot', '--text', metavar=3D'FILENAME', dest=3D'Out= putTextFile', help=3D"Output Text file") + parser.add_argument('-nt', '--notimestamp', dest=3D'NoTimestamp', acti= on=3D'store_true', default=3DFalse, help=3D"Set timestamp to zero") 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.Ou= tputTextFile): + if len(sys.argv) not in [5,6] and not (len(sys.argv) not in [7,8] and = 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 =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 ParserInputFile(InputDict): +def ParserInputFile(InputDict, NoTimestamp): for Item in InputDict: if Item not in _ConfigItem: EdkLogger("GenBiosId", FORMAT_INVALID, ExtraData=3D_ConfigItem= Invalid % Item) _ConfigItem[Item]['Value'] =3D InputDict[Item] if len(_ConfigItem[Item]['Value']) !=3D _ConfigItem[Item]['Length'= ]: EdkLogger("GenBiosId", FORMAT_INVALID, ExtraData=3D_ConfigLenI= nvalid % 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['VERSI= ON_MINOR']['Value'] + '.' + TimeStamp return Id_Str =20 @@ -169,13 +173,13 @@ def PrintOutputFile(OutputFile, OutputTextFile, Id_St= r): =20 =20 # Tool entrance method def Main(): Options =3D MyOptionParser() - InputFile, OutputFile, OutputTextFile =3D CheckOptions(Options) + InputFile, OutputFile, OutputTextFile, NoTimestamp =3D CheckOptions(Op= tions) 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 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 (#51268): https://edk2.groups.io/g/devel/message/51268 Mute This Topic: https://groups.io/mt/61956815/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-