summaryrefslogtreecommitdiffstats
path: root/meta/classes/logging.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-10 14:35:29 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-12 15:27:17 +0100
commitfd1517e2b51a170f2427122c6b95396db251d827 (patch)
treedabfe3e631339c2fc99a9ee7febb0f9c128e325e /meta/classes/logging.bbclass
parent10317912ee319ccf7f83605d438b5cbf9663f296 (diff)
downloadpoky-fd1517e2b51a170f2427122c6b95396db251d827.tar.gz
classes: Update classes to match new bitbake class scope functionality
Move classes to classes-global or classes-recipe as appropriate to take advantage of new bitbake functionality to check class scope/usage. (From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/logging.bbclass')
-rw-r--r--meta/classes/logging.bbclass107
1 files changed, 0 insertions, 107 deletions
diff --git a/meta/classes/logging.bbclass b/meta/classes/logging.bbclass
deleted file mode 100644
index ce03abfe42..0000000000
--- a/meta/classes/logging.bbclass
+++ /dev/null
@@ -1,107 +0,0 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7# The following logging mechanisms are to be used in bash functions of recipes.
8# They are intended to map one to one in intention and output format with the
9# python recipe logging functions of a similar naming convention: bb.plain(),
10# bb.note(), etc.
11
12LOGFIFO = "${T}/fifo.${@os.getpid()}"
13
14# Print the output exactly as it is passed in. Typically used for output of
15# tasks that should be seen on the console. Use sparingly.
16# Output: logs console
17bbplain() {
18 if [ -p ${LOGFIFO} ] ; then
19 printf "%b\0" "bbplain $*" > ${LOGFIFO}
20 else
21 echo "$*"
22 fi
23}
24
25# Notify the user of a noteworthy condition.
26# Output: logs
27bbnote() {
28 if [ -p ${LOGFIFO} ] ; then
29 printf "%b\0" "bbnote $*" > ${LOGFIFO}
30 else
31 echo "NOTE: $*"
32 fi
33}
34
35# Print a warning to the log. Warnings are non-fatal, and do not
36# indicate a build failure.
37# Output: logs console
38bbwarn() {
39 if [ -p ${LOGFIFO} ] ; then
40 printf "%b\0" "bbwarn $*" > ${LOGFIFO}
41 else
42 echo "WARNING: $*"
43 fi
44}
45
46# Print an error to the log. Errors are non-fatal in that the build can
47# continue, but they do indicate a build failure.
48# Output: logs console
49bberror() {
50 if [ -p ${LOGFIFO} ] ; then
51 printf "%b\0" "bberror $*" > ${LOGFIFO}
52 else
53 echo "ERROR: $*"
54 fi
55}
56
57# Print a fatal error to the log. Fatal errors indicate build failure
58# and halt the build, exiting with an error code.
59# Output: logs console
60bbfatal() {
61 if [ -p ${LOGFIFO} ] ; then
62 printf "%b\0" "bbfatal $*" > ${LOGFIFO}
63 else
64 echo "ERROR: $*"
65 fi
66 exit 1
67}
68
69# Like bbfatal, except prevents the suppression of the error log by
70# bitbake's UI.
71# Output: logs console
72bbfatal_log() {
73 if [ -p ${LOGFIFO} ] ; then
74 printf "%b\0" "bbfatal_log $*" > ${LOGFIFO}
75 else
76 echo "ERROR: $*"
77 fi
78 exit 1
79}
80
81# Print debug messages. These are appropriate for progress checkpoint
82# messages to the logs. Depending on the debug log level, they may also
83# go to the console.
84# Output: logs console
85# Usage: bbdebug 1 "first level debug message"
86# bbdebug 2 "second level debug message"
87bbdebug() {
88 USAGE='Usage: bbdebug [123] "message"'
89 if [ $# -lt 2 ]; then
90 bbfatal "$USAGE"
91 fi
92
93 # Strip off the debug level and ensure it is an integer
94 DBGLVL=$1; shift
95 NONDIGITS=$(echo "$DBGLVL" | tr -d "[:digit:]")
96 if [ "$NONDIGITS" ]; then
97 bbfatal "$USAGE"
98 fi
99
100 # All debug output is printed to the logs
101 if [ -p ${LOGFIFO} ] ; then
102 printf "%b\0" "bbdebug $DBGLVL $*" > ${LOGFIFO}
103 else
104 echo "DEBUG: $*"
105 fi
106}
107