summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorCristiana Voicu <cristiana.voicu@intel.com>2012-12-12 13:51:51 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-12-14 13:08:49 +0000
commitf9d9cc87c59e309516c3e8db423715139f6a8f62 (patch)
treeeeed21d7dbd0fce3da1e4d9d30d38155a576b473 /bitbake
parenta947b547d0a5f247e39cbc0fae88c0de5438aa7b (diff)
downloadpoky-f9d9cc87c59e309516c3e8db423715139f6a8f62.tar.gz
bitbake: hob/bitbake: custom image is now using the base image
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] (Bitbake rev: 22007cf71a00fbb03b40f97201a6eb06c9aebd16) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/command.py10
-rw-r--r--bitbake/lib/bb/cooker.py19
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py6
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py10
-rw-r--r--bitbake/lib/bb/ui/crumbs/hoblistmodel.py6
5 files changed, 49 insertions, 2 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index c842497e63..0fed25a3ed 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -200,6 +200,16 @@ class CommandsSync:
200 filterfunc = params[0] 200 filterfunc = params[0]
201 bb.parse.parse_py.ConfHandler.confFilters.append(filterfunc) 201 bb.parse.parse_py.ConfHandler.confFilters.append(filterfunc)
202 202
203 def matchFile(self, command, params):
204 fMatch = params[0]
205 return command.cooker.matchFile(fMatch)
206
207 def generateNewImage(self, command, params):
208 image = params[0]
209 base_image = params[1]
210 package_queue = params[2]
211 return command.cooker.generateNewImage(image, base_image, package_queue)
212
203class CommandsAsync: 213class CommandsAsync:
204 """ 214 """
205 A class of asynchronous commands 215 A class of asynchronous commands
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 6b58f91c6b..1d38164f56 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1188,6 +1188,25 @@ class BBCooker:
1188 1188
1189 self.server_registration_cb(buildTargetsIdle, rq) 1189 self.server_registration_cb(buildTargetsIdle, rq)
1190 1190
1191 def generateNewImage(self, image, base_image, package_queue):
1192 '''
1193 Create a new image with a "require" base_image statement
1194 '''
1195 image_name = os.path.splitext(image)[0]
1196 timestr = time.strftime("-%Y%m%d-%H%M%S")
1197 dest = image_name + str(timestr) + ".bb"
1198
1199 with open(dest, "w") as imagefile:
1200 imagefile.write("require " + base_image + "\n")
1201 package_install = "PACKAGE_INSTALL_forcevariable = \""
1202 for package in package_queue:
1203 package_install += str(package) + " "
1204 package_install += "\"\n"
1205 imagefile.write(package_install)
1206
1207 self.state = state.initial
1208 return timestr
1209
1191 def updateCache(self): 1210 def updateCache(self):
1192 if self.state == state.running: 1211 if self.state == state.running:
1193 return 1212 return
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 2f3d6d0c6c..023ac93ae2 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -611,15 +611,18 @@ class Builder(gtk.Window):
611 # Build image 611 # Build image
612 self.set_user_config() 612 self.set_user_config()
613 toolchain_packages = [] 613 toolchain_packages = []
614 base_image = None
614 if self.configuration.toolchain_build: 615 if self.configuration.toolchain_build:
615 toolchain_packages = self.package_model.get_selected_packages_toolchain() 616 toolchain_packages = self.package_model.get_selected_packages_toolchain()
616 if self.configuration.selected_image == self.recipe_model.__custom_image__: 617 if self.configuration.selected_image == self.recipe_model.__custom_image__:
617 packages = self.package_model.get_selected_packages() 618 packages = self.package_model.get_selected_packages()
618 image = self.hob_image 619 image = self.hob_image
620 base_image = self.configuration.initial_selected_image
619 else: 621 else:
620 packages = [] 622 packages = []
621 image = self.configuration.selected_image 623 image = self.configuration.selected_image
622 self.handler.generate_image(image, 624 self.handler.generate_image(image,
625 base_image,
623 self.hob_toolchain, 626 self.hob_toolchain,
624 packages, 627 packages,
625 toolchain_packages, 628 toolchain_packages,
@@ -1017,7 +1020,8 @@ class Builder(gtk.Window):
1017 self.parameters.image_names = [] 1020 self.parameters.image_names = []
1018 selected_image = self.recipe_model.get_selected_image() 1021 selected_image = self.recipe_model.get_selected_image()
1019 if selected_image == self.recipe_model.__custom_image__: 1022 if selected_image == self.recipe_model.__custom_image__:
1020 linkname = 'hob-image-' + self.configuration.curr_mach 1023 version = self.recipe_model.get_custom_image_version()
1024 linkname = 'hob-image' + version+ "-" + self.configuration.curr_mach
1021 else: 1025 else:
1022 linkname = selected_image + '-' + self.configuration.curr_mach 1026 linkname = selected_image + '-' + self.configuration.curr_mach
1023 image_extension = self.get_image_extension() 1027 image_extension = self.get_image_extension()
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 8a2ac5fb6c..ae853ee3c7 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -166,6 +166,13 @@ class HobHandler(gobject.GObject):
166 if self.toolchain_packages: 166 if self.toolchain_packages:
167 self.runCommand(["setVariable", "TOOLCHAIN_TARGET_TASK", " ".join(self.toolchain_packages)]) 167 self.runCommand(["setVariable", "TOOLCHAIN_TARGET_TASK", " ".join(self.toolchain_packages)])
168 targets.append(self.toolchain) 168 targets.append(self.toolchain)
169 if targets[0] == "hob-image":
170 hobImage = self.runCommand(["matchFile", "hob-image.bb"])
171 baseImage = self.runCommand(["matchFile", self.base_image + ".bb"])
172 version = self.runCommand(["generateNewImage", hobImage, baseImage, self.package_queue])
173 targets[0] += version
174 self.recipe_model.set_custom_image_version(version)
175
169 self.runCommand(["buildTargets", targets, self.default_task]) 176 self.runCommand(["buildTargets", targets, self.default_task])
170 177
171 def display_error(self): 178 def display_error(self):
@@ -386,8 +393,9 @@ class HobHandler(gobject.GObject):
386 self.commands_async.append(self.SUB_BUILD_RECIPES) 393 self.commands_async.append(self.SUB_BUILD_RECIPES)
387 self.run_next_command(self.GENERATE_PACKAGES) 394 self.run_next_command(self.GENERATE_PACKAGES)
388 395
389 def generate_image(self, image, toolchain, image_packages=[], toolchain_packages=[], default_task="build"): 396 def generate_image(self, image, base_image, toolchain, image_packages=[], toolchain_packages=[], default_task="build"):
390 self.image = image 397 self.image = image
398 self.base_image = base_image
391 self.toolchain = toolchain 399 self.toolchain = toolchain
392 self.package_queue = image_packages 400 self.package_queue = image_packages
393 self.toolchain_packages = toolchain_packages 401 self.toolchain_packages = toolchain_packages
diff --git a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
index f4ccbc3ae6..85c4f51070 100644
--- a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
+++ b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
@@ -766,3 +766,9 @@ class RecipeListModel(gtk.ListStore):
766 binb="User Selected", 766 binb="User Selected",
767 image_contents=True) 767 image_contents=True)
768 self.selection_change_notification() 768 self.selection_change_notification()
769
770 def set_custom_image_version(self, version):
771 self.custom_image_version = version
772
773 def get_custom_image_version(self):
774 return self.custom_image_version