[PATCH 2/2] error directory creation

11 views
Skip to first unread message

Amy Fong

unread,
Jan 8, 2025, 3:32:01 PM1/8/25
to isar-...@googlegroups.com, Amy Fong
From: Amy Fong <amy....@siemens.com>

On a build, create a directory that gets populated
with temp directories of recipes that fail to build.

The variable ERROR_DIR defines this directory, defaults
to ${TOPDIR}/errorLogs

Signed-off-by: Amy Fong <amy....@siemens.com>
---
bitbake/lib/bb/build.py | 10 ++++++++++
bitbake/lib/bb/runqueue.py | 6 ++++++
meta/conf/bitbake.conf | 2 ++
3 files changed, 18 insertions(+)

diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 44d08f5c..1c8ad032 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -25,6 +25,7 @@ import bb
import bb.msg
import bb.process
import bb.progress
+import shutil
from io import StringIO
from bb import data, event, utils

@@ -103,6 +104,15 @@ class TaskFailed(TaskBase):
def __init__(self, task, fn, logfile, metadata, errprinted = False):
self.errprinted = errprinted
super(TaskFailed, self).__init__(task, fn, logfile, metadata)
+ d = metadata
+ errorDir = d.getVar('ERROR_DIR')
+ if errorDir is not None:
+ pkg = d.getVar("PF")
+ newtmp = os.path.join(errorDir, pkg)
+ if os.path.exists(newtmp):
+ shutil.rmtree(newtmp)
+ tempdir = d.getVar('T')
+ shutil.copytree(tempdir, newtmp)

class TaskFailedSilent(TaskBase):
"""Task execution failed (silently)"""
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index bc7e1817..a77749c3 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -25,6 +25,7 @@ from multiprocessing import Process
import shlex
import pprint
import time
+import shutil

bblogger = logging.getLogger("BitBake")
logger = logging.getLogger("BitBake.RunQueue")
@@ -1334,6 +1335,11 @@ class RunQueue:
self.rqexe = None
self.worker = {}
self.fakeworker = {}
+ errorDir = self.cfgData.getVar('ERROR_DIR')
+ if errorDir is not None:
+ if os.path.exists(errorDir):
+ shutil.rmtree(errorDir)
+ os.mkdir(errorDir)

@staticmethod
def send_pickled_data(worker, data, name):
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index ef408faa..f345b9cb 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -200,3 +200,5 @@ PATCHRESOLVE ?= "noop"

PREFERRED_PROVIDER_bootstrap-host ??= "isar-mmdebstrap-host"
PREFERRED_PROVIDER_bootstrap-target ??= "isar-mmdebstrap-target"
+
+ERROR_DIR ?= "${TOPDIR}/errorLogs"
--
2.39.5

Jan Kiszka

unread,
Jan 8, 2025, 3:56:12 PM1/8/25
to Amy Fong, isar-...@googlegroups.com, Amy Fong
On 08.01.25 16:57, Amy Fong wrote:
> From: Amy Fong <amy....@siemens.com>
>
> On a build, create a directory that gets populated
> with temp directories of recipes that fail to build.
>
> The variable ERROR_DIR defines this directory, defaults
> to ${TOPDIR}/errorLogs

This is missing a reason why we want this. I'm also not seeing something
similar in OE.

Jan
Siemens AG, Foundational Technologies
Linux Expert Center

Amy Fong

unread,
Jan 8, 2025, 10:43:47 PM1/8/25
to Jan Kiszka, isar-...@googlegroups.com, Amy Fong
The motivation for creating this error logs directory is to facilitate troubleshooting
build failures -- after experiencing first hand working with developers not being able
to find error logs...

Amy

Jan Kiszka

unread,
Jan 9, 2025, 1:45:06 AM1/9/25
to Amy Fong, isar-...@googlegroups.com, Amy Fong
On 09.01.25 04:43, Amy Fong wrote:
> The motivation for creating this error logs directory is to facilitate
> troubleshooting
> build failures -- after experiencing first hand working with developers
> not being able
> to find error logs...

That is rather a documentation topic, I would say. And bitbake even
prints out where it left the logs for a task that failed.

Jan

>
> On Wed, Jan 8, 2025 at 3:56 PM Jan Kiszka <jan.k...@siemens.com
> <mailto:jan.k...@siemens.com>> wrote:
>
> On 08.01.25 16:57, Amy Fong wrote:
> > From: Amy Fong <amy....@siemens.com <mailto:amy....@siemens.com>>
> >
> > On a build, create a directory that gets populated
> > with temp directories of recipes that fail to build.
> >
> > The variable ERROR_DIR defines this directory, defaults
> > to ${TOPDIR}/errorLogs
>
> This is missing a reason why we want this. I'm also not seeing something
> similar in OE.
>
> Jan
>
> >
> > Signed-off-by: Amy Fong <amy....@siemens.com
> <mailto:amy....@siemens.com>>
Reply all
Reply to author
Forward
0 new messages