summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiming An <limingx.l.an@intel.com>2012-06-01 18:40:57 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-08 12:13:14 +0100
commit6ac1545453b3ff24422c9d2eea17996c041fb483 (patch)
treee00391db73ef4044a7a06431f91c7adb021fb2dd
parent7f806be2b0f894725e806c594670a7bea5ff4f1c (diff)
downloadpoky-6ac1545453b3ff24422c9d2eea17996c041fb483.tar.gz
Hob: clear the repeated function get_kernel_file_name
there are a repeated function in builder.py and imagedetailspage.py, so combine them to one. (Bitbake rev: 4bada20cd244a2dd6d72acd38f0cadc90453e60b) Signed-off-by: Liming An <limingx.l.an@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py5
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/imagedetailspage.py19
2 files changed, 4 insertions, 20 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 8d35ea96be..899d0e0c16 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -1141,9 +1141,10 @@ class Builder(gtk.Window):
1141 response = dialog.run() 1141 response = dialog.run()
1142 dialog.destroy() 1142 dialog.destroy()
1143 1143
1144 def get_kernel_file_name(self, image_path): 1144 def get_kernel_file_name(self):
1145 name_list = [] 1145 name_list = []
1146 kernel_name = "" 1146 kernel_name = ""
1147 image_path = self.parameters.image_addr
1147 if image_path: 1148 if image_path:
1148 files = [f for f in os.listdir(image_path) if f[0] <> '.'] 1149 files = [f for f in os.listdir(image_path) if f[0] <> '.']
1149 for check_file in files: 1150 for check_file in files:
@@ -1166,7 +1167,7 @@ class Builder(gtk.Window):
1166 dialog.destroy() 1167 dialog.destroy()
1167 return 1168 return
1168 1169
1169 kernel_name, kernels_number = self.get_kernel_file_name(self.parameters.image_addr) 1170 kernel_name, kernels_number = self.get_kernel_file_name()
1170 if not kernel_name or kernels_number > 1: 1171 if not kernel_name or kernels_number > 1:
1171 dialog = gtk.FileChooserDialog("Load Kernel Files", self, 1172 dialog = gtk.FileChooserDialog("Load Kernel Files", self,
1172 gtk.FILE_CHOOSER_ACTION_SAVE) 1173 gtk.FILE_CHOOSER_ACTION_SAVE)
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index deb053c4c9..1ab80f8277 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -368,7 +368,7 @@ class ImageDetailsPage (HobPage):
368 iter = model.get_iter(path) 368 iter = model.get_iter(path)
369 image_name = model[path][0] 369 image_name = model[path][0]
370 if iter and model[path][2] == 'runnable': 370 if iter and model[path][2] == 'runnable':
371 kernel_name, kernel_number = self.get_kernel_file_name(image_name) 371 kernel_name, kernel_number = self.builder.parameters.get_kernel_file_name()
372 self.builder.runqemu_image(image_name, kernel_name, kernel_number) 372 self.builder.runqemu_image(image_name, kernel_name, kernel_number)
373 373
374 def create_bottom_buttons(self, buttonlist, image_name): 374 def create_bottom_buttons(self, buttonlist, image_name):
@@ -446,23 +446,6 @@ class ImageDetailsPage (HobPage):
446 button_id = build_new_button.connect("clicked", self.build_new_button_clicked_cb) 446 button_id = build_new_button.connect("clicked", self.build_new_button_clicked_cb)
447 self.button_ids[button_id] = build_new_button 447 self.button_ids[button_id] = build_new_button
448 448
449 def get_kernel_file_name(self, image_name):
450 name_list = []
451 kernel_name = ""
452 if image_name:
453 image_path = os.path.join(self.builder.parameters.image_addr)
454 files = [f for f in os.listdir(image_path) if f[0] <> '.']
455 for check_file in files:
456 if check_file.endswith(".bin"):
457 if self.test_mach_runnable(check_file):
458 selected_machine = self.builder.configuration.curr_mach
459 if selected_machine in check_file:
460 kernel_name = check_file
461 if not os.path.islink(os.path.join(image_path, check_file)):
462 name_list.append(check_file)
463
464 return kernel_name, len(name_list)
465
466 def save_button_clicked_cb(self, button): 449 def save_button_clicked_cb(self, button):
467 self.builder.show_save_template_dialog() 450 self.builder.show_save_template_dialog()
468 451