diff options
| author | Cristiana Voicu <cristiana.voicu@intel.com> | 2013-07-29 09:55:06 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-06 13:02:24 +0100 |
| commit | 140744c4701bcac0dd61e11303d008f2ea34fc1b (patch) | |
| tree | 56d29d44308a0c357069b6e7957317a88111c273 /bitbake/lib/bb/cooker.py | |
| parent | ee4fe5a229125d01cf8b697c759d0852f9a715a8 (diff) | |
| download | poky-140744c4701bcac0dd61e11303d008f2ea34fc1b.tar.gz | |
bitbake: hob/bitbake: create a template (a .bb file) from hob through bitbake
Modified generateNewImage function from cooker, in order to be used to
save a template in Hob.
Created a command to ensure that some dirs are created. The templates
(recipes) will be saved in {TOPDIR}/recipes/images folder.
Called these methods from Hob.
[YOCTO #4193]
(Bitbake rev: 96ffa00945c7eb09a0132fa47159aef3ef20fb3e)
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
| -rw-r--r-- | bitbake/lib/bb/cooker.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 49e6345ce4..4a5638fb60 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
| @@ -1100,16 +1100,25 @@ class BBCooker: | |||
| 1100 | 1100 | ||
| 1101 | self.configuration.server_register_idlecallback(buildTargetsIdle, rq) | 1101 | self.configuration.server_register_idlecallback(buildTargetsIdle, rq) |
| 1102 | 1102 | ||
| 1103 | def generateNewImage(self, image, base_image, package_queue): | 1103 | def generateNewImage(self, image, base_image, package_queue, timestamp): |
| 1104 | ''' | 1104 | ''' |
| 1105 | Create a new image with a "require" base_image statement | 1105 | Create a new image with a "require"/"inherit" base_image statement |
| 1106 | ''' | 1106 | ''' |
| 1107 | image_name = os.path.splitext(image)[0] | 1107 | if timestamp: |
| 1108 | timestr = time.strftime("-%Y%m%d-%H%M%S") | 1108 | image_name = os.path.splitext(image)[0] |
| 1109 | dest = image_name + str(timestr) + ".bb" | 1109 | timestr = time.strftime("-%Y%m%d-%H%M%S") |
| 1110 | dest = image_name + str(timestr) + ".bb" | ||
| 1111 | else: | ||
| 1112 | if not image.endswith(".bb"): | ||
| 1113 | dest = image + ".bb" | ||
| 1114 | else: | ||
| 1115 | dest = image | ||
| 1110 | 1116 | ||
| 1111 | with open(dest, "w") as imagefile: | 1117 | with open(dest, "w") as imagefile: |
| 1112 | imagefile.write("require " + base_image + "\n") | 1118 | if base_image is None: |
| 1119 | imagefile.write("inherit image\n") | ||
| 1120 | else: | ||
| 1121 | imagefile.write("require " + base_image + "\n") | ||
| 1113 | package_install = "PACKAGE_INSTALL_forcevariable = \"" | 1122 | package_install = "PACKAGE_INSTALL_forcevariable = \"" |
| 1114 | for package in package_queue: | 1123 | for package in package_queue: |
| 1115 | package_install += str(package) + " " | 1124 | package_install += str(package) + " " |
| @@ -1117,7 +1126,8 @@ class BBCooker: | |||
| 1117 | imagefile.write(package_install) | 1126 | imagefile.write(package_install) |
| 1118 | 1127 | ||
| 1119 | self.state = state.initial | 1128 | self.state = state.initial |
| 1120 | return timestr | 1129 | if timestamp: |
| 1130 | return timestr | ||
| 1121 | 1131 | ||
| 1122 | def updateCache(self): | 1132 | def updateCache(self): |
| 1123 | if self.state == state.running: | 1133 | if self.state == state.running: |
