poky/bitbake/bin/toaster-eventreplay
Marlon Rodriguez Garcia df5c8d6471 bitbake: toaster: Added new feature to import eventlogs from command line into toaster using replay functionality
Added a new button on the base template to access a new template.
Added a model register the information on the builds and generate access links
Added a form to include the option to load specific files
Added jquery and ajax functions to block screen and redirect to build page when import eventlogs is trigger
Added a new button on landing page linked to import build page, and set min-height of buttons in landing page for uniformity
Removed test assertion to check command line build in content, because new button contains text
Updated toaster_eventreplay to use library
Fix test in test_layerdetails_page
Rebased from master

This feature uses the value from the variable BB_DEFAULT_EVENTLOG to read the files created by bitbake
Exclude listing of files that don't contain the allvariables definitions used to replay builds
This part of the feature should be revisited. Over a long period of time, the BB_DEFAULT_EVENTLOG
will exponentially increase the size of the log file and cause bottlenecks when importing.

(Bitbake rev: ab96cafe03d8bab33c1de09602cc62bd6974f157)

Signed-off-by: Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-12 15:58:57 +00:00

1.7 KiB
Executable File

#!/usr/bin/env python3

Copyright (C) 2014 Alex Damian

SPDX-License-Identifier: GPL-2.0-only

This file re-uses code spread throughout other Bitbake source files.

As such, all other copyrights belong to their own right holders.

""" This command takes a filename as a single parameter. The filename is read as a build eventlog, and the ToasterUI is used to process events in the file and log data in the database """

import os import sys import json import pickle import codecs import warnings warnings.simplefilter("default")

from collections import namedtuple

mangle syspath to allow easy import of modules

from os.path import join, dirname, abspath sys.path.insert(0, join(dirname(dirname(abspath(file))), 'lib'))

import bb.cooker from bb.ui import toasterui from bb.ui import eventreplay

def main(argv): with open(argv[-1]) as eventfile: # load variables from the first line variables = None while line := eventfile.readline().strip(): try: variables = json.loads(line)['allvariables'] break except (KeyError, json.JSONDecodeError): continue if not variables: sys.exit("Cannot find allvariables entry in event log file %s" % argv[-1]) eventfile.seek(0) params = namedtuple('ConfigParams', ['observe_only'])(True) player = eventreplay.EventPlayer(eventfile, variables)

    return toasterui.main(player, player, params)

run toaster ui on our mock bitbake class

if name == "main": if len(sys.argv) != 2: print("Usage: %s " % os.path.basename(sys.argv[0])) sys.exit(1)

sys.exit(main(sys.argv))