Skip to contentSkip to conversation

Fix some bugs and usability issues in hob

PATCH Applied Joshua Lock 2 participants 5 messages Aug 24, 2011 – Aug 25, 2011 Arm STM32

lore
Share & tools
lore
#0 lore raw

cover Fix some bugs and usability issues in hob

Jessica Zhang identified some issues in hob which are addressed by this series.

The following changes since commit 692c2fcead5c82249359ad54d2c7941d087a2eb3:

usermanual: The git fetcher defaults to the git protocol (or file) (2011-08-23 09:59:50 -0700)

are available in the git repository at:
git://github.com/incandescant/bitbake hob
https://github.com/incandescant/bitbake/tree/hob

Joshua Lock (3):
hob: don't set PARALLEL_MAKE and BB_NUMBER_THREADS based on cpu count bb/ui/crumbs/tasklistmodel: fix find_reverse_depends method
hob: disable some menu entries whilst build is in progress

 lib/bb/ui/crumbs/hobprefs.py      |    4 +--
 lib/bb/ui/crumbs/tasklistmodel.py |    2 +-
 lib/bb/ui/hob.py                  |   41 ++++++++++++++++++++++++------------
 3 files changed, 29 insertions(+), 18 deletions(-)
Signature · 1 line
1.7.6
#1 lore raw

PATCH 1/3 hob: don't set PARALLEL_MAKE and BB_NUMBER_THREADS based on cpu count

This was actually broken with recent changes as the values were never persisted to a file (meaning they were unset on the server at reparse despite the UI indicating they were set).

However, I've chosen to remove the 'feature' as pegging a users CPU without them asking to use high thread counts seems a little offensive.

---
 lib/bb/ui/crumbs/hobprefs.py |    4 +---
 lib/bb/ui/hob.py             |   11 +++--------
 2 files changed, 4 insertions(+), 11 deletions(-)
lib/bb/ui/crumbs/hobprefs.py +1 -3
index ee42e58..3859b29 100644
@@ -166,7 +166,7 @@ class HobPrefs(gtk.Dialog):
             self.reload_required = False
 
     def __init__(self, configurator, handler, curr_sdk_mach, curr_distro, pclass,
-                 cpu_cnt, pmake, bbthread, selected_image_types, all_image_types,
+                 pmake, bbthread, selected_image_types, all_image_types,
                  gplv3disabled, build_toolchain, build_toolchain_headers):
         """
         """
@@ -185,7 +185,6 @@ class HobPrefs(gtk.Dialog):
         self.curr_sdk_mach = curr_sdk_mach
         self.curr_distro = curr_distro
         self.curr_package_format = pclass
-        self.cpu_cnt = cpu_cnt
         self.pmake = pmake
         self.bbthread = bbthread
         self.selected_image_types = selected_image_types.split(" ")
@@ -283,7 +282,6 @@ class HobPrefs(gtk.Dialog):
         # set a high maximum as a value for upper bounds is required by the
         # gtk.Adjustment
         spin_max = 30 # seems like a high enough arbitrary number
-        #spin_max = self.cpu_cnt * 3
         hbox.pack_start(label, expand=False, fill=False, padding=6)
         bbadj = gtk.Adjustment(value=self.bbthread, lower=1, upper=spin_max, step_incr=1)
         bbspinner = gtk.SpinButton(adjustment=bbadj, climb_rate=1, digits=0)
lib/bb/ui/hob.py +3 -8
index 105b0ef..7278643 100644
@@ -962,9 +962,6 @@ class MainWindow (gtk.Window):
         return scroll
 
 def main (server, eventHandler):
-    import multiprocessing
-    cpu_cnt = multiprocessing.cpu_count()
-
     gobject.threads_init()
 
     taskmodel = TaskListModel()
@@ -979,14 +976,12 @@ def main (server, eventHandler):
     distro = server.runCommand(["getVariable", "DISTRO"])
     bbthread = server.runCommand(["getVariable", "BB_NUMBER_THREADS"])
     if not bbthread:
-        bbthread = cpu_cnt
-        handler.set_bbthreads(cpu_cnt)
+        bbthread = 1
     else:
         bbthread = int(bbthread)
     pmake = server.runCommand(["getVariable", "PARALLEL_MAKE"])
     if not pmake:
-        pmake = cpu_cnt
-        handler.set_pmake(cpu_cnt)
+        pmake = 1
     else:
         # The PARALLEL_MAKE variable will be of the format: "-j 3" and we only
         # want a number for the spinner, so strip everything from the variable
@@ -1012,7 +1007,7 @@ def main (server, eventHandler):
     build_headers = bool(server.runCommand(["getVariable", "HOB_BUILD_TOOLCHAIN_HEADERS"]))
     handler.toggle_toolchain_headers(build_headers)
 
