Skip to contentSkip to conversation

Add sanity check progress screen

PATCH Superseded Bogdan Marinescu 1 participant 1 message Sep 25, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add sanity check progress screen

This patch adds a sanity check progress screen to hob. The screen is displayed when Hob executes the sanity check procedure. The screen is displayed for at least 5 seconds. If a network error is detected, a special dialog is displayed which lets the user open the proxy configuration page directly.
Note that currently bitbake triggers the network tests only when the value of its TMPDIR variable changes, which happens fairly rare on my system. This is the subject of another bug (#3026).

[YOCTO #3025]

---
 bitbake/lib/bb/event.py                     |    3 +-
 bitbake/lib/bb/ui/crumbs/builder.py         |  124 ++++++++++++++++++++++++---
 bitbake/lib/bb/ui/crumbs/hig.py             |    5 ++
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    5 +-
 bitbake/lib/bb/ui/crumbs/sanitycheckpage.py |   85 ++++++++++++++++++
 meta/classes/sanity.bbclass                 |   17 ++--
 6 files changed, 215 insertions(+), 24 deletions(-)
 create mode 100644 bitbake/lib/bb/ui/crumbs/sanitycheckpage.py
bitbake/lib/bb/event.py +2 -1
index 7ee28fc..20e2f3f 100644
@@ -553,6 +553,7 @@ class SanityCheckFailed(Event):
     """
     Event to indicate sanity check has failed
     """
-    def __init__(self, msg):
+    def __init__(self, msg, network_error=False):
         Event.__init__(self)
         self._msg = msg
+        self._network_error = network_error
bitbake/lib/bb/ui/crumbs/builder.py +111 -13

232 lines not on this page · raw message

bitbake/lib/bb/ui/crumbs/hig.py +5 -0
index f304a68..f4dd43c 100644
@@ -180,6 +180,9 @@ class CrumbsMessageDialog(CrumbsDialog):
 #
 class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
 
+    (BUILD_ENV_PAGE_ID,
+     PROXIES_PAGE_ID) = range(2)
+
     def __init__(self, title, configuration, all_image_types,
             all_package_formats, all_distros, all_sdk_machines,
             max_threads, parent, flags, buttons=None):
@@ -470,6 +473,8 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
 
         self.show_all()
 
+    def switch_to_page(self, page_id):
+        self.nb.set_current_page(page_id)
 
 #
 # AdvancedSettings Dialog
bitbake/lib/bb/ui/crumbs/hobeventhandler.py +2 -3
index 8fc1732..62b8ed0 100644
@@ -43,7 +43,7 @@ class HobHandler(gobject.GObject):
                                      (gobject.TYPE_STRING,)),
          "sanity-failed"           : (gobject.SIGNAL_RUN_LAST,
                                       gobject.TYPE_NONE,
-                                     (gobject.TYPE_STRING,)),
+                                     (gobject.TYPE_STRING, gobject.TYPE_INT)),
          "generating-data"         : (gobject.SIGNAL_RUN_LAST,
                                       gobject.TYPE_NONE,
                                      ()),
@@ -166,7 +166,6 @@ class HobHandler(gobject.GObject):
     def handle_event(self, event):
         if not event:
             return
-
         if self.building:
             self.current_phase = "building"
             self.build.handle_event(event)
@@ -180,7 +179,7 @@ class HobHandler(gobject.GObject):
             self.run_next_command()
 
         elif isinstance(event, bb.event.SanityCheckFailed):
-            self.emit("sanity-failed", event._msg)
+            self.emit("sanity-failed", event._msg, event._network_error)
 
         elif isinstance(event, logging.LogRecord):
             if event.levelno >= logging.ERROR:
bitbake/lib/bb/ui/crumbs/sanitycheckpage.py new file +85 -0

85 lines not on this page · raw message

meta/classes/sanity.bbclass +10 -7
index 385d733..634dac8 100644
@@ -4,9 +4,9 @@
 
 SANITY_REQUIRED_UTILITIES ?= "patch diffstat makeinfo git bzip2 tar gzip gawk chrpath wget cpio"
 
-def raise_sanity_error(msg, d):
+def raise_sanity_error(msg, d, network_error=False):
     if d.getVar("SANITY_USE_EVENTS", True) == "1":
-        bb.event.fire(bb.event.SanityCheckFailed(msg), d)
+        bb.event.fire(bb.event.SanityCheckFailed(msg, network_error), d)
         return
 
     bb.fatal(""" OE-core's config sanity checker detected a potential misconfiguration.
@@ -119,8 +119,9 @@ def check_sanity_tmpdir_change(tmpdir, data):
     # Check that TMPDIR isn't on a filesystem with limited filename length (eg. eCryptFS)
     testmsg = check_create_long_filename(tmpdir, "TMPDIR")
     # Check that we can fetch from various network transports
+    errmsg = check_connectivity(data)
     testmsg = testmsg + check_connectivity(data)
-    return testmsg
+    return testmsg, errmsg == ""
         
 def check_sanity_version_change(data):
     # Sanity checks to be done when SANITY_VERSION changes
@@ -475,16 +476,18 @@ def check_sanity(sanity_data):
                 last_sstate_dir = line.split()[1]
     
     sanity_version = int(sanity_data.getVar('SANITY_VERSION', True) or 1)
+    network_error = False
     if last_sanity_version < sanity_version: 
         messages = messages + check_sanity_version_change(sanity_data)
-        messages = messages + check_sanity_tmpdir_change(tmpdir, sanity_data)
+        err, network_error = check_sanity_tmpdir_change(tmpdir, sanity_data)
+        messages = messages + err
         messages = messages + check_sanity_sstate_dir_change(sstate_dir, sanity_data)
     else: 
         if last_tmpdir != tmpdir:
-            messages = messages + check_sanity_tmpdir_change(tmpdir, sanity_data)
+            err, network_error = check_sanity_tmpdir_change(tmpdir, sanity_data)
+            messages = messages + err
         if last_sstate_dir != sstate_dir:
             messages = messages + check_sanity_sstate_dir_change(sstate_dir, sanity_data)
-
     if os.path.exists("conf") and not messages:
         f = file(sanityverfile, 'w')
         f.write("SANITY_VERSION %s\n" % sanity_version) 
@@ -555,7 +558,7 @@ def check_sanity(sanity_data):
         messages = messages + "Error, you have a space in your COREBASE directory path. Please move the installation to a directory which doesn't include a space."
 
     if messages != "":
-        raise_sanity_error(sanity_data.expand(messages), sanity_data)
+        raise_sanity_error(sanity_data.expand(messages), sanity_data, network_error)
 
 # Create a copy of the datastore and finalise it to ensure appends and 
 # overrides are set - the datastore has yet to be finalised at ConfigParsed
Signature · 1 line
1.7.9.5