From 8927cfe3e25322f1fe0d9bd7e9a94d678b68972c Mon Sep 17 00:00:00 2001 From: Daniel Rossier Date: Sat, 4 Jul 2026 16:43:39 +0200 Subject: [PATCH] usr: clear the attach manifest on do_clean so clean+build is reliable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generic meta-usr fix. The usr build mutates the attached tree (IB_TARGET) in place — e.g. the :lvgl override fetches lib/lvgl and renames its stray CMakeLists.txt (-> __CMakeLists.txt__) to hide them from the recursive CMake glob. Those renames/removals make the next do_attach_infrabase abort: 'sha256sum -c ${IB_TARGET}.attach.sha256' reports the manifest's original entries as FAILED (renamed/missing) -> 'Refusing to re-attach usr-so3'. Clear the manifest in usr.bbclass:do_clean (applies to every usr recipe: usr-so3, usr-linux) so the next attach re-attaches from a fresh fetch+patch instead of checking stale entries. A clean is an explicit reset and the attach still backs the tree up to ${IB_TARGET}.back; the guard stays fully active for builds NOT preceded by a clean. Validated: 'build.sh -xc bsp-so3' (clean+build, :lvgl) now succeeds repeatedly (was failing on the 2nd run). --- build/meta-usr/classes/usr.bbclass | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/build/meta-usr/classes/usr.bbclass b/build/meta-usr/classes/usr.bbclass index 8ab7fed8b1..4c575372f3 100644 --- a/build/meta-usr/classes/usr.bbclass +++ b/build/meta-usr/classes/usr.bbclass @@ -127,11 +127,25 @@ addtask do_clean # "No such file or directory: .../temp/fifo.NNNN". Python tasks create the # temp dir themselves and use no fifo, so they are robust here. python do_clean() { - import shutil + import os, shutil target = d.getVar('IB_TARGET') # Remove the applied patches and the (in-tree) user-space build dir. shutil.rmtree(target + '/patches', ignore_errors=True) shutil.rmtree(target + '/build', ignore_errors=True) + + # Clear the do_attach_infrabase manifest (${IB_TARGET}.attach.sha256) so the + # next attach re-attaches from a fresh fetch+patch instead of aborting with + # "Refusing to re-attach". Generic to every usr recipe: the usr build mutates + # IB_TARGET in place (e.g. the :lvgl override fetches lib/lvgl and renames its + # stray CMakeLists.txt to hide them from the recursive CMake glob), and those + # renames/removals make the manifest's `sha256sum -c` fail on the next attach. + # A clean is an explicit reset, and the attach still backs the tree up to + # ${IB_TARGET}.back, so dropping the manifest here is the safe, generic fix — + # the guard stays fully active for builds that were NOT preceded by a clean. + try: + os.remove(target + '.attach.sha256') + except OSError: + pass }