* [PatchV2] hob/bitbake: custom image is now using the base image
@ 2012-12-11 13:44 Cristiana Voicu
2012-12-11 15:48 ` Richard Purdie
0 siblings, 1 reply; 2+ messages in thread
From: Cristiana Voicu @ 2012-12-11 13:44 UTC (permalink / raw)
To: bitbake-devel
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>
---
.gitignore | 1 +
bitbake/lib/bb/command.py | 10 ++++++++++
bitbake/lib/bb/cooker.py | 20 ++++++++++++++++++++
bitbake/lib/bb/ui/crumbs/builder.py | 6 +++++-
bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 10 +++++++++-
bitbake/lib/bb/ui/crumbs/hoblistmodel.py | 6 ++++++
6 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index 88c91f6..003f09a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ meta-*
*~
!meta-yocto
!meta-yocto-bsp
+hob-image-*.bb
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 3f28bca..28b4c5d 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -197,6 +197,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
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 6b58f91..2338b31 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1188,6 +1188,26 @@ 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("inherit image\n")
+ 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
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 2f3d6d0..023ac93 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):
# 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()
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 8a2ac5f..ae853ee 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):
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
diff --git a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
index f4ccbc3..85c4f51 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):
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
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PatchV2] hob/bitbake: custom image is now using the base image
2012-12-11 13:44 [PatchV2] hob/bitbake: custom image is now using the base image Cristiana Voicu
@ 2012-12-11 15:48 ` Richard Purdie
0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2012-12-11 15:48 UTC (permalink / raw)
To: Cristiana Voicu; +Cc: bitbake-devel
On Tue, 2012-12-11 at 15:44 +0200, Cristiana Voicu wrote:
> 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>
> ---
> .gitignore | 1 +
> bitbake/lib/bb/command.py | 10 ++++++++++
> bitbake/lib/bb/cooker.py | 20 ++++++++++++++++++++
> bitbake/lib/bb/ui/crumbs/builder.py | 6 +++++-
> bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 10 +++++++++-
> bitbake/lib/bb/ui/crumbs/hoblistmodel.py | 6 ++++++
> 6 files changed, 51 insertions(+), 2 deletions(-)
>
> diff --git a/.gitignore b/.gitignore
> index 88c91f6..003f09a 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -15,3 +15,4 @@ meta-*
> *~
> !meta-yocto
> !meta-yocto-bsp
> +hob-image-*.bb
> diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
> index 3f28bca..28b4c5d 100644
> --- a/bitbake/lib/bb/command.py
> +++ b/bitbake/lib/bb/command.py
> @@ -197,6 +197,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
> diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
> index 6b58f91..2338b31 100644
> --- a/bitbake/lib/bb/cooker.py
> +++ b/bitbake/lib/bb/cooker.py
> @@ -1188,6 +1188,26 @@ 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("inherit image\n")
Do we need the above line? Doesn't the original image do this for us?
Looks good to me otherwise though, much better than the previous
version!
Cheers,
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-11 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-11 13:44 [PatchV2] hob/bitbake: custom image is now using the base image Cristiana Voicu
2012-12-11 15:48 ` Richard Purdie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.