diff options
author | Alassane Yattara <alassane.yattara@savoirfairelinux.com> | 2023-10-27 01:36:30 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-10-27 08:32:29 +0100 |
commit | 7e0cce4f6b754e33a0652b516d622b6b40b3abd7 (patch) | |
tree | 70c1a56a25d68a77aa17f429085007c127f08aba /bitbake/bin | |
parent | 6c43e8403203805fa23171be80deb7717def034a (diff) | |
download | poky-7e0cce4f6b754e33a0652b516d622b6b40b3abd7.tar.gz |
bitbake: toaster: Write logs to BUILDDIR/toaster_logs
Fixes "2efb14648 toaster: Monitoring - implement Django logging system" when
running in a container.
When running in a container, the previous approach of using BASE_DIR
is not a writable path. Also, we really do not want to be writing logs into
the source tree, as the BASE_DIR was resolving to bitbake/lib/toaster/logs
Since Toaster is only ever running in an environment where oe-init-buildenv
or similar has been sourced, we should instead write the logs to BUILDDIR.
Using BUILDDIR to logs make path writable but django-log-viewer does'nt manage
to write logs using an absolute path as BUILDDIR, where the existing toaster_ui.log
was already being written.
Also drop the /logs/ directory, as it has not been created which also breaks
in a container environment
To handle the constraints linked to django-log-viewer and /logs/, we've updated
bitbake/bin/toaster to create a toaster_logs/ directory in BUILDDIR if it doesn't exist,
when toaster starts up.
Also manage to set BUILDDIR/toaster_logs/ as default location for toaster logs.
(Bitbake rev: efbd9d54f57be7a7a10f0b56e7e62c25974e99e6)
Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Tested-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-x | bitbake/bin/toaster | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster index 558a819570..f002c8c159 100755 --- a/bitbake/bin/toaster +++ b/bitbake/bin/toaster | |||
@@ -84,7 +84,7 @@ webserverStartAll() | |||
84 | echo "Starting webserver..." | 84 | echo "Starting webserver..." |
85 | 85 | ||
86 | $MANAGE runserver --noreload "$ADDR_PORT" \ | 86 | $MANAGE runserver --noreload "$ADDR_PORT" \ |
87 | </dev/null >>${BUILDDIR}/toaster_web.log 2>&1 \ | 87 | </dev/null >>${TOASTER_LOGS_DIR}/web.log 2>&1 \ |
88 | & echo $! >${BUILDDIR}/.toastermain.pid | 88 | & echo $! >${BUILDDIR}/.toastermain.pid |
89 | 89 | ||
90 | sleep 1 | 90 | sleep 1 |
@@ -181,6 +181,14 @@ WEBSERVER=1 | |||
181 | export TOASTER_BUILDSERVER=1 | 181 | export TOASTER_BUILDSERVER=1 |
182 | ADDR_PORT="localhost:8000" | 182 | ADDR_PORT="localhost:8000" |
183 | TOASTERDIR=`dirname $BUILDDIR` | 183 | TOASTERDIR=`dirname $BUILDDIR` |
184 | # ${BUILDDIR}/toaster_logs/ became the default location for toaster logs | ||
185 | # This is needed for implemented django-log-viewer: https://pypi.org/project/django-log-viewer/ | ||
186 | # If the directory does not exist, create it. | ||
187 | TOASTER_LOGS_DIR="${BUILDDIR}/toaster_logs/" | ||
188 | if [ ! -d $TOASTER_LOGS_DIR ] | ||
189 | then | ||
190 | mkdir $TOASTER_LOGS_DIR | ||
191 | fi | ||
184 | unset CMD | 192 | unset CMD |
185 | for param in $*; do | 193 | for param in $*; do |
186 | case $param in | 194 | case $param in |
@@ -299,7 +307,7 @@ case $CMD in | |||
299 | export BITBAKE_UI='toasterui' | 307 | export BITBAKE_UI='toasterui' |
300 | if [ $TOASTER_BUILDSERVER -eq 1 ] ; then | 308 | if [ $TOASTER_BUILDSERVER -eq 1 ] ; then |
301 | $MANAGE runbuilds \ | 309 | $MANAGE runbuilds \ |
302 | </dev/null >>${BUILDDIR}/toaster_runbuilds.log 2>&1 \ | 310 | </dev/null >>${TOASTER_LOGS_DIR}/toaster_runbuilds.log 2>&1 \ |
303 | & echo $! >${BUILDDIR}/.runbuilds.pid | 311 | & echo $! >${BUILDDIR}/.runbuilds.pid |
304 | else | 312 | else |
305 | echo "Toaster build server not started." | 313 | echo "Toaster build server not started." |