From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web10.2541.1574679357451554818 for ; Mon, 25 Nov 2019 02:55:57 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TwPE6ein; spf=pass (domain: redhat.com, ip: 205.139.110.61, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574679356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YWWr+aqBrhuRi4UnqbeHlL0DRE/QWvlczhka1RfvxAA=; b=TwPE6ein/MySbKCCVE1JUM6HAYnvDJKKkDUqKV0C1jlbpU6Wumj8UVz60aU5PHudykSnyh hLltSG7watcTCNeBSn5Dhtr2TZygfaJ2dr45Kv0gdDNoTJRjvho2E0Bp4uYekEDM7MNrzj jCSC4A4sfQlIGIzJsSbZc1t5ECGWX3Y= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-232-X4ySGeTAN86mOpkNdAtIDw-1; Mon, 25 Nov 2019 05:55:54 -0500 Received: by mail-wm1-f70.google.com with SMTP id f21so4407299wmh.5 for ; Mon, 25 Nov 2019 02:55:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lKlfYf5UXznCSiPNs9dZknGMM94SO9M2UV1+IGRTZwY=; b=meD1NtoR1Wd2T5qMhSL0Zd4hv71qyDHRt3GJip7q+SFEsoEPavb3WEROAoppBxC2em 0nZPglhrbKnns25js1UTfnmlcYYWjEx0aHc21kiE7LJBkddyuIJznQXSi6Xee2OPBktc K5bnYwCS6QrCi6wEienrS29yeOMKkeKAoL8zuyMGvsdhn+l0fFs1FBLCu6xj1fqKXOK3 plfKnTeFhqjVQHu9cNIccUQpB28EO3lGtMTIIiq0qdLMb/YQEYOoUOUzPD1dt2b58b6Y CQRkab0PyPhHq/jp6Sw7cEVJIveHPC7Eys+yvHvMCh1NKsf1rKphttYkJdQMFMMk6y4b tp3w== X-Gm-Message-State: APjAAAXaqFp6IKLBEmsjqzRDaAqTJQYmHSMw7vOI1exXSpk/BlsNwQWV YX+Zm72uu4CbDnp3EhdQX6LKSxzWYJwbfQcK3vWY0nO6VWdL2IWadDhXJxTujabpjlIA+9ZSnY3 7fOtyDTziP6M2Jw== X-Received: by 2002:adf:8426:: with SMTP id 35mr30127520wrf.262.1574679353407; Mon, 25 Nov 2019 02:55:53 -0800 (PST) X-Google-Smtp-Source: APXvYqyiEDceWosKO7FoWMsoTI78e4VqUJ2VWVO5orbffGjt/O8AQvf446L6foK/ptU4WR3ROhwIAQ== X-Received: by 2002:adf:8426:: with SMTP id 35mr30127457wrf.262.1574679352556; Mon, 25 Nov 2019 02:55:52 -0800 (PST) Return-Path: Received: from [192.168.1.35] (182.red-88-21-103.staticip.rima-tde.net. [88.21.103.182]) by smtp.gmail.com with ESMTPSA id x9sm9763457wru.32.2019.11.25.02.55.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Nov 2019 02:55:52 -0800 (PST) Subject: Re: [edk2-devel] [Patch] GenBiosId: Enable GenBiosId to set timestamp as zero To: devel@edk2.groups.io, bob.c.feng@intel.com Cc: Liming Gao , Steven Shi References: <20191125080506.37368-1-bob.c.feng@intel.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: Date: Mon, 25 Nov 2019 11:55:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191125080506.37368-1-bob.c.feng@intel.com> X-MC-Unique: X4ySGeTAN86mOpkNdAtIDw-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable 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 build. >=20 > This patch is to add the support for GenBiosId to set > timestamp as 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 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', dest=3D'= OutputTextFile', help=3D"Output Text file") > + parser.add_argument('-NT', '--NoTimeStamp', dest=3D'NoTimestamp', ac= tion=3D'store_true', default=3DFalse, help=3D"Set timestamp to zero") All other options are in lowercase, why use CamelCase here? Can we use=20 '-nt', '--notimestamp' to keep the style? Two minor style comment below; except the style comments the patch looks=20 good. > 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 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 CheckOptions(O= ptions) 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