diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/command.py | 8 | ||||
-rw-r--r-- | bitbake/lib/bb/cooker.py | 24 | ||||
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/builder.py | 10 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 9 | ||||
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/imagedetailspage.py | 2 |
6 files changed, 45 insertions, 10 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py index 17276541cc..1893cce71e 100644 --- a/bitbake/lib/bb/command.py +++ b/bitbake/lib/bb/command.py | |||
@@ -214,7 +214,13 @@ class CommandsSync: | |||
214 | image = params[0] | 214 | image = params[0] |
215 | base_image = params[1] | 215 | base_image = params[1] |
216 | package_queue = params[2] | 216 | package_queue = params[2] |
217 | return command.cooker.generateNewImage(image, base_image, package_queue) | 217 | timestamp = params[3] |
218 | return command.cooker.generateNewImage(image, base_image, | ||
219 | package_queue, timestamp) | ||
220 | |||
221 | def ensureDir(self, command, params): | ||
222 | directory = params[0] | ||
223 | bb.utils.mkdirhier(directory) | ||
218 | 224 | ||
219 | def setVarFile(self, command, params): | 225 | def setVarFile(self, command, params): |
220 | """ | 226 | """ |
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: |
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py index 317a2fe16d..0a04c90bc6 100755 --- a/bitbake/lib/bb/ui/crumbs/builder.py +++ b/bitbake/lib/bb/ui/crumbs/builder.py | |||
@@ -593,6 +593,16 @@ class Builder(gtk.Window): | |||
593 | toolchain_packages, | 593 | toolchain_packages, |
594 | self.configuration.default_task) | 594 | self.configuration.default_task) |
595 | 595 | ||
596 | def generate_new_image(self, image): | ||
597 | base_image = self.configuration.initial_selected_image | ||
598 | if base_image == self.recipe_model.__custom_image__: | ||
599 | base_image = None | ||
600 | packages = self.package_model.get_selected_packages() | ||
601 | self.handler.generate_new_image(image, base_image, packages) | ||
602 | |||
603 | def ensure_dir(self, directory): | ||
604 | self.handler.ensure_dir(directory) | ||
605 | |||
596 | def get_parameters_sync(self): | 606 | def get_parameters_sync(self): |
597 | return self.handler.get_parameters() | 607 | return self.handler.get_parameters() |
598 | 608 | ||
diff --git a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py index 3fc389aaa1..b2fa3bd5a9 100644 --- a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py +++ b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py | |||
@@ -117,7 +117,7 @@ class SaveImageDialog (CrumbsDialog): | |||
117 | text = self.name_entry.get_text() | 117 | text = self.name_entry.get_text() |
118 | new_text = text.replace("-","") | 118 | new_text = text.replace("-","") |
119 | if new_text.islower() and new_text.isalnum(): | 119 | if new_text.islower() and new_text.isalnum(): |
120 | print(text) | 120 | self.builder.generate_new_image(self.directory+text) |
121 | self.destroy() | 121 | self.destroy() |
122 | else: | 122 | else: |
123 | self.show_invalid_input_error_dialog() | 123 | self.show_invalid_input_error_dialog() |
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py index 294eb5dd1f..34cd3478ed 100644 --- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py +++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py | |||
@@ -176,7 +176,7 @@ class HobHandler(gobject.GObject): | |||
176 | hobImage = self.runCommand(["matchFile", "hob-image.bb"]) | 176 | hobImage = self.runCommand(["matchFile", "hob-image.bb"]) |
177 | if self.base_image != "Start with an empty image recipe": | 177 | if self.base_image != "Start with an empty image recipe": |
178 | baseImage = self.runCommand(["matchFile", self.base_image + ".bb"]) | 178 | baseImage = self.runCommand(["matchFile", self.base_image + ".bb"]) |
179 | version = self.runCommand(["generateNewImage", hobImage, baseImage, self.package_queue]) | 179 | version = self.runCommand(["generateNewImage", hobImage, baseImage, self.package_queue, True]) |
180 | targets[0] += version | 180 | targets[0] += version |
181 | self.recipe_model.set_custom_image_version(version) | 181 | self.recipe_model.set_custom_image_version(version) |
182 | 182 | ||
@@ -426,6 +426,13 @@ class HobHandler(gobject.GObject): | |||
426 | self.commands_async.append(self.SUB_BUILD_IMAGE) | 426 | self.commands_async.append(self.SUB_BUILD_IMAGE) |
427 | self.run_next_command(self.GENERATE_IMAGE) | 427 | self.run_next_command(self.GENERATE_IMAGE) |
428 | 428 | ||
429 | def generate_new_image(self, image, base_image, package_queue): | ||
430 | base_image = self.runCommand(["matchFile", self.base_image + ".bb"]) | ||
431 | self.runCommand(["generateNewImage", image, base_image, package_queue, False]) | ||
432 | |||
433 | def ensure_dir(self, directory): | ||
434 | self.runCommand(["ensureDir", directory]) | ||
435 | |||
429 | def build_succeeded_async(self): | 436 | def build_succeeded_async(self): |
430 | self.building = False | 437 | self.building = False |
431 | 438 | ||
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py index a02ab610c0..f55d43f30d 100755 --- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py +++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py | |||
@@ -624,6 +624,8 @@ class ImageDetailsPage (HobPage): | |||
624 | def save_button_clicked_cb(self, button): | 624 | def save_button_clicked_cb(self, button): |
625 | topdir = self.builder.get_topdir() | 625 | topdir = self.builder.get_topdir() |
626 | images_dir = topdir + "/recipes/images/" | 626 | images_dir = topdir + "/recipes/images/" |
627 | self.builder.ensure_dir(images_dir) | ||
628 | |||
627 | dialog = SaveImageDialog(images_dir, "Save image recipe", self.builder, | 629 | dialog = SaveImageDialog(images_dir, "Save image recipe", self.builder, |
628 | gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT) | 630 | gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT) |
629 | response = dialog.run() | 631 | response = dialog.run() |