Commit Graph

1110 Commits

Author SHA1 Message Date
Yoann Congal
4ee5633889 bitbake: knotty: pass failed task logs through the log infrastructure
By switching from print() to bb.plain() to print failing task logs, we
allow them to be saved in BB_CONSOLELOG.

Fixes [YOCTO #15798]: This allows AB reproducibility test to save the
full log of the failing tasks and helps debugging.

(Bitbake rev: d3b3ad32da7c7ebf61814fc807f8667a37aa149b)

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-05-16 07:13:18 +01:00
Richard Purdie
e72d641a99 bitbake: cooker/cache: Drop mc 'default' string value
The string value "default" for the default multiconfig is confusing since an
empty string is used pretty much everywhere in the code. Remove the few
remaining references to that to standarise.

This affects the default value of BB_CURRENT_MC and does have an impact
on metadata, particulalry bitbake.conf in openembedded-core. That said, the
number of bugs we'll avoid by trying to make "default" back to "" within
bitbake's code make fixing those extremely worthwhile.

(Bitbake rev: 0fa0d8d764bbeb8a44c47f79d7b849068d565199)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-01-25 11:30:51 +00:00
Chris Laplante
bfe176d6d5 bitbake: knotty: some small cleanups while I'm in here
+ missing imports
+ indentation fix
+ missing call to super __init__
+ redundant parenthesis

(Bitbake rev: 89613f4ba31377528d1934cc591fe33218bd916a)

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-12-06 23:33:54 +00:00
Chris Laplante
c7b362f5ec bitbake: knotty: print an error if MACHINE is not set
When the user forgets to set MACHINE, bitbake just exits without
printing anything.

This is because BB_CONSOLELOG ends up with an unexpanded '${MACHINE}', which
bb.utils.mkdirhier tries to report using bb.fatal. But bb.fatal utilizes the
very logging infrastructure that this code was trying to setup.

(Bitbake rev: 7d3f3655b2f610f76898c84b8b97ef2e26529c41)

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-12-06 23:33:54 +00:00
Joshua Watt
29da7370d2 bitbake: Remove custom exception backtrace formatting
Removes the code in bitbake to show custom backtrace formatting for
exceptions. In particular, the bitbake exception code prints function
arguments, which while helpful is a security problem when passwords and
other secrets can be passed as function arguments.

As it turns out, the handling of the custom serialized exception stack
frames was pretty much made obsolete by d7db75020ed ("event/msg: Pass
formatted exceptions"), which changed the events to pass a preformatted
stacktrack list of strings, but the passing of the serialized data was
never removed.

Change all the code to use the python traceback API to format exceptions
instead of the custom code; conveniently traceback.format_exception()
also returns a list of stack trace strings, so it can be used as a drop
in replacement for bb.exception.format_exception()

(Bitbake rev: 2cda75a185aaf8f657f072dac34f8cef9d75f63a)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-11-28 00:06:24 +00:00
Chris Laplante
18b37cc518 bitbake: ui/knotty: respect NO_COLOR & check for tty; rename print_hyperlink => format_hyperlink
(Bitbake rev: 3f6de25a8a4d73dfba864aa6a543c5eafa9b7c7c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-23 09:48:48 +01:00
Chris Laplante
ad2365a3df bitbake: ui/knotty: print log paths for failed tasks in summary
When tasks fail, it's very frustrating to have to scroll up to find the
log path(s). Many of us have the muscle memory to navigate to the 'temp'
directories under tmp/work/, but new users do not.

This change enhances the final summary to include log paths (reported
via bb.build.TaskFailed events). Here's an example:

NOTE: Tasks Summary: Attempted 856 tasks of which 853 didn't need to be rerun and 3 failed.

Summary: 3 tasks failed:
  virtual:native:/home/chris/repos/poky/meta/recipes-core/ncurses/ncurses_6.5.bb:do_fetch
    log: /home/chris/repos/poky/build/tmp/work/x86_64-linux/ncurses-native/6.5/temp/log.do_fetch.1253462
  /home/chris/repos/poky/meta/recipes-core/ncurses/ncurses_6.5.bb:do_fetch
    log: /home/chris/repos/poky/build/tmp/work/core2-64-poky-linux/ncurses/6.5/temp/log.do_fetch.1253466
  virtual:nativesdk:/home/chris/repos/poky/meta/recipes-core/ncurses/ncurses_6.5.bb:do_fetch
    log: /home/chris/repos/poky/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-ncurses/6.5/temp/log.do_fetch.1253467
Summary: There were 3 WARNING messages.
Summary: There were 6 ERROR messages, returning a non-zero exit code.

Each log is rendered as a clickable hyperlink in the terminal. See
https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

(Bitbake rev: 2852a478ab03a482989c3a7e247860ab4f0e9f3e)

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-23 09:48:48 +01:00
Marlon Rodriguez Garcia
1d86845c41 bitbake: ui/buildinfohelper: Add exception treatment to fix missing target_file
Based on the discution on  https://lists.yoctoproject.org/g/toaster/message/6157
in some cases the value for Target_file could be missing and is needed to bypass
it to finish build.

(Bitbake rev: c60f6d20911632b41473f7c8577949be2f99ad80)

Signed-off-by: Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-28 09:43:51 +01:00
Peter A. Bigot
adb0ea98d1 bitbake: lib/bb: support NO_COLOR
Red text on a black background can make it difficult for people with
visual impairments to read the text of error messages.  Respect the
presence of a non-empty NO_COLOR environment variable as an indication
the user doesn't want colorization to be automatically enabled.

See: https://no-color.org/
(Bitbake rev: d9986c54cd3d67ed1f7cb636b17696c8d0d4db85)

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-22 16:26:45 +00:00
Ulrich Ölmann
a32b45289b bitbake: taskexp_ncurses: fix execution example in introductory comment
Drop the ".py" file extension from the "-u" option's argument that has been
overlooked while applying the original patch (see [1]) to make the example work.
While at it sort the recipes' names consistently with respect to what is found
in the self-test examples below.

[1] https://lore.kernel.org/bitbake-devel/6f2645a7c4db2ae149d387544d2b94209cfed3f4.camel@linuxfoundation.org/

(Bitbake rev: 1f4d517b7a0389f78d1f791135f8dc9120e9912b)

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-28 09:21:48 +00:00
David Reyna
f62e4d81ec bitbake: taskexp_ncurses: ncurses version of taskexp.py
* Create an ncurses version of the GTK app "taskexp.py".
* Add these additional features:
  - Sort tasks in recipes by their dependency order
  - Print individual and/or recipe-wide dependencies to a file
  - Add a wild card filter
  - Show the target recipes on BOLD
* Provide a GUI self test
* Provide a non-ncurses self test for ptest

(Bitbake rev: f49bec66ad51c8cddeceafbbe2445c46e396ee8b)

Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-18 17:38:47 +00:00
Mark Asselstine
98c5c96dd3 bitbake: ui/knotty: properly handle exceptions when calling runCommand()
In runCommand() the send() and recv() can fail and raise
BrokenPipeError and EOFError exceptions when the bitbake-server is
unexpectedly terminated. In these cases a python traceback is
currently dumped. Similarly updateFromServer() which calls
runCommand() can also raise these and other exceptions, and currently
lacks proper exception handling resulting in python traceback.

We wrap calls to runCommand() and updateFromServer() in a try/except
block as well as improve the exception handling for updateToServer().

This along with the earlier commit which added text to the
BrokenPipeError and EOFError exceptions in runCommand() to indicate a
bitbake-server termination may have occurred, should improve the user's
ability to understand and handle these errors.

An easy way to trigger each of the runCommand() exceptions is to
'kill -9' bitbake-server before (causes EOFError) or after
(causes BrokenPipeError) the "Loading Cache" stage.

(Bitbake rev: 804d366ee3ddc0f37f0a6c712c8d42db45b119bc)

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-10 14:02:38 +00:00
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
Richard Purdie
7943caf90c bitbake: ui/ncurses: Add missing function call to avoid traceback
The ncurses UI wasn't working due to a missing function call. Add it
to avoid a traceback when starting builds.

(Bitbake rev: db8f36b69a68de2179e5685cf24a42ec10d68257)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-27 22:52:08 +00:00
David Reyna
ddf3b3ecd4 bitbake: toaster: accommodate missing 'Image Name' value in buildinfohelper
The value "Image Name" in bitbake events was missing for certain builds. Update 'buildinfohelper' to extract the
image name elsewhere in this circumstance and not crash.

[YOCTO #13191]

(Bitbake rev: 703792c48c818025163de9c2f35f6ac815500607)

Signed-off-by: Kieran McNulty <Kieran.McNulty@windriver.com>
Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-08-30 10:41:54 +01:00
Tim Orling
4d1675beac bitbake: bitbake: fix deprecated threading.Thread.setDaemon
Deprecated in Python 3.10:
https://docs.python.org/3/whatsnew/3.10.html#deprecated
https://github.com/python/cpython/pull/25174

Fixes warnings like:

...bitbake/lib/bb/ui/uievent.py:68: DeprecationWarning: setDaemon() is
deprecated, set the daemon attribute instead
  self.t.setDaemon(True)

(Bitbake rev: 323f6ce27a1bfd7159e72f29684674ff495dedee)

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-01-24 21:59:44 +00:00
Richard Purdie
3a439f94ab bitbake: knotty: Improve shutdown handling
There are three levels of shutdown, the initial "wait for current tasks",
then "stop current tasks" and "exit now". Change the code so that we don't
instantly exit after "stop current tasks" but allow the events to come
through from the server first. The new shutdown level allows that to then
be broken out of too.

(Bitbake rev: af38345b91cfc8a6bb5c38f5753255e7635bfe2b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-01-11 23:14:48 +00:00
Richard Purdie
a19687acd1 bitbake: lib/bb: Update thread/process locks to use a timeout
The thread/process locks we use translate to futexes in Linux. If a
process dies holding the lock, anything else trying to take the lock
will hang indefinitely. An example would be the OOM killer taking out
a parser process.

To avoid bitbake processes just hanging indefinitely, add a timeout to
our lock calls using a context manager. If we can't obtain the lock
after waiting 5 minutes, hard exit out using os._exit(1). Use _exit()
to avoid locking in any other places trying to write error messages to
event handler queues (which also need locks).

Whilst a bit harsh, this should mean we stop having lots of long running
processes in cases where things are never going to work out and also
avoids hanging builds on the autobuilder.

(Bitbake rev: d2a3f662b0eed900fc012a392bfa0a365df0df9b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-01-05 11:50:17 +00:00
Richard Purdie
a486edbfb1 bitbake: knotty: Ping the server/cooker periodically
We're seeing failures where the UI hangs if the server disappears. Ping
the cooker/server if we've not had any events in the last minute so we can
check if it is still alive.

(Bitbake rev: 6567ad6181f9e39812097f0154647e4b38238fdd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-12-31 17:05:17 +00:00
Richard Purdie
2c5bc03796 bitbake: knotty: Avoid looping with tracebacks
If there are events queued and there is an exception in the main loop
of the UI code, it will print tracebacks on the console indefinitely.
Avoid that by improving the loop exit conditions.

(Bitbake rev: 2d0940b920a22b244f3ba6849c7cd019578386b4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-12-31 17:05:16 +00:00
Richard Purdie
cbeda8ee3b bitbake: buildinfohelper: Drop unused variables
(Bitbake rev: d720dfa40620e64a557edef527148d58fcb1d858)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-21 21:00:35 +01:00
Richard Purdie
ff9f30b4c6 bitbake: ui/knotty: Drop pointless pass statement
(Bitbake rev: 625565087d8c9e7a6a79b0b4f3e5be2d77d5f100)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-21 21:00:35 +01:00
Richard Purdie
004b0e03e1 bitbake: buildinfohelper: Drop unused function
The function has a loop where the variable is never used which I was going
to fix but the entire function never seems to be called so remove it entirely.

(Bitbake rev: 3bcb20f025907f4e88bbe3d14f5638d5f01010cb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-21 21:00:35 +01:00
Richard Purdie
4431ad2802 bitbake: ui/buildinfohelper: Drop unused import
(Bitbake rev: aca0ff85109f4b0f3c201c02c3f59cad7ee2e787)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-21 21:00:35 +01:00
Peter Kjellerstedt
12b4074675 bitbake: knotty.py: Show elapsed time also for tasks with progress bars
While the progress bar is good at conveying information about how much
of a task has executed, the elapsed time of the task is still very
much relevant to show.

(Bitbake rev: 41eeb4f34fb2306303f7688ec5e0ae965a573aa4)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-05 10:50:08 +01:00
Ross Burton
93eb983e79 bitbake: bitbake: knotty: reduce keep-alive timeout from 5000s (83 minutes) to 10 minutes
The keep alive timeout is excessively long at 83 minutes (5000 seconds),
reduce this to 10 minutes: this should be long enough that it rarely
triggers in normal builds, but when it does it has useful information.

(Bitbake rev: 2e47346b95b09d7ab8f0603e2d62cfb549dc1f5c)

(Bitbake rev: dcf52157d3635925491783be656c6b76d1efe1a4)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-23 12:08:56 +00:00
Ross Burton
3e314814bf bitbake: bitbake: knotty: display active tasks when printing keepAlive() message
In interactive bitbake sessions it is obvious what tasks are running
when one of them hangs or otherwise takes a long time. However, in
non-interactive sessions (such as automated builds) bitbake just prints
a message saying that it is "still alive" with no clues as to what tasks
are active still.

By simply listing the active tasks when printing the keep alive message,
we don't need to parse the bitbake log to identify which of the tasks
is still active and has presumably hung.

(Bitbake rev: f9f57fb7d2c8a13df1eb9d5b9766f15e229dcf97)

(Bitbake rev: 30f6c3f175617beea8e8bb75dcf255611e3fc2fd)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-23 12:08:56 +00:00
David Reyna
c71a9c89e3 bitbake: toaster: race condition for end-of-build
Force a sync point for end-of build event handler force
the build's outcome status commit, to resolve a race
condition with the build completion takedown.

[YOCTO #14765]

(Bitbake rev: f76c13536e19d2401365c0fc240ef8dbcb3ee7e8)

Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-21 10:07:40 +00:00
Tim Orling
377c744340 bitbake: bitbake: buildinfohelper.py fix for Django 3.2
connection.features.autocommits_when_autocommit_is_off
was deprecated in 3.0 and is no longer present in 3.2

(Bitbake rev: cc0f526fb4298349d0eea44c8f35d3dd226cc8d6)

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-15 08:40:09 +00:00
Peter Kjellerstedt
aae4f55d1b bitbake: knotty.py: A little clean up of TerminalFilter::updateFooter()
* Use max() to clamp progress to >= 0.
* Be consistent when evaluating self.quiet (treat it as a boolean).

(Bitbake rev: 160f71372ff93894d9314619e9d3b547c1f3cda3)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-11 06:56:01 +00:00
Peter Kjellerstedt
af7a4af979 bitbake: knotty.py: Correct the width of the progress bar for the real tasks
In commit 8055ec36 (knotty: Improve setscene task display) the setscene
tasks got their own line in the task output. However, the progress bar
code does not handle newlines in its widgets, so the length of the
setscene line was included when calculating how much space is available
for the progress bar of the running tasks, making it much too short.

Instead of trying to teach the progress bar code to handle newlines,
separate the output of the setscene tasks from the progress bar for the
real tasks.

(Bitbake rev: a41f7792f17acdba8c7ea83b79e413ae6a49da68)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-11 06:56:01 +00:00
Peter Kjellerstedt
553856138c bitbake: knotty.py: Improve the message while waiting for running tasks to finish
Use pluralise() to correct the grammar, and drop the colon at the end if
runnning in quiet mode.

(Bitbake rev: 57396289f935892390c11afe95f3eede28fd80e7)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-11 06:56:01 +00:00
Richard Purdie
46163db74b bitbake: uievent: Fix import warning for python 3.10
(Bitbake rev: bf1de5988698c797403ecd30edda99a76e9c02dd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-10 15:25:47 +00:00
Richard Purdie
e95fedc49c bitbake: knotty: Improve setscene task display
There is general agreement the current display of the total setscene and
executed full tasks is confusing. Fixing it is tricky to be clear to new
users whilst not wasting screen real estate for experienced users and not
compromisng features like the progress bar.

As a compromise, move the setscene total to the previous line making
the status display a two line summary for interactive terminals. This
makes it clear what two of the numbers represent (setscene task) whilst
separating this out from the other items.

Also tweak the non-interactive output to use a comma as a separator,
the use of the forward slash was a poor choice.

(Bitbake rev: 8055ec360507e6a678ee5c4018ec1ab7f5a9cce5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-06 17:38:30 +00:00
Richard Purdie
c9b71a9817 bitbake: knotty: Correctly handle multiple line items
Currently the footer code doesn't quite handle multiline items correct.
Fix this to do so.

(Bitbake rev: 8eeccf73185d986c6abd6426b1d1e72da3a982df)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-06 17:38:30 +00:00
Richard Purdie
478cb0ce2c bitbake: data_smart/cookerdata: Add variable remapping support
This change adds support for improving the user experience when variables
are renamed. This isn't as simple as it might first appear since some
bitbake variables are used through the environment before the datastore
exists, some are bitbake variables which we know about straight away
and some are metadata defined which we don't know about until later.

This patch adds support for handling these different cases, allowing a list
of bitbake renamed variables to be defined in bitbake itself and allows this
to be extended through the metadata using BB_RENAMED_VARIABLES.

In order to give the best feedback to the user, we default to turning on
variable history tracking in the base data store from knotty, which allows
filename and line number information to be shown.

(Bitbake rev: bd50a5d5e4b4fa90844464396887ebdff0d4e5f7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-21 23:37:26 +00:00
Richard Purdie
dac63330e6 bitbake: msg: Add bb.warnonce() and bb.erroronce() log methods
This adds a log level and logging function call to use it where the
warning or error will only be displayed once, regardless of how many
times the message is logged.

This has to be done either in the cooker or on the UI side. I've opted
for the UI side since display control is really a UI issue but it uses
a common library filter function to enable it which can be reused
elsewhere.

The knotty message displayed as the build summary is tweaked to
make sense when the numbers won't match since it will still count
the number of times it was logged and this is probably helpful
for debugging in some cases so I've deliberately left it that way.

(Bitbake rev: 7bd40e3003a043e3cb7efc276681054b563b5e7b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-17 17:51:03 +00:00
Richard Purdie
34e4eebc32 bitbake: lib/bb: Fix string concatination potential performance issues
Python scales badly when concatinating strings in loops. Most of these
references aren't problematic but at least one (in data.py) is probably
a performance issue as the issue is compounded as strings become large.

The way to handle this in python is to create lists which don't reconstruct
all the objects when appending to them. We may as well fix all the references
since it stops them being copy/pasted into something problematic in the future.

This patch was based on issues highligthted by a report from AWS Codeguru.

(Bitbake rev: d654139a833127b16274dca0ccbbab7e3bb33ed0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-11-03 10:12:42 +00:00
Richard Purdie
9abab49f2b bitbake: lib/bb: Clean up use of len()
(Bitbake rev: bbbc843e86639604d00d76b1949b94a78cf1d95d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-11-03 10:12:42 +00:00
Richard Purdie
0f939ecaf8 bitbake: knotty/uihelper: Show setscene task progress in summary output
With the changes to task accounting, bitbake doesn't show progress
when executing setscene tasks on the summary console output.

Change to show a progress within the setscene tasks and a progress
within the main tasks. I can't see any way to display this more easily
without confusing users.

[YOCTO #14586]

(Bitbake rev: 0244acb968eb593d2ad7bc6e52f222c2b1d39aa9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-08 16:45:06 +01:00
Richard Purdie
6b52061123 bitbake: runqueue/knotty: Improve UI handling of setscene task counting
The recent fixes to merge setscene and normal task accounting in runqueue
fixed some display issues but broke the task numbering of setscene tasks.

Add new accounting methods to the stats structure specifically designed
for setscene. This accounts for the fact that setscene tasks can rerun
multiple times in the build.

Then use the new data in the UI to correctly display the numbers the
user wants to see to understand progress.

(Bitbake rev: ed7e2da88bf4b7bfc7ebfc12b9bd6c0fb7d8c1aa)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-09-17 07:26:23 +01:00
Richard Purdie
15c87c405f bitbake: runqueue: Clean up task stats handling
When we parallelised normal and setscene tasks, the task stats
handling was left separate pending further thought. We had to remove
handling of the setscene tasks from the UI in order to maintain
consistent task numbering.

Currently, "0 of 0" tasks can be shown as setscene tasks execute
until the first normal task runs.

The only use left for sq_stats is in the active task numbers which
we can use the length of sq_ive for instead. We can therefore
drop it and return stats in all cases. This removes the "0 of 0" task
problem since the stats in all normal and setscene tasks matches.

[YOCTO #14479]

(Bitbake rev: eae6e947e37e18cded053814bd2a268b44fb25cd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-09-11 22:39:19 +01:00
Richard Purdie
5f4e335c8e bitbake: ui/taskexp: Fix to work with empty build directories
If run on an empty build directory, taskexp wasn't working as it didn't
send the current environment to the server. This means HOSTTOOLS in oe-core
couldn't be built and gave an error. Add the missing updateToServer call in.

[YOCTO #14408]

(Bitbake rev: 06a0bbe746f879ae539223e7fdb6f07d55d13719)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-06 06:34:58 +01:00
Richard Purdie
0e3c7594cb bitbake: ui/taskexp: Improve startup exception handling
When an exception occurs at startup, show it to the user.

[YOCTO #14408]

(Bitbake rev: cc1df1af67cfd3e223b39e2b7ea5f86b8cf78aee)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-06 06:34:58 +01:00
Joshua Watt
f3e1a668fb bitbake: knotty: Re-enable command line logging levels
The "-l" command line options to enable specific logging domains wasn't
working with the switch to structured logging because they were only
being used to set the legacy logging domains. Fix this by implementing
the logic to parse the user options into the logging configuration.

(Bitbake rev: 005fc7a8c588d0b0bca382469645cbf481ad8e30)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-05-01 22:51:06 +01:00
Joshua Watt
75f87db413 bitbake: logging: Make bitbake logger compatible with python logger
The bitbake logger overrode the definition of the debug() logging call
to include a debug level, but this causes problems with code that may
be using standard python logging, since the extra argument is
interpreted differently.

Instead, change the bitbake loggers debug() call to match the python
logger call and add a debug2() and debug3() API to replace calls that
were logging to a different debug level.

[RP: Small fix to ensure bb.debug calls bbdebug()]
(Bitbake rev: f68682a79d83e6399eb403f30a1f113516575f51)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-02-10 23:48:16 +00:00
Hongxu Jia
37b51ed076 bitbake: Revert "bb.ui: delete __init__.py to make bb.ui a namespace package"
The commit [991f92b4d bb.ui: delete __init__.py to make bb.ui a
namespace package] caused `bitbake -h' failed
...
$ bitbake -h
Traceback (most recent call last):
  File "/buildarea/raid5/hjia/community/poky/bitbake/bin/bitbake", line 35, in <module>
    sys.exit(bitbake_main(BitBakeConfigParameters(sys.argv),
  File "/buildarea/raid5/hjia/community/poky/bitbake/lib/bb/cookerdata.py", line 27, in __init__
    self.options, targets = self.parseCommandLine(argv or sys.argv)
  File "/buildarea/raid5/hjia/community/poky/bitbake/lib/bb/main.py", line 297, in parseCommandLine
    options, targets = parser.parse_args(argv)
  File "/usr/lib64/python3.6/optparse.py", line 1387, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib64/python3.6/optparse.py", line 1431, in _process_args
    self._process_short_opts(rargs, values)
  File "/usr/lib64/python3.6/optparse.py", line 1536, in _process_short_opts
    option.process(opt, value, values, self)
  File "/usr/lib64/python3.6/optparse.py", line 785, in process
    self.action, self.dest, opt, value, values, parser)
  File "/usr/lib64/python3.6/optparse.py", line 807, in take_action
    parser.print_help()
  File "/usr/lib64/python3.6/optparse.py", line 1647, in print_help
    file.write(self.format_help())
  File "/usr/lib64/python3.6/optparse.py", line 1635, in format_help
    result.append(self.format_option_help(formatter))
  File "/usr/lib64/python3.6/optparse.py", line 1615, in format_option_help
    result.append(OptionContainer.format_option_help(self, formatter))
  File "/usr/lib64/python3.6/optparse.py", line 1061, in format_option_help
    result.append(formatter.format_option(option))
  File "/buildarea/raid5/hjia/community/poky/bitbake/lib/bb/main.py", line 54, in format_option
    valid_uis = list_extension_modules(bb.ui, 'main')
  File "/buildarea/raid5/hjia/community/poky/bitbake/lib/bb/main.py", line 72, in list_extension_modules
    pkgdir = os.path.dirname(pkg.__file__)
AttributeError: module 'bb.ui' has no attribute '__file__'
...

This reverts commit 991f92b4d15b0571b6a540964e5216d1b9728539

(Bitbake rev: 22b8c53205f8915b33d1e0ad6a666dcacc01491d)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-11-24 15:26:12 +00:00
Chris Laplante
d8babbe08a bitbake: bb.ui: delete __init__.py to make bb.ui a namespace package
This would permit creation of third-party UI modules without having to
incorporate them directly into BitBake, with BitBake able to
automatically discover them in the same way it finds its built-in UIs.

See https://packaging.python.org/guides/packaging-namespace-packages/

(Bitbake rev: 991f92b4d15b0571b6a540964e5216d1b9728539)

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-11-11 10:09:18 +00:00
Richard Purdie
7cad26d585 bitbake: ui/toasterui: Fix startup faults from incorrect event sequencing
Toaster has been failing to start correctly when in interactive mode. The
issue is due to setEventMask being called (which triggers parsing) before
the environment has been sent from the UI over to the server. This means
PATH isn't setup, which causes the sanity checks on HOSTTOOLS to fail
in base.bbclass.

The fix is to ensure the environment is sent to the server before
other commands are run.

The pain in debugging this highlights other improvements to the logging
are needed.

[YOCTO #14079]

Reviewed-by: Tim Orling <timothy.t.orling@linux.intel.com>
Tested-by: Tim Orling <timothy.t.orling@linux.intel.com>
(Bitbake rev: a8efff5c83cd5a25f4b6720e6414a7aa35d04bc7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-10-17 12:36:14 +01:00
Tim Orling
98e5d24fa9 bitbake: lib/bb/ui/knotty: fix typo in parseprogress
After parseprogress.finish() it was intended to
set parseprogress to None, but a typo means this
is not happening.

(Bitbake rev: f504d6f6598f62aa20fbf69c30fea95569858edb)

Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-10-17 12:36:14 +01:00