Skip to contentSkip to conversation

image.bbclass: make sure do_rootfs run from a clean workspace

PATCH In review [email protected] 3 participants 4 messages Mar 12, 2022 – Mar 14, 2022 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 image.bbclass: make sure do_rootfs run from a clean workspace

From: Ming Liu <[email protected]>

Add ${IMAGE_ROOTFS} and ${IMGDEPLOYDIR} to do_rootfs[dirs] and do_rootfs[cleandirs], this ensures do_rootfs run from a clean workspace, with this change, we can now remove two bb.utils.mkdirhier lines from meta/lib/oe/rootfs.py.

Also drop ${S} from do_rootfs[cleandirs], nothing being installed into that directory.

---
 meta/classes/image.bbclass | 4 ++--
 meta/lib/oe/rootfs.py      | 4 ----
 2 files changed, 2 insertions(+), 6 deletions(-)
meta/classes/image.bbclass +2 -2
index 2b0ce4a988..98a0555040 100644
@@ -252,8 +252,8 @@ fakeroot python do_rootfs () {
 
     progress_reporter.finish()
 }
-do_rootfs[dirs] = "${TOPDIR}"
-do_rootfs[cleandirs] += "${S} ${IMGDEPLOYDIR}"
+do_rootfs[dirs] = "${IMAGE_ROOTFS} ${IMGDEPLOYDIR} ${TOPDIR}"
+do_rootfs[cleandirs] += "${IMAGE_ROOTFS} ${IMGDEPLOYDIR}"
 do_rootfs[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}"
 addtask rootfs after do_prepare_recipe_sysroot
 
meta/lib/oe/rootfs.py +0 -4
index b0dd625539..98cf3f244d 100644
@@ -190,10 +190,6 @@ class Rootfs(object, metaclass=ABCMeta):
         post_process_cmds = self.d.getVar("ROOTFS_POSTPROCESS_COMMAND")
         rootfs_post_install_cmds = self.d.getVar('ROOTFS_POSTINSTALL_COMMAND')
 
-        bb.utils.mkdirhier(self.image_rootfs)
-
-        bb.utils.mkdirhier(self.deploydir)
-
         execute_pre_post_process(self.d, pre_process_cmds)
 
         if self.progress_reporter:
Signature · 1 line
2.25.1
#1 lore raw
Quoted 21 lines · Ming Liu

From: Ming Liu <[email protected]>

Add ${IMAGE_ROOTFS} and ${IMGDEPLOYDIR} to do_rootfs[dirs] and do_rootfs[cleandirs], this ensures do_rootfs run from a clean workspace, with this change, we can now remove two bb.utils.mkdirhier lines from meta/lib/oe/rootfs.py.

Also drop ${S} from do_rootfs[cleandirs], nothing being installed into that directory.

---
 meta/classes/image.bbclass | 4 ++--
 meta/lib/oe/rootfs.py      | 4 ----
 2 files changed, 2 insertions(+), 6 deletions(-)
meta/classes/image.bbclass +0 -0
index 2b0ce4a988..98a0555040 100644