-    prefs = HobPrefs(configurator, handler, sdk_mach, distro, pclass, cpu_cnt,
+    prefs = HobPrefs(configurator, handler, sdk_mach, distro, pclass,
                      pmake, bbthread, selected_image_types, all_image_types,
                      gplv3disabled, build_toolchain, build_headers)
     layers = LayerEditor(configurator, None)
Signature · 1 line
1.7.6
#2 lore raw

PATCH 2/3 bb/ui/crumbs/tasklistmodel: fix find_reverse_depends method

In reply to Joshua Lock

This fixes an embarassing typo which meant the method actually returned a list of packages which didn't depend on the passed pn.

---
 lib/bb/ui/crumbs/tasklistmodel.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
lib/bb/ui/crumbs/tasklistmodel.py +1 -1
index 3921581..5ff1f5a 100644
@@ -577,7 +577,7 @@ class TaskListModel(gtk.ListStore):
             if not itype == 'package':
                 continue
 
-            if pn not in deps:
+            if pn in deps:
                 revdeps.append(name)
 
         if pn in revdeps:
Signature · 1 line
1.7.6
#3 lore raw

PATCH 3/3 hob: disable some menu entries whilst build is in progress

In reply to Joshua Lock

It doesn't make sense to be able to modify the preferences and add/remove layers whilst a build is in progress - disable the relevant menu items once the build has started and re-enable them once the user has returned to the creation view.

---
 lib/bb/ui/hob.py |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)
lib/bb/ui/hob.py +24 -6
index 7278643..c2acada 100644
@@ -469,12 +469,21 @@ class MainWindow (gtk.Window):
         else:
             self.handler.build_packages(self.model.get_selected_pn())
 
+        # Disable parts of the menu which shouldn't be used whilst building
+        self.set_menus_sensitive(False)
         self.nb.set_current_page(1)
 
+    def set_menus_sensitive(self, sensitive):
+        self.add_layers_action.set_sensitive(sensitive)
+        self.layers_action.set_sensitive(sensitive)
+        self.prefs_action.set_sensitive(sensitive)
+        self.open_action.set_sensitive(sensitive)
+
     def back_button_clicked_cb(self, button):
         self.toggle_createview()
 
     def toggle_createview(self):
+        self.set_menus_sensitive(True)
         self.build.model.clear()
         self.nb.set_current_page(0)
 
@@ -816,18 +825,27 @@ class MainWindow (gtk.Window):
 
         actions = gtk.ActionGroup('ImageCreator')
         self.actions = actions
-        actions.add_actions([('Quit', gtk.STOCK_QUIT, None, None,
-                              None, self.menu_quit,),
+        actions.add_actions([('Quit', gtk.STOCK_QUIT, None, None, None, self.menu_quit,),
                              ('File', None, '_File'),
                              ('Save', gtk.STOCK_SAVE, None, None, None, self.save_cb),
                              ('Save As', gtk.STOCK_SAVE_AS, None, None, None, self.save_as_cb),
-                             ('Open', gtk.STOCK_OPEN, None, None, None, self.open_cb),
-                             ('AddLayer', None, 'Add Layer', None, None, self.add_layer_cb),
                              ('Edit', None, '_Edit'),
                              ('Help', None, '_Help'),
-                             ('Layers', None, 'Layers', None, None, self.layers_cb),
-                             ('Preferences', gtk.STOCK_PREFERENCES, None, None, None, self.preferences_cb),
                              ('About', gtk.STOCK_ABOUT, None, None, None, self.about_cb)])
+
+        self.add_layers_action = gtk.Action('AddLayer', 'Add Layer', None, None)
+        self.add_layers_action.connect("activate", self.add_layer_cb)
+        self.actions.add_action(self.add_layers_action)
+        self.layers_action = gtk.Action('Layers', 'Layers', None, None)
+        self.layers_action.connect("activate", self.layers_cb)
+        self.actions.add_action(self.layers_action)
+        self.prefs_action = gtk.Action('Preferences', 'Preferences', None, None)
+        self.prefs_action.connect("activate", self.preferences_cb)
+        self.actions.add_action(self.prefs_action)
+        self.open_action = gtk.Action('Open', 'Open', None, None)
+        self.open_action.connect("activate", self.open_cb)
+        self.actions.add_action(self.open_action)
+
         uimanager.insert_action_group(actions, 0)
         uimanager.add_ui_from_string(menu_items)
 
Signature · 1 line
1.7.6
#4 lore raw
In reply to Joshua Lock
Quoted 7 lines · Joshua Lock

Jessica Zhang identified some issues in hob which are addressed by this series.

The following changes since commit 692c2fcead5c82249359ad54d2c7941d087a2eb3:

usermanual: The git fetcher defaults to the git protocol (or file) (2011-08-23 09:59:50 -0700)

Quoted 8 lines

are available in the git repository at:
git://github.com/incandescant/bitbake hob
https://github.com/incandescant/bitbake/tree/hob

Joshua Lock (3):
hob: don't set PARALLEL_MAKE and BB_NUMBER_THREADS based on cpu count bb/ui/crumbs/tasklistmodel: fix find_reverse_depends method
hob: disable some menu entries whilst build is in progress

Merged to master, thanks.

Richard