[bitbake-devel] [PATCH 07/10] ui/hob: enable building an image with minimal contents
Joshua Lock
josh at linux.intel.com
Tue Jul 26 18:46:41 UTC 2011
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]
Signed-off-by: Joshua Lock <josh at linux.intel.com>
---
lib/bb/ui/crumbs/tasklistmodel.py | 14 ++++++++++++--
lib/bb/ui/hob.py | 23 ++++++++++++++++++-----
2 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/lib/bb/ui/crumbs/tasklistmodel.py b/lib/bb/ui/crumbs/tasklistmodel.py
index f4dffc6..36a5673 100644
--- a/lib/bb/ui/crumbs/tasklistmodel.py
+++ b/lib/bb/ui/crumbs/tasklistmodel.py
@@ -60,9 +60,19 @@ require %s
IMAGE_INSTALL += "%s"
"""
- meta_path = model.find_image_path(self.base_image)
- recipe = template % (meta_path, self.userpkgs)
+ empty_template = """
+# Recipe generated by the HOB
+
+inherit core-image
+
+IMAGE_INSTALL = "%s"
+"""
+ if self.base_image and not self.base_image == "empty":
+ meta_path = model.find_image_path(self.base_image)
+ recipe = template % (meta_path, self.userpkgs)
+ else:
+ recipe = empty_template % self.allpkgs
if os.path.exists(writepath):
os.rename(writepath, "%s~" % writepath)
diff --git a/lib/bb/ui/hob.py b/lib/bb/ui/hob.py
index 865933c..d3442c5 100644
--- a/lib/bb/ui/hob.py
+++ b/lib/bb/ui/hob.py
@@ -369,20 +369,31 @@ class MainWindow (gtk.Window):
self.dirty = False
def bake_clicked_cb(self, button):
+ build_image = True
+
rep = self.model.get_build_rep()
if not rep.base_image:
- lbl = "<b>Build only packages?</b>\n\nAn image has not been selected, so only the selected packages will be built."
+ lbl = "<b>Build empty image or only packages?</b>\nA base image"
+ lbl = lbl + " has not been selected.\n\'Empty image' will build"
+ lbl = lbl + " an image with only the selected packages as its"
+ lbl = lbl + " contents.\n'Packages Only' will build only the"
+ lbl = lbl + " selected packages, no image will be created"
dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_WARNING)
dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
- dialog.add_button("Build", gtk.RESPONSE_YES)
+ dialog.add_button("Empty Image", gtk.RESPONSE_OK)
+ dialog.add_button("Packages Only", gtk.RESPONSE_YES)
response = dialog.run()
dialog.destroy()
if response == gtk.RESPONSE_CANCEL:
return
- else:
- self.handler.build_packages(rep.allpkgs.split(" "))
- else:
+ elif response == gtk.RESPONSE_YES:
+ build_image = False
+ elif response == gtk.RESPONSE_OK:
+ rep.base_image = "empty"
+
+ if build_image:
import tempfile, datetime
+
image_name = "hob-%s-variant-%s" % (rep.base_image, datetime.date.today().isoformat())
image_file = "%s.bb" % (image_name)
image_dir = os.path.join(tempfile.gettempdir(), 'hob-images')
@@ -397,6 +408,8 @@ class MainWindow (gtk.Window):
self.files_to_clean.append(recipepath)
self.handler.build_image(image_name, image_dir, self.configurator)
+ else:
+ self.handler.build_packages(rep.allpkgs.split(" "))
self.nb.set_current_page(1)
--
1.7.6
More information about the bitbake-devel
mailing list