]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
hob/bitbake: custom image is now using the base image
authorCristiana Voicu <cristiana.voicu@intel.com>
Wed, 12 Dec 2012 11:51:51 +0000 (13:51 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 14 Dec 2012 13:06:16 +0000 (13:06 +0000)
Till now, a custom image made in Hob was using only the packages from
the base image. Now it is using everything declared in the base image.
Also next to hob-image.bb, it creates another .bb file which is used
in building process. Those images are ignored by git.

[YOCTO #2601]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/command.py
lib/bb/cooker.py
lib/bb/ui/crumbs/builder.py
lib/bb/ui/crumbs/hobeventhandler.py
lib/bb/ui/crumbs/hoblistmodel.py

index c842497e63bf1864c89f5fa6f1fa335f4ceb7272..0fed25a3ed66af6c299cc7f2c1177e71e0fc905b 100644 (file)
@@ -200,6 +200,16 @@ class CommandsSync:
         filterfunc = params[0]
         bb.parse.parse_py.ConfHandler.confFilters.append(filterfunc)
 
+    def matchFile(self, command, params):
+        fMatch = params[0]
+        return command.cooker.matchFile(fMatch)
+
+    def generateNewImage(self, command, params):
+        image = params[0]
+        base_image = params[1]
+        package_queue = params[2]
+        return command.cooker.generateNewImage(image, base_image, package_queue)
+
 class CommandsAsync:
     """
     A class of asynchronous commands
index 6b58f91c6bde1b1f9c8e5ccd3ab55b4bbdab6823..1d38164f56af16c63587d8fda7923bca50edd931 100644 (file)
@@ -1188,6 +1188,25 @@ class BBCooker:
 
         self.server_registration_cb(buildTargetsIdle, rq)
 
+    def generateNewImage(self, image, base_image, package_queue):
+        '''
+        Create a new image with a "require" base_image statement
+        '''
+        image_name = os.path.splitext(image)[0]
+        timestr = time.strftime("-%Y%m%d-%H%M%S")
+        dest = image_name + str(timestr) + ".bb"
+
+        with open(dest, "w") as imagefile:
+            imagefile.write("require " + base_image + "\n")
+            package_install = "PACKAGE_INSTALL_forcevariable = \""
+            for package in package_queue:
+                package_install += str(package) + " "
+            package_install += "\"\n"
+            imagefile.write(package_install)
+
+        self.state = state.initial
+        return timestr
+
     def updateCache(self):
         if self.state == state.running:
             return
index 2f3d6d0c6c4cb61767ed4cedd41bca5cd17cbe9c..023ac93ae28400842f8bcc95bc8f283868bd3158 100755 (executable)
@@ -611,15 +611,18 @@ class Builder(gtk.Window):
         # Build image
         self.set_user_config()
         toolchain_packages = []
+        base_image = None
         if self.configuration.toolchain_build:
             toolchain_packages = self.package_model.get_selected_packages_toolchain()
         if self.configuration.selected_image == self.recipe_model.__custom_image__:
             packages = self.package_model.get_selected_packages()
             image = self.hob_image
+            base_image = self.configuration.initial_selected_image
         else:
             packages = []
             image = self.configuration.selected_image
         self.handler.generate_image(image,
+                                    base_image,
                                     self.hob_toolchain,
                                     packages,
                                     toolchain_packages,
@@ -1017,7 +1020,8 @@ class Builder(gtk.Window):
             self.parameters.image_names = []
             selected_image = self.recipe_model.get_selected_image()
             if selected_image == self.recipe_model.__custom_image__:
-                linkname = 'hob-image-' + self.configuration.curr_mach
+                version = self.recipe_model.get_custom_image_version()
+                linkname = 'hob-image' + version+ "-" + self.configuration.curr_mach
             else:
                 linkname = selected_image + '-' + self.configuration.curr_mach
             image_extension = self.get_image_extension()
index 8a2ac5fb6c7d23cccd805028d72ecd3ddb33259f..ae853ee3c7c81d92782ad9fabb4337d9d2735dd2 100644 (file)
@@ -166,6 +166,13 @@ class HobHandler(gobject.GObject):
             if self.toolchain_packages:
                 self.runCommand(["setVariable", "TOOLCHAIN_TARGET_TASK", " ".join(self.toolchain_packages)])
                 targets.append(self.toolchain)
+            if targets[0] == "hob-image":
+                hobImage = self.runCommand(["matchFile", "hob-image.bb"])
+                baseImage = self.runCommand(["matchFile", self.base_image + ".bb"])
+                version = self.runCommand(["generateNewImage", hobImage, baseImage, self.package_queue])
+                targets[0] += version
+                self.recipe_model.set_custom_image_version(version)
+
             self.runCommand(["buildTargets", targets, self.default_task])
 
     def display_error(self):
@@ -386,8 +393,9 @@ class HobHandler(gobject.GObject):
         self.commands_async.append(self.SUB_BUILD_RECIPES)
         self.run_next_command(self.GENERATE_PACKAGES)
 
-    def generate_image(self, image, toolchain, image_packages=[], toolchain_packages=[], default_task="build"):
+    def generate_image(self, image, base_image, toolchain, image_packages=[], toolchain_packages=[], default_task="build"):
         self.image = image
+        self.base_image = base_image
         self.toolchain = toolchain
         self.package_queue = image_packages
         self.toolchain_packages = toolchain_packages
index f4ccbc3ae61973046e3798a136b2919addd67255..85c4f51070af11ff04f8d468dd8bf1b54e7f9c23 100644 (file)
@@ -766,3 +766,9 @@ class RecipeListModel(gtk.ListStore):
                           binb="User Selected",
                           image_contents=True)
         self.selection_change_notification()
+
+    def set_custom_image_version(self, version):
+        self.custom_image_version = version
+
+    def get_custom_image_version(self):
+        return self.custom_image_version