summaryrefslogtreecommitdiffstats
path: root/meta/classes/logging.bbclass
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-07-14 09:54:46 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-16 15:09:24 +0100
commite60597abb73807768e577645713f81b9d447f184 (patch)
treed7089e6ef6fd5937df343ace11fbc32e68992444 /meta/classes/logging.bbclass
parentddc1df3e80b2c42a2bda7ddab8fd26c367290c99 (diff)
downloadpoky-e60597abb73807768e577645713f81b9d447f184.tar.gz
classes/logging: allow shell message functions to work in devshell
Fix a regression caused by the shell message changes - if you run a shell task's runfile, the task isn't actually running in BitBake and thus the message FIFO won't exist - so we should just fall back to printing the message with echo as we did before so that the run files are still useful. (From OE-Core rev: 607d3306f7abef057693dcb6aac1f7b26880181d) 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.bbclass42
1 files changed, 35 insertions, 7 deletions
diff --git a/meta/classes/logging.bbclass b/meta/classes/logging.bbclass
index 6b24839af5..06c7c31c3e 100644
--- a/meta/classes/logging.bbclass
+++ b/meta/classes/logging.bbclass
@@ -9,34 +9,54 @@ LOGFIFO = "${T}/fifo.${@os.getpid()}"
9# tasks that should be seen on the console. Use sparingly. 9# tasks that should be seen on the console. Use sparingly.
10# Output: logs console 10# Output: logs console
11bbplain() { 11bbplain() {
12 printf "%b\0" "bbplain $*" > ${LOGFIFO} 12 if [ -p ${LOGFIFO} ] ; then
13 printf "%b\0" "bbplain $*" > ${LOGFIFO}
14 else
15 echo "$*"
16 fi
13} 17}
14 18
15# Notify the user of a noteworthy condition. 19# Notify the user of a noteworthy condition.
16# Output: logs 20# Output: logs
17bbnote() { 21bbnote() {
18 printf "%b\0" "bbnote $*" > ${LOGFIFO} 22 if [ -p ${LOGFIFO} ] ; then
23 printf "%b\0" "bbnote $*" > ${LOGFIFO}
24 else
25 echo "NOTE: $*"
26 fi
19} 27}
20 28
21# Print a warning to the log. Warnings are non-fatal, and do not 29# Print a warning to the log. Warnings are non-fatal, and do not
22# indicate a build failure. 30# indicate a build failure.
23# Output: logs console 31# Output: logs console
24bbwarn() { 32bbwarn() {
25 printf "%b\0" "bbwarn $*" > ${LOGFIFO} 33 if [ -p ${LOGFIFO} ] ; then
34 printf "%b\0" "bbwarn $*" > ${LOGFIFO}
35 else
36 echo "WARNING: $*"
37 fi
26} 38}
27 39
28# Print an error to the log. Errors are non-fatal in that the build can 40# Print an error to the log. Errors are non-fatal in that the build can
29# continue, but they do indicate a build failure. 41# continue, but they do indicate a build failure.
30# Output: logs console 42# Output: logs console
31bberror() { 43bberror() {
32 printf "%b\0" "bberror $*" > ${LOGFIFO} 44 if [ -p ${LOGFIFO} ] ; then
45 printf "%b\0" "bberror $*" > ${LOGFIFO}
46 else
47 echo "ERROR: $*"
48 fi
33} 49}
34 50
35# Print a fatal error to the log. Fatal errors indicate build failure 51# Print a fatal error to the log. Fatal errors indicate build failure
36# and halt the build, exiting with an error code. 52# and halt the build, exiting with an error code.
37# Output: logs console 53# Output: logs console
38bbfatal() { 54bbfatal() {
39 printf "%b\0" "bbfatal $*" > ${LOGFIFO} 55 if [ -p ${LOGFIFO} ] ; then
56 printf "%b\0" "bbfatal $*" > ${LOGFIFO}
57 else
58 echo "ERROR: $*"
59 fi
40 exit 1 60 exit 1
41} 61}
42 62
@@ -44,7 +64,11 @@ bbfatal() {
44# bitbake's UI. 64# bitbake's UI.
45# Output: logs console 65# Output: logs console
46bbfatal_log() { 66bbfatal_log() {
47 printf "%b\0" "bbfatal_log $*" > ${LOGFIFO} 67 if [ -p ${LOGFIFO} ] ; then
68 printf "%b\0" "bbfatal_log $*" > ${LOGFIFO}
69 else
70 echo "ERROR: $*"
71 fi
48 exit 1 72 exit 1
49} 73}
50 74
@@ -68,6 +92,10 @@ bbdebug() {
68 fi 92 fi
69 93
70 # All debug output is printed to the logs 94 # All debug output is printed to the logs
71 printf "%b\0" "bbdebug $DBGLVL $*" > ${LOGFIFO} 95 if [ -p ${LOGFIFO} ] ; then
96 printf "%b\0" "bbdebug $DBGLVL $*" > ${LOGFIFO}
97 else
98 echo "DEBUG: $*"
99 fi
72} 100}
73 101