meta/classes/image.bbclass fakeroot python do_rootfs () { · line 258

Quoted 9 lines
meta/classes/image.bbclass +2 -2
@@ -252,8 +252,8 @@ fakeroot python do_rootfs () {
 
     progress_reporter.finish()
 }
-do_rootfs[dirs] = "${TOPDIR}"
-do_rootfs[cleandirs] += "${S} ${IMGDEPLOYDIR}"
+do_rootfs[dirs] = "${IMAGE_ROOTFS} ${IMGDEPLOYDIR} ${TOPDIR}"
+do_rootfs[cleandirs] += "${IMAGE_ROOTFS} ${IMGDEPLOYDIR}"
 do_rootfs[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}"
 addtask rootfs after do_prepare_recipe_sysroot

I think the removal of ${S} breaks things:

https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/3279/steps/14/logs/stdio

Cheers,

Richard

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 34 lines · Richard Purdie via lists.openembedded.org
Quoted 21 lines · Ming Liu

From: Ming Liu <[email protected]>

Add ${IMAGE_ROOTFS} and ${IMGDEPLOYDIR} to do_rootfs[dirs] and do_rootfs[cleandirs], this ensures do_rootfs run from a clean workspace, with this change, we can now remove two bb.utils.mkdirhier lines from meta/lib/oe/rootfs.py.

Also drop ${S} from do_rootfs[cleandirs], nothing being installed into that directory.

---
 meta/classes/image.bbclass | 4 ++--
 meta/lib/oe/rootfs.py      | 4 ----
 2 files changed, 2 insertions(+), 6 deletions(-)
meta/classes/image.bbclass +0 -0
index 2b0ce4a988..98a0555040 100644

meta/classes/image.bbclass fakeroot python do_rootfs () { · line 258

Quoted 9 lines
meta/classes/image.bbclass +2 -2
@@ -252,8 +252,8 @@ fakeroot python do_rootfs () {
 
     progress_reporter.finish()
 }
-do_rootfs[dirs] = "${TOPDIR}"
-do_rootfs[cleandirs] += "${S} ${IMGDEPLOYDIR}"
+do_rootfs[dirs] = "${IMAGE_ROOTFS} ${IMGDEPLOYDIR} ${TOPDIR}"
+do_rootfs[cleandirs] += "${IMAGE_ROOTFS} ${IMGDEPLOYDIR}"
 do_rootfs[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}"
 addtask rootfs after do_prepare_recipe_sysroot

I think the removal of ${S} breaks things:

Quoted 1 line

https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/3279/steps/14/logs/stdio

FWIW I've dropped that piece of the patch and merged.

Cheers,

Richard

#4 lore raw
In reply to [email protected]
Quoted 30 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Ming Liu
Sent: den 12 mars 2022 12:53
To: [email protected]
Cc: Ming Liu <[email protected]>
Subject: [OE-core] [PATCH] image.bbclass: make sure do_rootfs run from a clean workspace

From: Ming Liu <[email protected]>

Add ${IMAGE_ROOTFS} and ${IMGDEPLOYDIR} to do_rootfs[dirs] and do_rootfs[cleandirs], this ensures do_rootfs run from a clean workspace, with this change, we can now remove two bb.utils.mkdirhier lines from meta/lib/oe/rootfs.py.

Also drop ${S} from do_rootfs[cleandirs], nothing being installed into that directory.

---
 meta/classes/image.bbclass | 4 ++--
 meta/lib/oe/rootfs.py      | 4 ----
 2 files changed, 2 insertions(+), 6 deletions(-)
meta/classes/image.bbclass +0 -0
index 2b0ce4a988..98a0555040 100644

meta/classes/image.bbclass fakeroot python do_rootfs () { · line 256

Quoted 7 lines
meta/classes/image.bbclass +2 -2
@@ -252,8 +252,8 @@ fakeroot python do_rootfs () {
 
     progress_reporter.finish()
 }
-do_rootfs[dirs] = "${TOPDIR}"
-do_rootfs[cleandirs] += "${S} ${IMGDEPLOYDIR}"
+do_rootfs[dirs] = "${IMAGE_ROOTFS} ${IMGDEPLOYDIR} ${TOPDIR}"
+do_rootfs[cleandirs] += "${IMAGE_ROOTFS} ${IMGDEPLOYDIR}"

There is no reason to include paths in do_rootfs[dirs] if they are also in do_rootfs[cleandirs] (except for the last path in do_rootfs[dirs]). It only leads to bb.utils.mkdirhier() being called for the same directory multiple times.

I have sent a patch series to correct this here and for all other cases I could find. For anyone interested, I used the following incantation to find the culprits:

grep -r 'cleandirs.*".*"' meta | grep -v '${@' | \
perl -ne 'if (/^(.*):(.*)\[.*\].*"(.*)"/) { @vars = split(" ", $3); for $var (@vars) { print("=" x 75, "\n$1 - $2 - $var\n"); system("grep", "--color=always", "$2\\[dirs\\].*\\$var ", $1); } }'

Quoted 18 lines
meta/classes/image.bbclass +0 -0
 do_rootfs[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}"
 addtask rootfs after do_prepare_recipe_sysroot
 
meta/lib/oe/rootfs.py +0 -4
index b0dd625539..98cf3f244d 100644
@@ -190,10 +190,6 @@ class Rootfs(object, metaclass=ABCMeta):
         post_process_cmds = self.d.getVar("ROOTFS_POSTPROCESS_COMMAND")
         rootfs_post_install_cmds =
 self.d.getVar('ROOTFS_POSTINSTALL_COMMAND')
 
-        bb.utils.mkdirhier(self.image_rootfs)
-
-        bb.utils.mkdirhier(self.deploydir)
-
         execute_pre_post_process(self.d, pre_process_cmds)
 
Quoted 3 lines

if self.progress_reporter:
--
2.25.1

//Peter