diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-07-10 14:56:03 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-12 22:55:45 +0100 |
commit | c3ac850f69dc43a1beaf042e8e6a3acb7a1751a3 (patch) | |
tree | 8ff39f846ae993482682e756543d7a013cadeebb /meta/classes/logging.bbclass | |
parent | de2d6436404e1ea6afc152befcc873619960c0d4 (diff) | |
download | poky-c3ac850f69dc43a1beaf042e8e6a3acb7a1751a3.tar.gz |
classes/logging: make shell message functions output to the console
Use the FIFO that is now set up when executing tasks within BitBake to
make bbdebug/bbnote/bbwarn/bbplain/bberror/bbfatal output to the console
through BitBake's UI (as their python counterparts do) instead of only
outputting to the task log.
Note that this requires the corresponding change in BitBake that creates
the FIFO; without it such messages will end up in a file where the FIFO
should have been (but won't cause any other ill effects).
Remainder of the fix for [YOCTO #5275].
(From OE-Core rev: f04139fc2a33ef48dc889ce51ea442927db0c134)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/logging.bbclass')
-rw-r--r-- | meta/classes/logging.bbclass | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/meta/classes/logging.bbclass b/meta/classes/logging.bbclass index f6648b2119..f19edddde5 100644 --- a/meta/classes/logging.bbclass +++ b/meta/classes/logging.bbclass | |||
@@ -2,48 +2,41 @@ | |||
2 | # They are intended to map one to one in intention and output format with the | 2 | # They are intended to map one to one in intention and output format with the |
3 | # python recipe logging functions of a similar naming convention: bb.plain(), | 3 | # python recipe logging functions of a similar naming convention: bb.plain(), |
4 | # bb.note(), etc. | 4 | # bb.note(), etc. |
5 | # | 5 | |
6 | # For the time being, all of these print only to the task logs. Future | 6 | LOGFIFO = "${T}/fifo.${@os.getpid()}" |
7 | # enhancements may integrate these calls with the bitbake logging | ||
8 | # infrastructure, allowing for printing to the console as appropriate. The | ||
9 | # interface and intention statements reflect that future goal. Once it is | ||
10 | # in place, no changes will be necessary to recipes using these logging | ||
11 | # mechanisms. | ||
12 | 7 | ||
13 | # Print the output exactly as it is passed in. Typically used for output of | 8 | # Print the output exactly as it is passed in. Typically used for output of |
14 | # tasks that should be seen on the console. Use sparingly. | 9 | # tasks that should be seen on the console. Use sparingly. |
15 | # Output: logs console | 10 | # Output: logs console |
16 | # NOTE: console output is not currently implemented. | ||
17 | bbplain() { | 11 | bbplain() { |
18 | echo "$*" | 12 | printf "%b\0" "bbplain $*" > ${LOGFIFO} |
19 | } | 13 | } |
20 | 14 | ||
21 | # Notify the user of a noteworthy condition. | 15 | # Notify the user of a noteworthy condition. |
22 | # Output: logs console | 16 | # Output: logs |
23 | # NOTE: console output is not currently implemented. | ||
24 | bbnote() { | 17 | bbnote() { |
25 | echo "NOTE: $*" | 18 | printf "%b\0" "bbnote $*" > ${LOGFIFO} |
26 | } | 19 | } |
27 | 20 | ||
28 | # Print a warning to the log. Warnings are non-fatal, and do not | 21 | # Print a warning to the log. Warnings are non-fatal, and do not |
29 | # indicate a build failure. | 22 | # indicate a build failure. |
30 | # Output: logs | 23 | # Output: logs console |
31 | bbwarn() { | 24 | bbwarn() { |
32 | echo "WARNING: $*" | 25 | printf "%b\0" "bbwarn $*" > ${LOGFIFO} |
33 | } | 26 | } |
34 | 27 | ||
35 | # Print an error to the log. Errors are non-fatal in that the build can | 28 | # Print an error to the log. Errors are non-fatal in that the build can |
36 | # continue, but they do indicate a build failure. | 29 | # continue, but they do indicate a build failure. |
37 | # Output: logs | 30 | # Output: logs console |
38 | bberror() { | 31 | bberror() { |
39 | echo "ERROR: $*" | 32 | printf "%b\0" "bberror $*" > ${LOGFIFO} |
40 | } | 33 | } |
41 | 34 | ||
42 | # Print a fatal error to the log. Fatal errors indicate build failure | 35 | # Print a fatal error to the log. Fatal errors indicate build failure |
43 | # and halt the build, exiting with an error code. | 36 | # and halt the build, exiting with an error code. |
44 | # Output: logs | 37 | # Output: logs console |
45 | bbfatal() { | 38 | bbfatal() { |
46 | echo "ERROR: $*" | 39 | printf "%b\0" "bbfatal $*" > ${LOGFIFO} |
47 | exit 1 | 40 | exit 1 |
48 | } | 41 | } |
49 | 42 | ||
@@ -53,7 +46,6 @@ bbfatal() { | |||
53 | # Output: logs console | 46 | # Output: logs console |
54 | # Usage: bbdebug 1 "first level debug message" | 47 | # Usage: bbdebug 1 "first level debug message" |
55 | # bbdebug 2 "second level debug message" | 48 | # bbdebug 2 "second level debug message" |
56 | # NOTE: console output is not currently implemented. | ||
57 | bbdebug() { | 49 | bbdebug() { |
58 | USAGE='Usage: bbdebug [123] "message"' | 50 | USAGE='Usage: bbdebug [123] "message"' |
59 | if [ $# -lt 2 ]; then | 51 | if [ $# -lt 2 ]; then |
@@ -68,6 +60,6 @@ bbdebug() { | |||
68 | fi | 60 | fi |
69 | 61 | ||
70 | # All debug output is printed to the logs | 62 | # All debug output is printed to the logs |
71 | echo "DEBUG: $*" | 63 | printf "%b\0" "bbdebug $DBGLVL $*" > ${LOGFIFO} |
72 | } | 64 | } |
73 | 65 | ||