From: Peter Hoyes <peter.ho...@arm.com>

write_image_test_data is currently a ROOTFS_POSTPROCESS_COMMAND, even
though it does not act on the rootfs. Additionally it is only required
when running testimage.

Promote it to its own task, to decouple it from rootfs generation, and
move it to testimage.bbclass

Signed-off-by: Peter Hoyes <peter.ho...@arm.com>
---
 .../rootfs-postcommands.bbclass               | 23 -------------------
 meta/classes-recipe/testimage.bbclass         | 21 +++++++++++++++++
 2 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass 
b/meta/classes-recipe/rootfs-postcommands.bbclass
index 690fa976aa..ad7e7ccd8b 100644
--- a/meta/classes-recipe/rootfs-postcommands.bbclass
+++ b/meta/classes-recipe/rootfs-postcommands.bbclass
@@ -33,9 +33,6 @@ ROOTFS_POSTPROCESS_COMMAND += 
'${@bb.utils.contains("IMAGE_FEATURES", "read-only
 # and we don't want to disable such a default that by setting a value here.
 APPEND:append = '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", " 
ro", "", d)}'
 
-# Generates test data file with data store variables expanded in json format
-ROOTFS_POSTPROCESS_COMMAND += "write_image_test_data; "
-
 # Write manifest
 IMAGE_MANIFEST = "${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.manifest"
 ROOTFS_POSTUNINSTALL_COMMAND =+ "write_image_manifest ; "
@@ -368,26 +365,6 @@ rootfs_sysroot_relativelinks () {
        sysroot-relativelinks.py ${SDK_OUTPUT}/${SDKTARGETSYSROOT}
 }
 
-# Generated test data json file
-python write_image_test_data() {
-    from oe.data import export2json
-
-    deploy_dir = d.getVar('IMGDEPLOYDIR')
-    link_name = d.getVar('IMAGE_LINK_NAME')
-    testdata_name = os.path.join(deploy_dir, "%s.testdata.json" % 
d.getVar('IMAGE_NAME'))
-
-    searchString = "%s/"%(d.getVar("TOPDIR")).replace("//","/")
-    export2json(d, testdata_name, searchString=searchString, replaceString="")
-
-    if os.path.exists(testdata_name) and link_name:
-        testdata_link = os.path.join(deploy_dir, "%s.testdata.json" % 
link_name)
-        if testdata_link != testdata_name:
-            if os.path.lexists(testdata_link):
-                os.remove(testdata_link)
-            os.symlink(os.path.basename(testdata_name), testdata_link)
-}
-write_image_test_data[vardepsexclude] += "TOPDIR"
-
 # Check for unsatisfied recommendations (RRECOMMENDS)
 python rootfs_log_check_recommends() {
     log_path = d.expand("${T}/log.do_rootfs")
diff --git a/meta/classes-recipe/testimage.bbclass 
b/meta/classes-recipe/testimage.bbclass
index b48cd96575..b23340420f 100644
--- a/meta/classes-recipe/testimage.bbclass
+++ b/meta/classes-recipe/testimage.bbclass
@@ -100,6 +100,27 @@ TESTIMAGE_DUMP_DIR ?= "${LOG_DIR}/runtime-hostdump/"
 
 TESTIMAGE_UPDATE_VARS ?= "DL_DIR WORKDIR DEPLOY_DIR_IMAGE IMAGE_LINK_NAME"
 
+# Generated test data json file
+python do_write_image_test_data() {
+    from oe.data import export2json
+
+    deploy_dir = d.getVar('IMGDEPLOYDIR')
+    link_name = d.getVar('IMAGE_LINK_NAME')
+    testdata_name = os.path.join(deploy_dir, "%s.testdata.json" % 
d.getVar('IMAGE_NAME'))
+
+    searchString = "%s/"%(d.getVar("TOPDIR")).replace("//","/")
+    export2json(d, testdata_name, searchString=searchString, replaceString="")
+
+    if os.path.exists(testdata_name) and link_name:
+        testdata_link = os.path.join(deploy_dir, "%s.testdata.json" % 
link_name)
+        if testdata_link != testdata_name:
+            if os.path.lexists(testdata_link):
+                os.remove(testdata_link)
+            os.symlink(os.path.basename(testdata_name), testdata_link)
+}
+do_write_image_test_data[vardepsexclude] += "TOPDIR"
+addtask write_image_test_data after do_rootfs before do_image_complete
+
 testimage_dump_target () {
     top -bn1
     ps
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#182704): 
https://lists.openembedded.org/g/openembedded-core/message/182704
Mute This Topic: https://lists.openembedded.org/mt/99501785/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to