<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 09/27/2013 11:19 AM, cristiana.voicu
      wrote:<br>
    </div>
    <blockquote cite="mid:52453FA8.5040304@intel.com" type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <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&nbsp; 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 moz-do-not-send="true"
            class="moz-txt-link-rfc2396E"
            href="mailto:valentin.popa@intel.com">&lt;valentin.popa@intel.com&gt;</a>
          <br>
          --- <br>
          &nbsp; 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;">&nbsp;
          scripts/hob&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; 9 +++++- <br>
          &nbsp; 2 files changed, 70 insertions(+), 1 deletion(-) <br>
          &nbsp; 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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Intel Corporation <br>
          +# <br>
          +# Authored by Valentin Popa <a moz-do-not-send="true"
            class="moz-txt-link-rfc2396E"
            href="mailto:valentin.popa@lintel.com">&lt;valentin.popa@lintel.com&gt;</a>
          <br>
          +# Authored by Andrei Dinu <a moz-do-not-send="true"
            class="moz-txt-link-rfc2396E"
            href="mailto:andrei.adrianx.dinu@intel.com">&lt;andrei.adrianx.dinu@intel.com&gt;</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.&nbsp; 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 &amp; PyGtk
          2.21.0 or higher is required" <br>
          +try: <br>
          +&nbsp;&nbsp;&nbsp; import gtk <br>
          +&nbsp;&nbsp;&nbsp; import pygtk <br>
          +&nbsp;&nbsp;&nbsp; pygtk.require('2.0') # to be certain we don't have gtk+
          1.x !?! <br>
          +&nbsp;&nbsp;&nbsp; gtkver = gtk.gtk_version <br>
          +&nbsp;&nbsp;&nbsp; pygtkver = gtk.pygtk_version <br>
          +&nbsp;&nbsp;&nbsp; if gtkver&nbsp; &lt; (2, 20, 0) or pygtkver &lt; (2, 21, 0): <br>
          +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sys.exit("%s,\nYou have Gtk+ %s and PyGtk %s." %
          (requirements, <br>
          +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ".".join(map(str, gtkver)), <br>
          +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ".".join(map(str, pygtkver)))) <br>
          +except ImportError as exc: <br>
          +&nbsp;&nbsp;&nbsp; sys.exit("%s (%s)." % (requirements, str(exc))) <br>
          + <br>
          +try: <br>
          +&nbsp;&nbsp;&nbsp; import crumbs <br>
          +except RuntimeError as exc: <br>
          +&nbsp;&nbsp;&nbsp; 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>
          +&nbsp;&nbsp;&nbsp; def __init__(self, error_log_file): <br>
          +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; message = open(error_log_file).readlines() <br>
          +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; label = "&lt;b&gt;Hob found an error&lt;/b&gt;" <br>
          +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dialog = CrumbsMessageDialog(self, label,
          gtk.MESSAGE_ERROR, "".join(message)) <br>
          +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; button = dialog.add_button("Close", gtk.RESPONSE_OK)
          <br>
          +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HobButton.style_button(button) <br>
          +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; button.connect("clicked", lambda w:sys.exit()) <br>
          +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dialog.run() <br>
          +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dialog.destroy() <br>
          + <br>
          +if __name__ == "__main__": <br>
          +&nbsp;&nbsp;&nbsp; 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>
          &nbsp; #!/usr/bin/env bash <br>
          &nbsp; 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>
      </div>
    </blockquote>
    &nbsp;&nbsp;&nbsp; I'll try to store the error log in /tmp (using mktemp, as
    Laurentiu suggested)<br>
    <blockquote cite="mid:52453FA8.5040304@intel.com" type="cite">
      <div class="moz-text-flowed" style="font-family: -moz-fixed;
        font-size: 12px;" lang="x-western">
        <blockquote type="cite" style="color: #000000;">+DISABLE_SANITY_CHECKS=1

          bitbake -u hob $@ &gt; $ERROR_LOG <br>
          &nbsp; &nbsp; ret=$? <br>
          + <br>
          +if (( $ret == 1 )); then #there is an error and hob didn't
          start <br>
          +&nbsp;&nbsp;&nbsp; $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>
      </div>
    </blockquote>
    &nbsp;&nbsp;&nbsp; I'll move show_error_dialog in scripts. Thank you for the
    comments.<br>
    <blockquote cite="mid:52453FA8.5040304@intel.com" type="cite">
      <div class="moz-text-flowed" style="font-family: -moz-fixed;
        font-size: 12px;" lang="x-western">
        <blockquote type="cite" style="color: #000000;">+&nbsp;&nbsp;&nbsp; rm
          $ERROR_LOG <br>
          +fi <br>
          + <br>
          &nbsp; exit $ret <br>
        </blockquote>
        Cristiana <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>