summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-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