Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 39C00E00CC7; Tue, 29 Sep 2015 05:31:42 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [134.134.136.20 listed in list.dnswl.org] Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 38A1AE0095C for ; Tue, 29 Sep 2015 05:31:39 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 29 Sep 2015 05:31:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,608,1437462000"; d="scan'208";a="654299460" Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75]) by orsmga003.jf.intel.com with ESMTP; 29 Sep 2015 05:31:38 -0700 Received: from irsmsx110.ger.corp.intel.com ([169.254.15.164]) by IRSMSX153.ger.corp.intel.com ([169.254.9.244]) with mapi id 14.03.0248.002; Tue, 29 Sep 2015 13:31:36 +0100 From: "Barros Pena, Belen" To: "Smith, Elliot" , "toaster@yoctoproject.org" Thread-Topic: [Toaster] [review-request][PATCH] toaster: Manually retrieve log file location from filesystem Thread-Index: AQHQ+rLH4zwX5/P7Aki5A0FmoGWSkA== Date: Tue, 29 Sep 2015 12:31:35 +0000 Message-ID: References: <1443468243-7370-1-git-send-email-elliot.smith@intel.com> In-Reply-To: <1443468243-7370-1-git-send-email-elliot.smith@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.5.5.150821 x-originating-ip: [10.237.224.32] MIME-Version: 1.0 Subject: Re: [review-request][PATCH] toaster: Manually retrieve log file location from filesystem X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 12:31:42 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-ID: Content-Transfer-Encoding: quoted-printable On 28/09/2015 20:24, "toaster-bounces@yoctoproject.org on behalf of Elliot Smith" wrote: >The log file location reported by the BB_CONSOLELOG variable >does not point to the log location for the current build at >the time when the BuildStarted event is fired. It >actually points to the location where the next build will >log to. This means that the log file paths associated with >a build in the cooker_log_path field are incorrect, with >the result that the "Download build log" button doesn't work. > >Instead, when a build starts, get the latest-dated log file >and associate it with the build. > >An issue explaining why this is a problem, plus steps to >demonstrate it: >https://bugzilla.yoctoproject.org/show_bug.cgi?id=3D8411 > >This patch is a temporary workaround for issue 8411, >as discussed in >https://bugzilla.yoctoproject.org/show_bug.cgi?id=3D8373#c2 >It fixes 8373 for now, but should be properly fixed if >bitbake can provide the correct log location at the point >when BuildStarted is fired. > >[YOCTO #8373] This works for me.=20 Thanks! Bel=E9n > >Signed-off-by: Elliot Smith >--- > bitbake/lib/bb/ui/toasterui.py | 31 ++++++++++++++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) > >diff --git a/bitbake/lib/bb/ui/toasterui.py >b/bitbake/lib/bb/ui/toasterui.py >index e0c278b..be4518c 100644 >--- a/bitbake/lib/bb/ui/toasterui.py >+++ b/bitbake/lib/bb/ui/toasterui.py >@@ -33,6 +33,7 @@ from bb.ui.buildinfohelper import BuildInfoHelper > import bb.msg > import logging > import os >+import glob >=20 > # pylint: disable=3Dinvalid-name > # module properties for UI modules are read by bitbake and the contract >should not be broken >@@ -61,6 +62,33 @@ def _log_settings_from_server(server): > raise BaseException(error) > return includelogs, loglines, consolelogfile >=20 >+# TODO this is a work-around for the bug mentioned in >+# https://bugzilla.yoctoproject.org/show_bug.cgi?id=3D8373#c2 >+# - the log file location reported by BB_CONSOLELOG at the point >+# when the BuildStarted event occurs does not correspond to the >+# actual log file location; >+# as a work-around, we get the latest-dated log file in the same >+# directory as is in the path stored in BB_CONSOLELOG >+# >+# consolelogfile: log file location reported by BB_CONSOLELOG >+# at the point when a build starts, which isn't the actual log location; >+# the assumption is that the real log file will be in the same >+# directory as the reported log file >+# >+# returns the latest-dated *.log file in the same directory >+# as consolelogfile; if there are no *.log files, this returns >+# consolelogfile >+def _get_real_log_file(consolelogfile): >+ log_file_dir =3D os.path.dirname(consolelogfile) >+ log_file_pattern =3D os.path.join(log_file_dir, "*.log") >+ log_files =3D glob.glob(log_file_pattern) >+ log_files =3D filter(os.path.isfile, log_files) >+ log_files.sort(key=3Dos.path.getmtime) >+ >+ if len(log_files) > 0: >+ return log_files[-1] >+ else: >+ return consolelogfile >=20 > def main(server, eventHandler, params ): > helper =3D uihelper.BBUIHelper() >@@ -126,7 +154,8 @@ def main(server, eventHandler, params ): > # the code will look into the protected variables of the >event; no easy way around this >=20 > if isinstance(event, bb.event.BuildStarted): >- buildinfohelper.store_started_build(event, >consolelogfile) >+ real_consolelogfile =3D _get_real_log_file(consolelogfile= ) >+ buildinfohelper.store_started_build(event, >real_consolelogfile) >=20 > if isinstance(event, (bb.build.TaskStarted, >bb.build.TaskSucceeded, bb.build.TaskFailedSilent)): > buildinfohelper.update_and_store_task(event) >--=20 >Elliot Smith >Software Engineer >Intel OTC > >--------------------------------------------------------------------- >Intel Corporation (UK) Limited >Registered No. 1134945 (England) >Registered Office: Pipers Way, Swindon SN3 1RJ >VAT No: 860 2173 47 > >This e-mail and any attachments may contain confidential material for >the sole use of the intended recipient(s). Any review or distribution >by others is strictly prohibited. If you are not the intended >recipient, please contact the sender and delete all copies. > >--=20 >_______________________________________________ >toaster mailing list >toaster@yoctoproject.org >https://lists.yoctoproject.org/listinfo/toaster