Openembedded Core Discussions
 help / color / mirror / Atom feed
* [RFC PATCH 2/3] image: Move pre/post process commands to bbclass
@ 2015-12-28 13:00 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2015-12-28 13:00 UTC (permalink / raw)
  To: openembedded-core


Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index bee7d63..fe14b86 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -345,16 +345,37 @@ fakeroot python do_rootfs () {
 
 fakeroot python do_image () {
     from oe.image import create_image
+    from oe.image import Image
+    from oe.utils import execute_pre_post_process
 
-    # generate final images
-    create_image(d)
+    i = Image(d)
+
+    pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND", True)
+
+    execute_pre_post_process(d, pre_process_cmds)
+
+    i._remove_old_symlinks()
+
+    i.create()
 }
 
-do_images[dirs] = "${TOPDIR}"
+do_image[dirs] = "${TOPDIR}"
 do_image[lockfiles] += "${IMAGE_ROOTFS}.lock"
 do_image[umask] = "022"
 addtask do_image after do_rootfs before do_build
 
+fakeroot python do_image_complete () {
+    from oe.utils import execute_pre_post_process
+
+    post_process_cmds = d.getVar("IMAGE_POSTPROCESS_COMMAND", True)
+
+    execute_pre_post_process(d, post_process_cmds)
+}
+do_image_complete[dirs] = "${TOPDIR}"
+do_image_complete[lockfiles] += "${IMAGE_ROOTFS}.lock"
+do_image_complete[umask] = "022"
+addtask do_image_complete after do_image before do_build
+
 insert_feed_uris () {
 	
 	echo "Building feeds for [${DISTRO}].."
diff --git a/meta/lib/oe/image.py b/meta/lib/oe/image.py
index 52ac1e75..b2b002b 100644
--- a/meta/lib/oe/image.py
+++ b/meta/lib/oe/image.py
@@ -351,12 +351,6 @@ class Image(ImageDepGraph):
 
     def create(self):
         bb.note("###### Generate images #######")
-        pre_process_cmds = self.d.getVar("IMAGE_PREPROCESS_COMMAND", True)
-        post_process_cmds = self.d.getVar("IMAGE_POSTPROCESS_COMMAND", True)
-
-        execute_pre_post_process(self.d, pre_process_cmds)
-
-        self._remove_old_symlinks()
 
         image_cmd_groups = self._get_imagecmds()
 
@@ -406,9 +400,6 @@ class Image(ImageDepGraph):
                     bb.note("Creating symlinks for %s image ..." % image_type)
                     self._create_symlinks(subimages)
 
-        execute_pre_post_process(self.d, post_process_cmds)
-
-
 def create_image(d):
     Image(d).create()
 




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-12-28 13:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-28 13:00 [RFC PATCH 2/3] image: Move pre/post process commands to bbclass Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox