summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKang Kai <kai.kang@windriver.com>2012-06-06 17:52:26 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-08 12:13:17 +0100
commit87ce7bdfd5e2bf1128226ada4dd8f88abbf51230 (patch)
treee0cad2c2bcc26fad3d00326da600537008ba3123
parent0c9927865c4fd6b98daeb4b050baff9c9ca978e1 (diff)
downloadpoky-87ce7bdfd5e2bf1128226ada4dd8f88abbf51230.tar.gz
poky-87ce7bdfd5e2bf1128226ada4dd8f88abbf51230.tar.bz2
poky-87ce7bdfd5e2bf1128226ada4dd8f88abbf51230.zip
ui/crumbs/hig.py: check deploy process return value
Update function response_cb of DeployImageDialog to get deploy process return value. According the return value tell user that deploy image successfully or not. (Bitbake rev: f78f6d43a68e0f1dc4d3e4164eed453fcb9c22a8) Signed-off-by: Kang Kai <kai.kang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig.py32
1 files changed, 29 insertions, 3 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index cf73145442..97a3b22f15 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -827,12 +827,38 @@ class DeployImageDialog (CrumbsDialog):
def response_cb(self, dialog, response_id):
if response_id == gtk.RESPONSE_YES:
+ lbl = ''
combo_item = self.usb_combo.get_active_text()
- if combo_item and combo_item != self.__dummy_usb__:
+ if combo_item and combo_item != self.__dummy_usb__ and self.image_path:
cmdline = bb.ui.crumbs.utils.which_terminal()
if cmdline:
- cmdline += "\"sudo dd if=" + self.image_path + " of=" + combo_item + "\""
- bb.process.Popen(shlex.split(cmdline))
+ 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()
+
+ # 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.
+ if os.path.exists(tmpname):
+ tmpfile = open(tmpname)
+ if int(tmpfile.readline().strip()) == 0:
+ lbl = "<b>Deploy image successfully</b>"
+ else:
+ lbl = "<b>Deploy image failed</b>\nPlease try again."
+ 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"
+ else:
+ lbl = "<b>No selection made</b>\nYou have not selected USB device"
+ if len(lbl):
+ crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
+ button = crumbs_dialog.add_button("Close", gtk.RESPONSE_OK)
+ HobButton.style_button(button)
+ crumbs_dialog.run()
+ crumbs_dialog.destroy()
def update_progress_bar(self, title, fraction, status=None):
self.progress_bar.update(fraction)