From 1befb4a783bb7b7b387d4b5ee08830d9516f1ac2 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Tue, 9 Dec 2014 11:57:38 +0000 Subject: add option to write offline event log file This patch adds a "-w/--write-log" option to bitbake that writes an event log file for the current build. The name of the file is passed as a parameter to the "-w" argument. If the parameter is the empty string '', the file name is generated in the form bitbake_eventlog_DATE.json, where DATE is the current date and time, with second precision. The "-w" option can also be supplied as the BBEVENTLOG environment variable. We add a script, toater-eventreplay, that reads an event log file and loads the data into a Toaster database, creating a build entry. We modify the toasterui to fix minor issues with reading events from an event log file. Performance impact is undetectable under no-task executed builds. Signed-off-by: Alexandru DAMIAN --- bin/bitbake | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'bin/bitbake') diff --git a/bin/bitbake b/bin/bitbake index 7f8449c7b..d46c3dde3 100755 --- a/bin/bitbake +++ b/bin/bitbake @@ -196,6 +196,9 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): parser.add_option("", "--status-only", help = "Check the status of the remote bitbake server.", action = "store_true", dest = "status_only", default = False) + parser.add_option("-w", "--write-log", help = "Writes the event log of the build to a bitbake event json file. Use '' (empty string) to assign the name automatically.", + action = "store", dest = "writeeventlog") + options, targets = parser.parse_args(sys.argv) # some environmental variables set also configuration options @@ -206,6 +209,14 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): if "BBTOKEN" in os.environ: options.xmlrpctoken = os.environ["BBTOKEN"] + if "BBEVENTLOG" is os.environ: + options.writeeventlog = os.environ["BBEVENTLOG"] + + # fill in proper log name if not supplied + if options.writeeventlog is not None and len(options.writeeventlog) == 0: + import datetime + options.writeeventlog = "bitbake_eventlog_%s.json" % datetime.datetime.now().strftime("%Y%m%d%H%M%S") + # if BBSERVER says to autodetect, let's do that if options.remote_server: [host, port] = options.remote_server.split(":", 2) @@ -266,7 +277,6 @@ def start_server(servermodule, configParams, configuration, features): return server - def main(): configParams = BitBakeConfigParameters() -- cgit 1.2.3-korg