summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/msg.py
Commit message (Collapse)AuthorAgeFilesLines
* bitbake: msg: use safe YAML loaderRoss Burton2020-12-101-1/+1
| | | | | | | | | | | | | | | | | If using a YAML file in BB_LOGCONFIG, the unsafe loader is used and this causes a runtime warning: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. As log configuration YAML is relatively simple we can just use safe_load(). (Bitbake rev: 71aaac9efa69abbf6c27d174e0862644cbf674ef) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib: fix most undefined code picked up by pylintFrazer Clews2020-08-251-0/+1
| | | | | | | | | | Correctly import, and inherit functions, and variables. Also fix some typos and remove some Python 2 code that isn't recognised. (Bitbake rev: b0c807be5c2170c9481c1a04d4c11972135d7dc5) Signed-off-by: Frazer Clews <frazerleslieclews@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: build/msg: Cleanup verbose option handlingRichard Purdie2020-08-251-6/+0
| | | | | | | | | | | | The levels of indirection to set these verbose logging options is rather crazy. This attempts to turn things into two specific options with much more specific meanings. For now its all still controlled by the commandline verbose option and should funciton as previously, with the addition that the BB_VERBOSE_LOGS option can now be task specific. (Bitbake rev: 423c046f2173aaff3072dc3d0882d01b8a0b0212) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: msg: Avoid issues where paths have relative componentsRichard Purdie2020-06-281-1/+1
| | | | | | | | | | The autobuilder can end up using build/../ syntax which is an issue if the build directory is cleaned. Avoid this by using normpath() on the file path passed in. (Bitbake rev: 41988fec47eb196ab7195a75330a6d98de19101b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: knotty/msg: Use logging.shutdown() instead of bb.msg.cleanupLogging()Joshua Watt2020-03-131-11/+0
| | | | | | | | | | The logging module provides a shutdown() function that does the same thing in a much better way (Bitbake rev: 970cd2fc4f0bbc93069dee5a15a608dd76081c67) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: msg: Return config objectJoshua Watt2020-03-131-1/+4
| | | | | | | | | | | | Returns the configuration object from setLoggingConfig(). This object has a config dictionary that contains all of the created handlers, filters and loggers, which makes it much easier to pull out items with specific names. (Bitbake rev: 93c98a85cb10d3795b3cebc9cd97214d0f4748e5) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: msg: Add helper to merge logging configsJoshua Watt2020-03-131-41/+48
| | | | | | | | | | Adds a function that can be used by UI front ends to merge logging configuration fragments. (Bitbake rev: e860d93b76c142fdae90226bc68e4fe6e7b6a9db) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: knotty: Add logging cleanupJoshua Watt2020-03-131-0/+11
| | | | | | | | | | | Adds code to close all loggers when bitbake exits. This prevents unclosed file ResourceWarnings. A form of this closing existed previously, but was removed in the new logging code. (Bitbake rev: b3f3779adf63c0d970462a558a6205da1d30c0ed) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/msg: Add helper to set logging configJoshua Watt2020-03-131-0/+93
| | | | | | | | | | | Adds a helper function to setup the structure logging information in bitbake. The helper function takes a default configuration and an optional path to a user config file that can be merged into the default. (Bitbake rev: 14c98d36b74c1599b4649078170b6e72df79ba2a) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/msg: Remove unused filtersJoshua Watt2020-03-131-16/+0
| | | | | | | | | | Now that the filter are described using the python logging structure, these classes are no longer needed. (Bitbake rev: 2cb16e0c61609f3fb8a86530ddedf8ad0e69428e) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/msg: Add filter utilitiesJoshua Watt2020-03-131-0/+35
| | | | | | | | | | | | Adds generic filter utilities that can be used to filter when the log level is greater than or equal to a defined value, or below a defined value, as well as a generic function to translate a string to a logging level (or bitbake logging level) (Bitbake rev: 8ebe8a7662200fad9b88be8b08376262a61c85c4) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/msg: Add repr for BBLogFormatterJoshua Watt2020-03-131-0/+3
| | | | | | | | | | Adds a __repr__ function for BBLogFormatter. This allows it to get a human readable string when printed using the logging_tree module (Bitbake rev: 5ff962dca71f4ef16a3aa11b41a23f2227fe8c21) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/msg: Use log level instead of debug countJoshua Watt2020-03-131-13/+9
| | | | | | | | | | | | | Passes around the actual logging level as the default log level variable instead of the debug count. This makes it easier to deal with logging levels since the conversion from debug count and verbose flag only has to occur once when logging is initialized and after that actual log levels can be used (Bitbake rev: 41bd155faf7f65cb0727fcce972715769b26ca89) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/msg: Convert default domains to a dictionaryJoshua Watt2020-03-131-10/+7
| | | | | | | | | | | | | | | | Converts the default domain variable to a dictionary where the keys are the logging domains and the values are the logging level (instead of the debug count). This makes it easier to deal with the logging domains and the awkward conversion from a list to a dictionary only needs to be done once when logging is initialized. Finally, other code has been written that already assumes this variable is a dictionary, see: f04cd93109 ("bitbake: lib/bb: Optimise out debug messages from cooker") (Bitbake rev: f32a8bc7ff7a0b0750b6934a96f5d48391b1383a) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib: remove unused importsFrazer Clews2020-01-191-2/+0
| | | | | | | | | | removed unused imports which made the code harder to read, and slightly but less efficient (Bitbake rev: 4367692a932ac135c5aa4f9f2a4e4f0150f76697) Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Strip old editor directives from file headersRichard Purdie2019-05-041-2/+0
| | | | | | | | | | There are much better ways to handle this and most editors shouldn't need this in modern times, drop the noise from the files. Its not consitently applied anyway. (Bitbake rev: 5e43070e3087d09aea2f459b033d035c5ef747d0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Drop duplicate license boilerplace textRichard Purdie2019-05-041-12/+0
| | | | | | | | | | With the introduction of SPDX-License-Identifier headers, we don't need a ton of header boilerplate in every file. Simplify the files and rely on the top level for the full licence text. (Bitbake rev: 695d84397b68cc003186e22f395caa378b06bc75) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Add initial pass of SPDX license headers to source codeRichard Purdie2019-05-041-0/+2
| | | | | | | | | | | | | | | | | This adds the SPDX-License-Identifier license headers to the majority of our source files to make it clearer exactly which license files are under. The bulk of the files are under GPL v2.0 with one found to be under V2.0 or later, some under MIT and some have dual license. There are some files which are potentially harder to classify where we've imported upstream code and those can be handled specifically in later commits. The COPYING file is replaced with LICENSE.X files which contain the full license texts. (Bitbake rev: ff237c33337f4da2ca06c3a2c49699bc26608a6b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: msg: Add explicit verbnote log levelRichard Purdie2018-09-101-0/+3
| | | | | | | | | | It has become apparant we need a log level which reaches the console but isn't a warning/error. Add "verbnote" as a way of doing this, behaves as a note but with a higher priority. (Bitbake rev: 2076f12cc2f809345108b1606bd6201f41287505) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: knotty: prevent extra logger from being enabled for tinfoilPaul Eggleton2017-06-121-0/+7
| | | | | | | | | | | | | | | tinfoil sets up its own logger by default, but if and when we initialise the UI (by default knotty) will also set one up, leading to duplicated messages specifically from tasks. To avoid this, rather than adding some kind of parameter, just check if there is already a logger outputting to stdout/stderr and if so, skip adding our own. Part of the fix for [YOCTO #11275]. (Bitbake rev: 66d866745f35468d1540a793d07e3a401298b84b) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/msg: introduce logger_create() functionPaul Eggleton2017-03-271-0/+15
| | | | | | | | | | | We use this code to set up a logger with colour in a number of different places, so create one function that does this and make some of bitbake's utility scripts use it. (Bitbake rev: b1ba7d1cc8ec33e2d081230287abd07f52136097) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: knotty: add quiet output modePaul Eggleton2016-07-081-1/+4
| | | | | | | | | | | | | | | | | | | | | Quiet output mode disables printing most messages (below warnings) to the console; however these messages still go to the console log file. This is primarily for cases where bitbake is being launched interactively from some other process, but where full console output is not needed. Because of the need to keep logging all normal events to the console log, this functionality was implemented within the knotty UI rather than in bb.msg (where verbose mode is implemented). We don't currently have a means of registering command line options from the UI end, thus the option actually has to be registered in main.py regardless of the UI, however I didn't feel like it was worth setting up such a mechanism just for this option. (Bitbake rev: db95cdef08e339dec7462bfde3ad7d75c1c60dd8) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Convert to python 3Richard Purdie2016-06-021-1/+1
| | | | | | | | | Various misc changes to convert bitbake to python3 which don't warrant separation into separate commits. (Bitbake rev: d0f904d407f57998419bd9c305ce53e5eaa36b24) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: event/msg: Pass formatted exceptionsRichard Purdie2016-05-131-2/+3
| | | | | | | | | | python3 can't cope with the previous approach we were using to pass exceptions through the RPC. Avoid this by creating a formatted exception on the sender side. (Bitbake rev: d7db75020ed727677afbad07a90fb3eac0bf2c45) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: Fix default function parameter assignment to a listPaul Eggleton2015-08-191-2/+5
| | | | | | | | | | | | | | With python you should not assign a list as the default value of a function parameter - because a list is mutable, the result will be that the first time a value is passed it will actually modify the default. Reference: http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments (Bitbake rev: 7859f7388f2e3f675d0e1527cfde18625f36f637) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: msg: Add stdout/stderr filtersRichard Purdie2014-03-271-2/+16
| | | | | | | | | | | Add logging filters which can be used to split output between stdout and stderr, ERROR messages and above as passed by the Err filter, anything below ERROR is passed by the Out filter. This is useful when trying to make stderr more useful. (Bitbake rev: d3e1419ef76be5e9ec976597361a5e14a7b6bcb6) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: event/msg: Add primitive server side UI log record filteringRichard Purdie2013-08-231-2/+5
| | | | | | | | | | | | | | | | | | | | Currently one of the bigger bottlenecks in bitbake is passing all the log messages over IPC to the UI. This is worthwhile if the UI is going to use them, pointless otherwise. The memory resident bitbake suffers from this performance issue particularly badly. This patch filters the log events on the server side with the global log levels and hence reduces the traffic. This speeds up parsing (18.5s down to 17s) and bitbake general command overhead is reduced (7.3s for a NOP to 6.2s). What isn't added here is general event filtering or the ability to change the log levels once set. Provision is made for adding this in a follow up patch though. (Bitbake rev: 1bf0e88f57ba0bca62532e81d0d62cf88e2abcbb) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: knotty/msg: Avoid usage of curses initscr/endwin to avoid terminal ↵Richard Purdie2012-11-251-11/+1
| | | | | | | | | | | | corruption Using curses initscr/endwin causes screen corruption if for example you suspend bitbake and resume it. This changes the code to use a less invasive approach to determining colour availability on the terminal. (Bitbake rev: 4548a8f037eaf8d47a77052acc3e9ec264ac41e0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: knotty: Colorize knotty interactive console outputSeth Bollinger2012-11-201-0/+43
| | | | | | | | | | | | | | | Add bold color output to log level name and standard color output to log msg when bitbake is run from an iteractive console. Color output is only enabled if the terminal supports color. Used Jason Wessel's recommendation for transparency on verbose, note and plain. (Bitbake rev: 2734240da2cc150f811129a6adf6eb4b2161b204) Signed-off-by: Seth Bollinger <seth.boll@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: implement BB_VERBOSE_LOGSPaul Eggleton2012-02-281-0/+3
| | | | | | | | | | Enable configuring whether "set +x" is added to all shell tasks rather than forcing it; this is enabled by setting BB_VERBOSE_LOGS to 1. (Bitbake rev: 659411b6bb30e1a8355afc1c29b8170a8f2b55ac) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake/lib/bb/msg.py: fix setting debug and verbosity levelsPaul Eggleton2011-09-251-2/+2
| | | | | | | | | | | | | | The debug and verbosity levels (as set by the -D and -v command line options respectively) were not being passed through within msg.py since bitbake revision 45aad2f9647df14bcfa5e755b57e1ddab377939a due to incorrect variable names. Fixes [YOCTO #1513]. (Bitbake rev: c6e88b7c0e61f9586a275df53f48b90687c5f92f) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Fixup remaining bb.msg.domain usersRichard Purdie2011-08-151-1/+1
| | | | | | (Bitbake rev: d5abdacaf9ac604ef8d8c1bafb9b30617827cb4f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake/msg.py: Drop manually created domain listsRichard Purdie2011-08-151-81/+4
| | | | | | | | | | | | | | This patch removes the majority of the domain related code from bb.msg on the grounds that we now support dynamic creation of logging domains so having this hardcoded is just error prone and less flexible. It also makes the msg code overly and needlessly complex. It also removes the bb.msg.debug/note/warn/plain/error functions since we might as well remove them rather than try and fix them at this point. (Bitbake rev: 7627b561cbcb1482b464d69db70f38ea663180f3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake/logging: Overhaul internal logging processRichard Purdie2011-08-151-29/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment it bugs me a lot that we only have one effective logging level for bitbake, despite the logging module having provision to do more advanced things. This patch: * Changes the core log level to the lowest level we have messages of (DEBUG-2) so messages always flow through the core logger * Allows build.py's task logging code to log all the output regardless of what output is on the console and sets this so log files now always contain debug level messages even if these don't appear on the console * Moves the verbose/debug/debug-domains code to be a UI side setting * Adds a filter to the UI to only print the user requested output. The result is more complete logfiles on disk but the usual output to the console. There are some behaviour changes intentionally made by this patch: a) the -v option now controls whether output is tee'd to the console. Ultimately, we likely want to output a message to the user about where the log file is and avoid placing output directly onto the console for every executing task. b) The functions get_debug_levels, the debug_levels variable, the set_debug_levels, the set_verbosity and set_debug_domains functions are removed from bb.msg. c) The "logging" init function changes format. d) All messages get fired to all handlers all the time leading to an increase in inter-process traffic. This could likely be hacked around short term with a function for a UI to only request events greater than level X. Longer term, having masks for event handlers would be better. e) logger.getEffectiveLevel() is no longer a reliable guide to what will/won't get logged so for now we look at the default log levels instead. [YOCTO #304] (Bitbake rev: 45aad2f9647df14bcfa5e755b57e1ddab377939a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Shift exception formatting into the UIChris Larson2011-06-081-2/+8
| | | | | | | | | | | | | Now we use bb.exceptions to pass pickleable traceback entries to the UI, and the UI is free to do whatever it wants to do with this information. By default, the log formatter for the UIs formats it with bb.exceptions. This also means that all exceptions should now show 3 lines of context and limit to 5 entries. (Bitbake rev: ee48d628ee038bd72e1cd94aa75f5ccbacbcee4c) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Enable some DeprecationWarningsChris Larson2011-05-061-12/+10
| | | | | | | | | We'll be skipping the Pending Deprecation step given our release process. (Bitbake rev: 67a55a6b45fec300bea42c18be41cf0a2f931072) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake/msg: Ensure lower level debug messages have DEBUG prefix and reuse ↵Richard Purdie2011-02-071-5/+9
| | | | | | log level values from formatter Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* msg: no need to hardcode the logging levelsChris Larson2011-01-101-2/+2
| | | | | | | (Bitbake rev: 8385bfb7da3a3b71f340a787d7f1502ba61c5b81) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake/msg.py: Add named definitions for all logging levelsRichard Purdie2011-01-081-6/+11
| | | | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: Sync a load of whitespace and other non-functionality changes with ↵Richard Purdie2011-01-041-3/+0
| | | | | | bitbake uptream Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Fix logging level names for post-server-ui-splitChris Larson2011-01-041-0/+21
| | | | | | | (Bitbake rev: dc5a5c39291ec223cd761dce59d29eee7316cb70) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* build: send logging messages to the log file for python functionsChris Larson2011-01-041-0/+9
| | | | | | | (Bitbake rev: ee1cce6ab21ddda60a7a070d03e98ff8485a5e71) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Drop 'fn' arguments to bb.msg functionsChris Larson2011-01-041-7/+7
| | | | | | | (Bitbake rev: 8341458e3d21b45db84e46bd32f8ad270000ce3c) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Add pending deprecation warnings to the bb.msg functionsChris Larson2011-01-041-2/+14
| | | | | | | (Bitbake rev: 60293a42b5500b6139bcd912bf294f862ef9936b) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Switch bitbake internals to use logging directly rather than bb.msgChris Larson2011-01-041-6/+12
| | | | | | | | | | | | | | We use a custom Logger subclass for our loggers This logger provides: - 'debug' method which accepts a debug level - 'plain' method which bypasses log formatting - 'verbose' method which is more detail than info, but less than debug (Bitbake rev: 3b2c1fe5ca56daebb24073a9dd45723d3efd2a8d) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Use the python logging module under the hood for bb.msgChris Larson2011-01-041-66/+68
| | | | | | | (Bitbake rev: 47ca82397bc395b598c6b68b24cdee9e0d8a76d8) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake: Correctly route events from the worker to the serverRichard Purdie2010-08-201-1/+3
| | | | Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake: Switch to use subprocess for forking tasks and FAKEROOTENV to run ↵Richard Purdie2010-08-191-5/+6
| | | | | | shell and python under a fakeroot environment Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* *: use print() as a functionBernhard Reutner-Fischer2010-07-161-5/+5
| | | | | | | | | to make python3 happy (Bitbake rev: c82926ccdd4ec4e3ad6e78a381dacb96adf9b409) Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Fix the silent exit when the specified task doesn't existChris Larson2010-07-021-4/+2
| | | | | | | (Bitbake rev: 2b64afa107dc24db510d0001b6eb58f0d5913d2f) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>