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.web11.10010.1574765211431287378 for ; Tue, 26 Nov 2019 02:46:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PuX/8Hgu; 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=1574765210; 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=JzAHkJBsqXd75y8KBc1/Y6B4iQLKO/SGuzZhPEHR4M8=; b=PuX/8HguGY4u2BF/XR11LXBaFswjXJqJ93dltRBSLn+yPtHY7keKqa3QdMENiAQVVYuRPy VdaxC/rxJCHar7pG1tvhNzyl6Xooz2TdNPJZbHF6e1253QF0e4uxnVZnOq5P7z0+KtB5cC 1rJhODG3m3CkMziFzS5xqcZWHGlg10E= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-382-YBq6AJP4NPGSggvRFLLpZg-1; Tue, 26 Nov 2019 05:46:47 -0500 Received: by mail-wr1-f72.google.com with SMTP id p1so9202503wrw.8 for ; Tue, 26 Nov 2019 02:46:47 -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=JzAHkJBsqXd75y8KBc1/Y6B4iQLKO/SGuzZhPEHR4M8=; b=jqn/Yi41yNTCom7a1ddT5ijQlhZAE5E4kFNk0UXc2RlA7A9MFHSptsY3shywqasRqt e7URBKYIrzztFrb2BFfmC+lL7Qvyq+r0hw9UsvObUgIfD9w8FPHZQsFGR+xZHPiReGIz 9tO19Y4mzoS0AZX1G8L7BOJTkuUze2mk72xdGb+ApFSw+962IZepXOXDsuks6xEn7vvj vbEOcjs+wVYEqSXe+JH/1D3sRyrXGWEX2N8FeqSSBtUToGgfsSu1w16dVxMYMJYJ4ite n04CkY70Gm7aVpShbkCfJqTgFZOOOVVjRSELvKG0M8FgIMcdc2+PrcaAKFpwQi9jThKy cuDA== X-Gm-Message-State: APjAAAVV3REfhtQInDWMzBzqzo1NBVaga/Y+QWquWstMRGEFmMRMMVMh S5S3GrSyg1DCgODi70ABre6wwh4Te+xXbdW4T8TArewnW7yPKSMWfwsv9tUi9OTLCtmTmwITdzW XqW7DQ3kJWwDkOg== X-Received: by 2002:adf:e70d:: with SMTP id c13mr36610242wrm.248.1574765206603; Tue, 26 Nov 2019 02:46:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwhpuU9maOB8Xvxzb4ICYyfw8gLudhvWABbnsDiIjOcOfXVX5P/7ePLFjAf/BpbAmvzm0R83w== X-Received: by 2002:adf:e70d:: with SMTP id c13mr36610229wrm.248.1574765206410; Tue, 26 Nov 2019 02:46:46 -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 g74sm2550824wme.5.2019.11.26.02.46.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Nov 2019 02:46:45 -0800 (PST) Subject: Re: [Patch V2] GenBiosId: Enable GenBiosId to set timestamp as zero To: Bob Feng , devel@edk2.groups.io Cc: Liming Gao , Steven Shi References: <20191126100038.36712-1-bob.c.feng@intel.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: Date: Tue, 26 Nov 2019 11:46:44 +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: <20191126100038.36712-1-bob.c.feng@intel.com> X-MC-Unique: YBq6AJP4NPGSggvRFLLpZg-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 11/26/19 11:00 AM, Bob Feng wrote: > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2384 > > 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='version', version=__version__, > help="show program's version number and exit") > parser.add_argument('-i', '--int', metavar='FILENAME', dest='InputFile', help="Input Config file") > parser.add_argument('-o', '--out', metavar='FILENAME', dest='OutputFile', help="Output file") > parser.add_argument('-ot', '--text', metavar='FILENAME', dest='OutputTextFile', help="Output Text file") > + parser.add_argument('-nt', '--notimestamp', dest='NoTimestamp', action='store_true', default=False, help="Set timestamp to zero") > Options = parser.parse_args() > return Options > > > # Check the Tool for missing variables > def CheckOptions(Options): > - if len(sys.argv) != 5 and not (len(sys.argv) == 7 and Options.OutputTextFile): > + 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=_Usage) > elif not Options.InputFile or not Options.OutputFile: > EdkLogger("GenBiosId", OPTION_MISSING, ExtraData=_Usage) > InputFile = Options.InputFile > OutputFile = Options.OutputFile > OutputTextFile = Options.OutputTextFile > + NoTimestamp = Options.NoTimestamp > if not os.path.exists(InputFile): > EdkLogger("GenBiosId", FILE_NOT_FOUND, ExtraData="Input file not found") > - return InputFile, OutputFile, OutputTextFile > + return InputFile, OutputFile, OutputTextFile, NoTimestamp > > # Read input file and get config > def ReadInputFile(InputFile): > InputDict = OrderedDict() > with open(InputFile) as File: > @@ -132,23 +134,25 @@ def ReadInputFile(InputFile): > InputDict[Key.strip()] = 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=_ConfigItemInvalid % Item) > _ConfigItem[Item]['Value'] = InputDict[Item] > if len(_ConfigItem[Item]['Value']) != _ConfigItem[Item]['Length']: > EdkLogger("GenBiosId", FORMAT_INVALID, ExtraData=_ConfigLenInvalid % Item) > for Item in _ConfigItem: > if not _ConfigItem[Item]['Value']: > EdkLogger("GenBiosId", FORMAT_UNKNOWN_ERROR, ExtraData="Item %s is missing" % Item) > utcnow = datetime.datetime.utcnow() > - TimeStamp = time.strftime("%y%m%d%H%M", utcnow.timetuple()) > - > + if NoTimestamp: > + TimeStamp = "\0\0\0\0\0\0\0\0\0\0" > + else: > + TimeStamp = time.strftime("%y%m%d%H%M", utcnow.timetuple()) > Id_Str = _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 = MyOptionParser() > - InputFile, OutputFile, OutputTextFile = CheckOptions(Options) > + InputFile, OutputFile, OutputTextFile, NoTimestamp = CheckOptions(Options) > InputDict = ReadInputFile(InputFile) > - Id_Str = ParserInputFile(InputDict) > + Id_Str = ParserInputFile(InputDict, NoTimestamp) > PrintOutputFile(OutputFile, OutputTextFile, Id_Str) > return 0 > > > if __name__ == '__main__': >