mirror of
https://git.yoctoproject.org/poky
synced 2026-02-07 01:06:37 +01:00
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>
87 lines
2.6 KiB
Python
87 lines
2.6 KiB
Python
#!/usr/bin/env python3
|
|
#
|
|
# 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.
|
|
#
|
|
|
|
|
|
import os
|
|
import sys
|
|
import json
|
|
import pickle
|
|
import codecs
|
|
|
|
|
|
class EventPlayer:
|
|
"""Emulate a connection to a bitbake server."""
|
|
|
|
def __init__(self, eventfile, variables):
|
|
self.eventfile = eventfile
|
|
self.variables = variables
|
|
self.eventmask = []
|
|
|
|
def waitEvent(self, _timeout):
|
|
"""Read event from the file."""
|
|
line = self.eventfile.readline().strip()
|
|
if not line:
|
|
return
|
|
try:
|
|
decodedline = json.loads(line)
|
|
if 'allvariables' in decodedline:
|
|
self.variables = decodedline['allvariables']
|
|
return
|
|
if not 'vars' in decodedline:
|
|
raise ValueError
|
|
event_str = decodedline['vars'].encode('utf-8')
|
|
event = pickle.loads(codecs.decode(event_str, 'base64'))
|
|
event_name = "%s.%s" % (event.__module__, event.__class__.__name__)
|
|
if event_name not in self.eventmask:
|
|
return
|
|
return event
|
|
except ValueError as err:
|
|
print("Failed loading ", line)
|
|
raise err
|
|
|
|
def runCommand(self, command_line):
|
|
"""Emulate running a command on the server."""
|
|
name = command_line[0]
|
|
|
|
if name == "getVariable":
|
|
var_name = command_line[1]
|
|
variable = self.variables.get(var_name)
|
|
if variable:
|
|
return variable['v'], None
|
|
return None, "Missing variable %s" % var_name
|
|
|
|
elif name == "getAllKeysWithFlags":
|
|
dump = {}
|
|
flaglist = command_line[1]
|
|
for key, val in self.variables.items():
|
|
try:
|
|
if not key.startswith("__"):
|
|
dump[key] = {
|
|
'v': val['v'],
|
|
'history' : val['history'],
|
|
}
|
|
for flag in flaglist:
|
|
dump[key][flag] = val[flag]
|
|
except Exception as err:
|
|
print(err)
|
|
return (dump, None)
|
|
|
|
elif name == 'setEventMask':
|
|
self.eventmask = command_line[-1]
|
|
return True, None
|
|
|
|
else:
|
|
raise Exception("Command %s not implemented" % command_line[0])
|
|
|
|
def getEventHandle(self):
|
|
"""
|
|
This method is called by toasterui.
|
|
The return value is passed to self.runCommand but not used there.
|
|
"""
|
|
pass
|