summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/builder.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/builder.py')
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py118
1 files changed, 51 insertions, 67 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 7861a6fbaf..ad9c0f4587 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -303,6 +303,7 @@ class Parameters:
303 self.tmpdir = params["tmpdir"] 303 self.tmpdir = params["tmpdir"]
304 self.image_white_pattern = params["image_white_pattern"] 304 self.image_white_pattern = params["image_white_pattern"]
305 self.image_black_pattern = params["image_black_pattern"] 305 self.image_black_pattern = params["image_black_pattern"]
306 self.kernel_image_type = params["kernel_image_type"]
306 # for build log to show 307 # for build log to show
307 self.bb_version = params["bb_version"] 308 self.bb_version = params["bb_version"]
308 self.target_arch = params["target_arch"] 309 self.target_arch = params["target_arch"]
@@ -1160,25 +1161,32 @@ class Builder(gtk.Window):
1160 response = dialog.run() 1161 response = dialog.run()
1161 dialog.destroy() 1162 dialog.destroy()
1162 1163
1163 def get_kernel_file_name(self): 1164 def show_load_kernel_dialog(self):
1164 name_list = [] 1165 dialog = gtk.FileChooserDialog("Load Kernel Files", self,
1165 kernel_name = "" 1166 gtk.FILE_CHOOSER_ACTION_SAVE)
1166 image_path = self.parameters.image_addr 1167 button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
1167 if image_path: 1168 HobAltButton.style_button(button)
1168 files = [f for f in os.listdir(image_path) if f[0] <> '.'] 1169 button = dialog.add_button("Open", gtk.RESPONSE_YES)
1169 for check_file in files: 1170 HobButton.style_button(button)
1170 if check_file.endswith(".bin"): 1171 filter = gtk.FileFilter()
1171 name_splits = check_file.split(".")[0] 1172 filter.set_name("Kernel Files")
1172 if self.configuration.curr_mach in name_splits.split("-"): 1173 filter.add_pattern("*.bin")
1173 kernel_name = check_file 1174 dialog.add_filter(filter)
1174 if not os.path.islink(os.path.join(image_path, check_file)): 1175
1175 name_list.append(check_file) 1176 dialog.set_current_folder(self.parameters.image_addr)
1176 1177
1177 return kernel_name, len(name_list) 1178 response = dialog.run()
1178 1179 kernel_path = ""
1179 def runqemu_image(self, image_name): 1180 if response == gtk.RESPONSE_YES:
1180 if not image_name: 1181 kernel_path = dialog.get_filename()
1181 lbl = "<b>Please select an image to launch in QEMU.</b>" 1182
1183 dialog.destroy()
1184
1185 return kernel_path
1186
1187 def runqemu_image(self, image_name, kernel_name):
1188 if not image_name or not kernel_name:
1189 lbl = "<b>Please select an %s to launch in QEMU.</b>" % ("kernel" if image_name else "image")
1182 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) 1190 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
1183 button = dialog.add_button("Close", gtk.RESPONSE_OK) 1191 button = dialog.add_button("Close", gtk.RESPONSE_OK)
1184 HobButton.style_button(button) 1192 HobButton.style_button(button)
@@ -1186,57 +1194,33 @@ class Builder(gtk.Window):
1186 dialog.destroy() 1194 dialog.destroy()
1187 return 1195 return
1188 1196
1189 kernel_name, kernels_number = self.get_kernel_file_name() 1197 kernel_path = os.path.join(self.parameters.image_addr, kernel_name)
1190 if not kernel_name or kernels_number > 1: 1198 image_path = os.path.join(self.parameters.image_addr, image_name)
1191 dialog = gtk.FileChooserDialog("Load Kernel Files", self,
1192 gtk.FILE_CHOOSER_ACTION_SAVE)
1193 button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
1194 HobAltButton.style_button(button)
1195 button = dialog.add_button("Open", gtk.RESPONSE_YES)
1196 HobButton.style_button(button)
1197 filter = gtk.FileFilter()
1198 filter.set_name("Kernel Files")
1199 filter.add_pattern("*.bin")
1200 dialog.add_filter(filter)
1201
1202 dialog.set_current_folder(self.parameters.image_addr)
1203 1199
1204 response = dialog.run() 1200 source_env_path = os.path.join(self.parameters.core_base, "oe-init-build-env")
1205 if response == gtk.RESPONSE_YES: 1201 tmp_path = self.parameters.tmpdir
1206 kernel_path = dialog.get_filename() 1202 cmdline = bb.ui.crumbs.utils.which_terminal()
1207 image_path = os.path.join(self.parameters.image_addr, image_name) 1203 if os.path.exists(image_path) and os.path.exists(kernel_path) \
1204 and os.path.exists(source_env_path) and os.path.exists(tmp_path) \
1205 and cmdline:
1206 cmdline += "\' bash -c \"export OE_TMPDIR=" + tmp_path + "; "
1207 cmdline += "source " + source_env_path + " " + os.getcwd() + "; "
1208 cmdline += "runqemu " + kernel_path + " " + image_path + "\"\'"
1209 subprocess.Popen(shlex.split(cmdline))
1210 else:
1211 lbl = "<b>Path error</b>\nOne of your paths is wrong,"
1212 lbl = lbl + " please make sure the following paths exist:\n"
1213 lbl = lbl + "image path:" + image_path + "\n"
1214 lbl = lbl + "kernel path:" + kernel_path + "\n"
1215 lbl = lbl + "source environment path:" + source_env_path + "\n"
1216 lbl = lbl + "tmp path: " + tmp_path + "."
1217 lbl = lbl + "You may be missing either xterm or vte for terminal services."
1218 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR)
1219 button = dialog.add_button("Close", gtk.RESPONSE_OK)
1220 HobButton.style_button(button)
1221 dialog.run()
1208 dialog.destroy() 1222 dialog.destroy()
1209 1223
1210 elif kernel_name:
1211 kernel_path = os.path.join(self.parameters.image_addr, kernel_name)
1212 image_path = os.path.join(self.parameters.image_addr, image_name)
1213 response = gtk.RESPONSE_YES
1214
1215 if response == gtk.RESPONSE_YES:
1216 source_env_path = os.path.join(self.parameters.core_base, "oe-init-build-env")
1217 tmp_path = self.parameters.tmpdir
1218 cmdline = bb.ui.crumbs.utils.which_terminal()
1219 if os.path.exists(image_path) and os.path.exists(kernel_path) \
1220 and os.path.exists(source_env_path) and os.path.exists(tmp_path) \
1221 and cmdline:
1222 cmdline += "\' bash -c \"export OE_TMPDIR=" + tmp_path + "; "
1223 cmdline += "source " + source_env_path + " " + os.getcwd() + "; "
1224 cmdline += "runqemu " + kernel_path + " " + image_path + "\"\'"
1225 subprocess.Popen(shlex.split(cmdline))
1226 else:
1227 lbl = "<b>Path error</b>\nOne of your paths is wrong,"
1228 lbl = lbl + " please make sure the following paths exist:\n"
1229 lbl = lbl + "image path:" + image_path + "\n"
1230 lbl = lbl + "kernel path:" + kernel_path + "\n"
1231 lbl = lbl + "source environment path:" + source_env_path + "\n"
1232 lbl = lbl + "tmp path: " + tmp_path + "."
1233 lbl = lbl + "You may be missing either xterm or vte for terminal services."
1234 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR)
1235 button = dialog.add_button("Close", gtk.RESPONSE_OK)
1236 HobButton.style_button(button)
1237 dialog.run()
1238 dialog.destroy()
1239
1240 def show_packages(self, ask=True): 1224 def show_packages(self, ask=True):
1241 _, selected_recipes = self.recipe_model.get_selected_recipes() 1225 _, selected_recipes = self.recipe_model.get_selected_recipes()
1242 if selected_recipes and ask: 1226 if selected_recipes and ask: