[2/3] buildchroot: delay expansion of variable BUILDCHROOT_DIR

Message ID 20220719123954.310076-3-adriaan.schmidt@siemens.com
State Accepted, archived
Headers show
Series image and buildchroot tweaks | expand

Commit Message

Schmidt, Adriaan July 19, 2022, 4:39 a.m. UTC
The current implementation expands ${BUILDCHROOT_DIR_HOST|TARGET} during
assignment to BUILDCHROOT_DIR, which leads to absolute paths in signatures.
This can be observed in IMAGE_CMD_* and CONVERSION_CMD_*, and is bad for caching.

Thus, we delay expansion, and due to the way the do_image_* tasks are created,
the paths in our signatures will be relative to ${TMPDIR} (no expansion).

Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
---
 meta/classes/buildchroot.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index 11489661..f56c335b 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -12,10 +12,10 @@  python __anonymous() {
     if mode == "0" or d.getVar('HOST_ARCH') ==  distro_arch or \
        (d.getVar('HOST_DISTRO') == "debian-stretch" and distro_arch == "i386"):
         dep = "buildchroot-target:do_build"
-        rootfs = d.getVar('BUILDCHROOT_TARGET_DIR', True)
+        rootfs = d.getVar('BUILDCHROOT_TARGET_DIR', False)
     else:
         dep = "buildchroot-host:do_build"
-        rootfs = d.getVar('BUILDCHROOT_HOST_DIR', True)
+        rootfs = d.getVar('BUILDCHROOT_HOST_DIR', False)
 
     d.setVar('BUILDCHROOT_DEP', dep)
     d.setVar('BUILDCHROOT_DIR', rootfs)