summaryrefslogtreecommitdiffstats
path: root/bitbake/bin
diff options
context:
space:
mode:
authorMarlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com>2023-12-11 11:47:05 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-12 15:58:57 +0000
commitdf5c8d6471bf2484db61c7f180c9758fad4182e1 (patch)
treeb27ed4efa0ec97ecee080e5ae887a6e7488cd442 /bitbake/bin
parent4bb222e0d71a4cb159b8a4f1a90b65b1af32ac10 (diff)
downloadpoky-df5c8d6471bf2484db61c7f180c9758fad4182e1.tar.gz
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>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-xbitbake/bin/toaster-eventreplay74
1 files changed, 2 insertions, 72 deletions
diff --git a/bitbake/bin/toaster-eventreplay b/bitbake/bin/toaster-eventreplay
index f137c71d5c..74a319320e 100755
--- a/bitbake/bin/toaster-eventreplay
+++ b/bitbake/bin/toaster-eventreplay
@@ -30,77 +30,7 @@ sys.path.insert(0, join(dirname(dirname(abspath(__file__))), 'lib'))
30 30
31import bb.cooker 31import bb.cooker
32from bb.ui import toasterui 32from bb.ui import toasterui
33 33from bb.ui import eventreplay
34class EventPlayer:
35 """Emulate a connection to a bitbake server."""
36
37 def __init__(self, eventfile, variables):
38 self.eventfile = eventfile
39 self.variables = variables
40 self.eventmask = []
41
42 def waitEvent(self, _timeout):
43 """Read event from the file."""
44 line = self.eventfile.readline().strip()
45 if not line:
46 return
47 try:
48 decodedline = json.loads(line)
49 if 'allvariables' in decodedline:
50 self.variables = decodedline['allvariables']
51 return
52 if not 'vars' in decodedline:
53 raise ValueError
54 event_str = decodedline['vars'].encode('utf-8')
55 event = pickle.loads(codecs.decode(event_str, 'base64'))
56 event_name = "%s.%s" % (event.__module__, event.__class__.__name__)
57 if event_name not in self.eventmask:
58 return
59 return event
60 except ValueError as err:
61 print("Failed loading ", line)
62 raise err
63
64 def runCommand(self, command_line):
65 """Emulate running a command on the server."""
66 name = command_line[0]
67
68 if name == "getVariable":
69 var_name = command_line[1]
70 variable = self.variables.get(var_name)
71 if variable:
72 return variable['v'], None
73 return None, "Missing variable %s" % var_name
74
75 elif name == "getAllKeysWithFlags":
76 dump = {}
77 flaglist = command_line[1]
78 for key, val in self.variables.items():
79 try:
80 if not key.startswith("__"):
81 dump[key] = {
82 'v': val['v'],
83 'history' : val['history'],
84 }
85 for flag in flaglist:
86 dump[key][flag] = val[flag]
87 except Exception as err:
88 print(err)
89 return (dump, None)
90
91 elif name == 'setEventMask':
92 self.eventmask = command_line[-1]
93 return True, None
94
95 else:
96 raise Exception("Command %s not implemented" % command_line[0])
97
98 def getEventHandle(self):
99 """
100 This method is called by toasterui.
101 The return value is passed to self.runCommand but not used there.
102 """
103 pass
104 34
105def main(argv): 35def main(argv):
106 with open(argv[-1]) as eventfile: 36 with open(argv[-1]) as eventfile:
@@ -116,7 +46,7 @@ def main(argv):
116 sys.exit("Cannot find allvariables entry in event log file %s" % argv[-1]) 46 sys.exit("Cannot find allvariables entry in event log file %s" % argv[-1])
117 eventfile.seek(0) 47 eventfile.seek(0)
118 params = namedtuple('ConfigParams', ['observe_only'])(True) 48 params = namedtuple('ConfigParams', ['observe_only'])(True)
119 player = EventPlayer(eventfile, variables) 49 player = eventreplay.EventPlayer(eventfile, variables)
120 50
121 return toasterui.main(player, player, params) 51 return toasterui.main(player, player, params)
122 52