<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-text-flowed" style="font-family: -moz-fixed;
font-size: 12px;" lang="x-western">Hi Valentin,
<br>
<br>
I have some comments on this patch:
<br>
<br>
On 09/25/2013 02:18 PM, Valentin Popa wrote:
<br>
<blockquote type="cite" style="color: #000000;">When the user
starts HOB, he/she expects to see some GUI.
<br>
If bitbake signals an erros before HOB starts the error will
<br>
be visible only in console and hob script will terminate.
<br>
This patch allows bitbake to report errors inside a GUI dialog
<br>
when the user wants to use HOB.
<br>
WebHOB starts before bitbake's launch and a common solution
<br>
for this problem that applies to both HOB and WebHOB is not so
obvious.
<br>
<br>
Signed-off-by: Valentin Popa <a class="moz-txt-link-rfc2396E"
href="mailto:valentin.popa@intel.com"><valentin.popa@intel.com></a>
<br>
---
<br>
bitbake/lib/bb/ui/show_error_dialog | 62
+++++++++++++++++++++++++++++++++++++
<br>
</blockquote>
The new file doesn't have the extension .py
<br>
<blockquote type="cite" style="color: #000000;">
scripts/hob | 9 +++++-
<br>
2 files changed, 70 insertions(+), 1 deletion(-)
<br>
create mode 100755 bitbake/lib/bb/ui/show_error_dialog
<br>
<br>
diff --git a/bitbake/lib/bb/ui/show_error_dialog
b/bitbake/lib/bb/ui/show_error_dialog
<br>
new file mode 100755
<br>
index 0000000..09d0c5c
<br>
--- /dev/null
<br>
+++ b/bitbake/lib/bb/ui/show_error_dialog
<br>
@@ -0,0 +1,62 @@
<br>
+#!/usr/bin/env python
<br>
+#
<br>
+# BitBake graphical error reporting dialog used by hob script
<br>
+#
<br>
+# Copyright (C) 2013 Intel Corporation
<br>
+#
<br>
+# Authored by Valentin Popa <a class="moz-txt-link-rfc2396E"
href="mailto:valentin.popa@lintel.com"><valentin.popa@lintel.com></a>
<br>
+# Authored by Andrei Dinu <a class="moz-txt-link-rfc2396E"
href="mailto:andrei.adrianx.dinu@intel.com"><andrei.adrianx.dinu@intel.com></a>
<br>
+#
<br>
+# This program is free software; you can redistribute it and/or
modify
<br>
+# it under the terms of the GNU General Public License version
2 as
<br>
+# published by the Free Software Foundation.
<br>
+#
<br>
+# This program is distributed in the hope that it will be
useful,
<br>
+# but WITHOUT ANY WARRANTY; without even the implied warranty
of
<br>
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
<br>
+# GNU General Public License for more details.
<br>
+#
<br>
+# You should have received a copy of the GNU General Public
License along
<br>
+# with this program; if not, write to the Free Software
Foundation, Inc.,
<br>
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
<br>
+
<br>
+import sys
<br>
+import os
<br>
+requirements = "FATAL: Gtk+ 2.20.0 or higher & PyGtk 2.21.0
or higher is required"
<br>
+try:
<br>
+ import gtk
<br>
+ import pygtk
<br>
+ pygtk.require('2.0') # to be certain we don't have gtk+ 1.x
!?!
<br>
+ gtkver = gtk.gtk_version
<br>
+ pygtkver = gtk.pygtk_version
<br>
+ if gtkver < (2, 20, 0) or pygtkver < (2, 21, 0):
<br>
+ sys.exit("%s,\nYou have Gtk+ %s and PyGtk %s." %
(requirements,
<br>
+ ".".join(map(str, gtkver)),
<br>
+ ".".join(map(str, pygtkver))))
<br>
+except ImportError as exc:
<br>
+ sys.exit("%s (%s)." % (requirements, str(exc)))
<br>
+
<br>
+try:
<br>
+ import crumbs
<br>
+except RuntimeError as exc:
<br>
+ sys.exit(str(exc))
<br>
+sys.path.insert(0,
os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
<br>
+
<br>
+from crumbs.hig.crumbsmessagedialog import CrumbsMessageDialog
<br>
+from crumbs.hobwidget import HobButton
<br>
+
<br>
+class HobError(gtk.Window):
<br>
+
<br>
+ def __init__(self, error_log_file):
<br>
+ message = open(error_log_file).readlines()
<br>
+ label = "<b>Hob found an error</b>"
<br>
+ dialog = CrumbsMessageDialog(self, label,
gtk.MESSAGE_ERROR, "".join(message))
<br>
+ button = dialog.add_button("Close", gtk.RESPONSE_OK)
<br>
+ HobButton.style_button(button)
<br>
+ button.connect("clicked", lambda w:sys.exit())
<br>
+ dialog.run()
<br>
+ dialog.destroy()
<br>
+
<br>
+if __name__ == "__main__":
<br>
+ HobError(sys.argv[1])
<br>
+
<br>
diff --git a/scripts/hob b/scripts/hob
<br>
index 8d33ab1..bbb2366 100755
<br>
--- a/scripts/hob
<br>
+++ b/scripts/hob
<br>
@@ -1,6 +1,13 @@
<br>
#!/usr/bin/env bash
<br>
export BB_ENV_EXTRAWHITE="DISABLE_SANITY_CHECKS
$BB_ENV_EXTRAWHITE"
<br>
-DISABLE_SANITY_CHECKS=1 bitbake -u hob $@
<br>
+ERROR_LOG=$BUILDDIR/tmp/log/saved_errors.log
<br>
</blockquote>
Instead of $BUILDDIR/tmp you should use $TMPDIR
<br>
<blockquote type="cite" style="color: #000000;">+DISABLE_SANITY_CHECKS=1
bitbake -u hob $@ > $ERROR_LOG
<br>
ret=$?
<br>
+
<br>
+if (( $ret == 1 )); then #there is an error and hob didn't
start
<br>
+ $BUILDDIR/../bitbake/lib/bb/ui/show_error_dialog $ERROR_LOG
<br>
</blockquote>
The path to show_error_dialog is hardcoded. For example, my poky
directory is somewhere else.
<br>
<blockquote type="cite" style="color: #000000;">+ rm $ERROR_LOG
<br>
+fi
<br>
+
<br>
exit $ret
<br>
</blockquote>
Cristiana
<br>
</div>
</body>
</html>