public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Amy Fong <amy.fong.3142@gmail.com>
To: isar-users@googlegroups.com
Cc: Amy Fong <amy.fong@siemens.com>
Subject: [PATCH 2/2] error directory creation
Date: Wed,  8 Jan 2025 10:57:04 -0500	[thread overview]
Message-ID: <20250108155703.10376-2-amy.fong.3142@gmail.com> (raw)
In-Reply-To: <20250108155703.10376-1-amy.fong.3142@gmail.com>

From: Amy Fong <amy.fong@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.fong@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

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250108155703.10376-2-amy.fong.3142%40gmail.com.

  reply	other threads:[~2025-01-08 20:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08 15:57 [PATCH 1/2] base.bbclass: Enable the addition of epoch in an apt SRC_URI's version Amy Fong
2025-01-08 15:57 ` Amy Fong [this message]
2025-01-08 20:56   ` [PATCH 2/2] error directory creation 'Jan Kiszka' via isar-users
2025-01-09  3:43     ` Amy Fong
2025-01-09  6:45       ` 'Jan Kiszka' via isar-users
2025-01-08 20:57 ` [PATCH 1/2] base.bbclass: Enable the addition of epoch in an apt SRC_URI's version 'Jan Kiszka' via isar-users
2025-01-16  7:03 ` Uladzimir Bely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250108155703.10376-2-amy.fong.3142@gmail.com \
    --to=amy.fong.3142@gmail.com \
    --cc=amy.fong@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox