Skip to contentSkip to conversation

Update for Yocto 2388

PATCH Applied Kang Kai 2 participants 5 messages Jun 14, 2012

lore
Share & tools
lore

Kang Kai

author
#0 lore raw

cover Update for Yocto 2388

Hi,

These are 3 updates of
Yocto 2388: [Hob] Separate the hob image writer into a separate application Two of them are strings update, and the other one is for simplify code.

Regards,
Kai

The following changes since commit 5ed855d12cddf2de535c3f6d05d3dfe85d69d99d:

openjade-native: Ensure we reautoconf the package (2012-06-12 16:34:30 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib kangkai/distro
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/distro

Kang Kai (3):
ui/crumbs/hig.py: tweak strings
ui/crumbs/hig.py: simplify subprocess call
image-writer: tweak some strings

 bitbake/bin/image-writer        |   10 +++++-----
 bitbake/lib/bb/ui/crumbs/hig.py |   17 +++++++++++------
 2 files changed, 16 insertions(+), 11 deletions(-)
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH 1/3 ui/crumbs/hig.py: tweak strings

Add comments for DeployImageDialog 'standalone' part of codes to make it easy to read.
And tweak some strings.

---
 bitbake/lib/bb/ui/crumbs/hig.py |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
bitbake/lib/bb/ui/crumbs/hig.py +9 -4
index 3b50f68..0c3f56c 100644
@@ -784,6 +784,11 @@ class DeployImageDialog (CrumbsDialog):
         scroll.add(tv)
         table.attach(scroll, 0, 10, 0, 1)
 
+        # There are 2 ways to use DeployImageDialog
+        # One way is that called by HOB when the 'Deploy Image' button is clicked
+        # The other way is that called by a standalone script.
+        # Following block of codes handles the latter way. It adds a 'Select Image' button and
+        # emit a signal when the button is clicked.
         if self.standalone:
                 gobject.signal_new("select_image_clicked", self, gobject.SIGNAL_RUN_FIRST,
                                    gobject.TYPE_NONE, ())
@@ -874,16 +879,16 @@ class DeployImageDialog (CrumbsDialog):
                     if os.path.exists(tmpname):
                         tmpfile = open(tmpname)
                         if int(tmpfile.readline().strip()) == 0:
-                            lbl = "<b>Deploy image successfully</b>"
+                            lbl = "<b>Deploy image successfully.</b>"
                         else:
-                            lbl = "<b>Deploy image failed</b>\nPlease try again."
+                            lbl = "<b>Failed to deploy image.</b>\nPlease check image <b>%s</b> exists and USB device <b>%s</b> is writable." % (self.image_path, combo_item)
                         tmpfile.close()
                         os.remove(tmpname)
             else:
                 if not self.image_path:
-                    lbl = "<b>No selection made</b>\nYou have not selected an image to deploy"
+                    lbl = "<b>No selection made.</b>\nYou have not selected an image to deploy."
                 else:
-                    lbl = "<b>No selection made</b>\nYou have not selected USB device"
+                    lbl = "<b>No selection made.</b>\nYou have not selected a USB device."
             if len(lbl):
                 crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
                 button = crumbs_dialog.add_button("Close", gtk.RESPONSE_OK)
Signature · 1 line
1.7.5.4
author
#2 lore raw

PATCH 2/3 ui/crumbs/hig.py: simplify subprocess call

In reply to Kang Kai

According to Darren's suggestion, subprocess.call() will wait until the subprocess complete. So simplify the code, use subprocess.call() to wait command complete.

---
 bitbake/lib/bb/ui/crumbs/hig.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
bitbake/lib/bb/ui/crumbs/hig.py +2 -2
index 0c3f56c..b586b6c 100644
@@ -27,6 +27,7 @@ import hashlib
 import os
 import re
 import shlex
+import subprocess
 from bb.ui.crumbs.hobcolor import HobColors
 from bb.ui.crumbs.hobwidget import hcc, hic, HobViewTable, HobInfoButton, HobButton, HobAltButton, HobIconChecker
 from bb.ui.crumbs.progressbar import HobProgressBar
@@ -871,8 +872,7 @@ class DeployImageDialog (CrumbsDialog):
                     tmpname = os.tmpnam()
                     cmdline += "\"sudo dd if=" + self.image_path + \
                                 " of=" + combo_item + "; echo $? > " + tmpname + "\""
-                    deploy_process = bb.process.Popen(shlex.split(cmdline))
-                    deploy_process.wait()
+                    subprocess.call(shlex.split(cmdline))
 
                     # if file tmpname not exists, that means there is something wrong with xterm
                     # user can get the error message from xterm so no more warning need.
Signature · 1 line
1.7.5.4
author
#3 lore raw

PATCH 3/3 image-writer: tweak some strings

In reply to Kang Kai

Tweak some strings in accord with the script name 'image writer', and remove extra noun 'button'.

---
 bitbake/bin/image-writer |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
bitbake/bin/image-writer +5 -5
index 3f9f5c1..0b9e450 100755
@@ -33,7 +33,7 @@ from bb.ui.crumbs.hobwidget import HobAltButton, HobButton
 
 # I put all the fs bitbake supported here. Need more test.
 DEPLOYABLE_IMAGE_TYPES = ["jffs2", "cramfs", "ext2", "ext3", "btrfs", "squashfs", "ubi", "vmdk"]
-Title = "USB Image Maker"
+Title = "USB Image Writer"
 
 class DeployWindow(gtk.Window):
     def __init__(self, image_path=''):
@@ -43,13 +43,13 @@ class DeployWindow(gtk.Window):
             valid = True
             if not os.path.exists(image_path):
                 valid = False
-                lbl = "<b>Invalid image file path: %s.</b>\nPress <b>Select Image</b> button to select an image." % image_path
+                lbl = "<b>Invalid image file path: %s.</b>\nPress <b>Select Image</b> to select an image." % image_path
             else:
                 image_path = os.path.abspath(image_path)
                 extend_name = os.path.splitext(image_path)[1][1:]
                 if extend_name not in DEPLOYABLE_IMAGE_TYPES:
                     valid = False
-                    lbl = "<b>Undeployable imge type: %s</b>\nPress <b>Select Image</b> button to select an image." % extend_name
+                    lbl = "<b>Undeployable imge type: %s</b>\nPress <b>Select Image</b> to select an image." % extend_name
 
             if not valid:
                 image_path = ''
@@ -66,8 +66,8 @@ class DeployWindow(gtk.Window):
         HobAltButton.style_button(close_button)
         close_button.connect('clicked', gtk.main_quit)
 
-        make_button = self.deploy_dialog.add_button("Make USB image", gtk.RESPONSE_YES)
-        HobAltButton.style_button(make_button)
+        write_button = self.deploy_dialog.add_button("Write USB image", gtk.RESPONSE_YES)
+        HobAltButton.style_button(write_button)
 
         self.deploy_dialog.connect('select_image_clicked', self.select_image_clicked_cb)
         self.deploy_dialog.connect('destroy', gtk.main_quit)
Signature · 1 line
1.7.5.4
#4 lore raw
In reply to Kang Kai
Quoted 13 lines · Kang Kai

Hi,

These are 3 updates of
Yocto 2388: [Hob] Separate the hob image writer into a separate application Two of them are strings update, and the other one is for simplify code.

Regards,
Kai

The following changes since commit 5ed855d12cddf2de535c3f6d05d3dfe85d69d99d:

openjade-native: Ensure we reautoconf the package (2012-06-12 16:34:30 +0100)

Quoted 8 lines

are available in the git repository at:
git://git.pokylinux.org/poky-contrib kangkai/distro
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/distro

Kang Kai (3):
ui/crumbs/hig.py: tweak strings
ui/crumbs/hig.py: simplify subprocess call
image-writer: tweak some strings

Merged to master, thanks.

Richard