summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2011-07-20 15:35:29 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-26 20:15:48 +0100
commitc884b52dd0b790d6e3686be4260a3cceff8846bd (patch)
treeefd9c5a292ee238f5d2e8d8dec94737053ddbb3f /bitbake/lib/bb
parent20101e9544fe596577bd4b407404feab65bc7767 (diff)
downloadpoky-c884b52dd0b790d6e3686be4260a3cceff8846bd.tar.gz
ui/hob: enable building an image with minimal contents
This patch enables a user to build a rootfs containing only the selected packages without having to have first selected a 'Base image'. Fixes [YOCTO #1239] (Bitbake rev: 05c82da31a69c910e72b58b07afcd9fca8c55479) Signed-off-by: Joshua Lock <josh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/ui/crumbs/tasklistmodel.py14
-rw-r--r--bitbake/lib/bb/ui/hob.py23
2 files changed, 30 insertions, 7 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/tasklistmodel.py b/bitbake/lib/bb/ui/crumbs/tasklistmodel.py
index f4dffc6a60..36a56736db 100644
--- a/bitbake/lib/bb/ui/crumbs/tasklistmodel.py
+++ b/bitbake/lib/bb/ui/crumbs/tasklistmodel.py
@@ -60,9 +60,19 @@ require %s
60 60
61IMAGE_INSTALL += "%s" 61IMAGE_INSTALL += "%s"
62""" 62"""
63 meta_path = model.find_image_path(self.base_image)
64 63
65 recipe = template % (meta_path, self.userpkgs) 64 empty_template = """
65# Recipe generated by the HOB
66
67inherit core-image
68
69IMAGE_INSTALL = "%s"
70"""
71 if self.base_image and not self.base_image == "empty":
72 meta_path = model.find_image_path(self.base_image)
73 recipe = template % (meta_path, self.userpkgs)
74 else:
75 recipe = empty_template % self.allpkgs
66 76
67 if os.path.exists(writepath): 77 if os.path.exists(writepath):
68 os.rename(writepath, "%s~" % writepath) 78 os.rename(writepath, "%s~" % writepath)
diff --git a/bitbake/lib/bb/ui/hob.py b/bitbake/lib/bb/ui/hob.py
index 865933c95a..d3442c518c 100644
--- a/bitbake/lib/bb/ui/hob.py
+++ b/bitbake/lib/bb/ui/hob.py
@@ -369,20 +369,31 @@ class MainWindow (gtk.Window):
369 self.dirty = False 369 self.dirty = False
370 370
371 def bake_clicked_cb(self, button): 371 def bake_clicked_cb(self, button):
372 build_image = True
373
372 rep = self.model.get_build_rep() 374 rep = self.model.get_build_rep()
373 if not rep.base_image: 375 if not rep.base_image:
374 lbl = "<b>Build only packages?</b>\n\nAn image has not been selected, so only the selected packages will be built." 376 lbl = "<b>Build empty image or only packages?</b>\nA base image"
377 lbl = lbl + " has not been selected.\n\'Empty image' will build"
378 lbl = lbl + " an image with only the selected packages as its"
379 lbl = lbl + " contents.\n'Packages Only' will build only the"
380 lbl = lbl + " selected packages, no image will be created"
375 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) 381 dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_WARNING)
376 dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) 382 dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
377 dialog.add_button("Build", gtk.RESPONSE_YES) 383 dialog.add_button("Empty Image", gtk.RESPONSE_OK)
384 dialog.add_button("Packages Only", gtk.RESPONSE_YES)
378 response = dialog.run() 385 response = dialog.run()
379 dialog.destroy() 386 dialog.destroy()
380 if response == gtk.RESPONSE_CANCEL: 387 if response == gtk.RESPONSE_CANCEL:
381 return 388 return
382 else: 389 elif response == gtk.RESPONSE_YES:
383 self.handler.build_packages(rep.allpkgs.split(" ")) 390 build_image = False
384 else: 391 elif response == gtk.RESPONSE_OK:
392 rep.base_image = "empty"
393
394 if build_image:
385 import tempfile, datetime 395 import tempfile, datetime
396
386 image_name = "hob-%s-variant-%s" % (rep.base_image, datetime.date.today().isoformat()) 397 image_name = "hob-%s-variant-%s" % (rep.base_image, datetime.date.today().isoformat())
387 image_file = "%s.bb" % (image_name) 398 image_file = "%s.bb" % (image_name)
388 image_dir = os.path.join(tempfile.gettempdir(), 'hob-images') 399 image_dir = os.path.join(tempfile.gettempdir(), 'hob-images')
@@ -397,6 +408,8 @@ class MainWindow (gtk.Window):
397 self.files_to_clean.append(recipepath) 408 self.files_to_clean.append(recipepath)
398 409
399 self.handler.build_image(image_name, image_dir, self.configurator) 410 self.handler.build_image(image_name, image_dir, self.configurator)
411 else:
412 self.handler.build_packages(rep.allpkgs.split(" "))
400 413
401 self.nb.set_current_page(1) 414 self.nb.set_current_page(1)
402 415