Skip to contentSkip to conversation

Bug fixes for the hob GUI

PATCH In review Joshua Lock 2 participants 6 messages Jul 12, 2011 – Jul 13, 2011 Arm STM32

lore
Share & tools
lore
#0 lore raw

cover Bug fixes for the hob GUI

The attached series contains three patches which fix Yocto bugs #1218 and #1219. More detail in the commit headers.

The following changes since commit 521909d1350a415d19516aa1710041e30950c7cc:

bitbake cooker/ui: handle cmd line parsing result by individual UI. (2011-07-08 17:38:06 +0100)

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

Joshua Lock (3):
ui/crumbs/tasklistmodel: update brought in by column when possible ui/crumbs/tasklistmodel: fix automatic removal of orphaned items
cooker: only return *Found events if something was actually found

 lib/bb/cooker.py                  |   12 ++++++---
 lib/bb/ui/crumbs/tasklistmodel.py |   48 ++++++++++++++++++++++--------------
 2 files changed, 37 insertions(+), 23 deletions(-)
Signature · 1 line
1.7.6
#1 lore raw

PATCH 1/3 ui/crumbs/tasklistmodel: update brought in by column when possible

When a package is orphaned we were not correctly updating the brought-in-by column if a later package additon would have brought that package in as a dependency. This patch ensures that orphan packages are correctly re-parented when appropriate.

Partially addresses [YOCTO #1218]

---
 lib/bb/ui/crumbs/tasklistmodel.py |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
lib/bb/ui/crumbs/tasklistmodel.py +10 -4
index 5e979b7..3e74e7f 100644
@@ -390,8 +390,9 @@ class TaskListModel(gtk.ListStore):
         if not cur_inc:
             self[item_path][self.COL_INC] = True
             self[item_path][self.COL_BINB] = binb
-        # We want to do some magic with things which are brought in by the base
-        # image so tag them as so
+
+        # We want to do some magic with things which are brought in by the
+        # base image so tag them as so
         if image_contents:
             self[item_path][self.COL_IMG] = True
             if self[item_path][self.COL_TYPE] == 'image':
@@ -403,12 +404,17 @@ class TaskListModel(gtk.ListStore):
                 # If the contents model doesn't already contain dep, add it
                 # We only care to show things which will end up in the
                 # resultant image, so filter cross and native recipes
-                if not self.contents_includes_name(dep) and not dep.endswith("-native") and not dep.endswith("-cross"):
-                    path = self.find_path_for_item(dep)
+                dep_included = self.contents_includes_name(dep)
+                path = self.find_path_for_item(dep)
+                if not dep_included and not dep.endswith("-native") and not dep.endswith("-cross"):
                     if path:
                         self.include_item(path, name, image_contents)
                     else:
                         pass
+                # Set brought in by for any no longer orphan packages
+                elif dep_included and path:
+                    if not self[path][self.COL_BINB]:
+                        self[path][self.COL_BINB] = name
 
     """
     Find the model path for the item_name
Signature · 1 line
1.7.6
#2 lore raw

PATCH 2/3 ui/crumbs/tasklistmodel: fix automatic removal of orphaned items

In reply to Joshua Lock

The sweep_up() method intends to remove all packages with an empty brought in by column, this patch changes the implementation to be more reliable.

Each time a removal is triggered we begin interating the contents model again at the beginning, only once the contents model has been iterated from start to finish without any removals can we be certain that there will be no more orphaned items.

Fixes [YOCTO #1218]

---
 lib/bb/ui/crumbs/tasklistmodel.py |   34 +++++++++++++++++++---------------
 1 files changed, 19 insertions(+), 15 deletions(-)
lib/bb/ui/crumbs/tasklistmodel.py +19 -15
index 3e74e7f..633931d 100644
@@ -327,24 +327,28 @@ class TaskListModel(gtk.ListStore):
     If the item isn't a package we leave it included.
     """
     def sweep_up(self):
-        model = self.contents
-        removals = []
         it = self.contents.get_iter_first()
-
-	while it:
-            binb = model.get_value(it, self.COL_BINB)
-            itype = model.get_value(it, self.COL_TYPE)
+        while it:
+            binb = self.contents.get_value(it, self.COL_BINB)
+            itype = self.contents.get_value(it, self.COL_TYPE)
+            remove = False
 
             if itype == 'package' and not binb:
-                opath = model.convert_path_to_child_path(model.get_path(it))
-                if not opath in removals:
-                    removals.extend(opath)
-
-            it = model.iter_next(it)
-
-	while removals:
-	    path = removals.pop()
-	    self.mark(path)
+                oit = self.contents.convert_iter_to_child_iter(it)
+                opath = self.get_path(oit)
+                self.mark(opath)
+                remove = True
+
+            # When we remove a package from the contents model we alter the
+            # model, so continuing to iterate is bad. *Furthermore* it's
+            # likely that the removal has affected an already iterated item
+            # so we should start from the beginning anyway.
+            # Only when we've managed to iterate the entire contents model
+            # without removing any items do we allow the loop to exit.
+            if remove:
+                it = self.contents.get_iter_first()
+            else:
+                it = self.contents.iter_next(it)
 
     """
     Find the name of an item in the image contents which depends on the item
Signature · 1 line
1.7.6
#3 lore raw

PATCH 3/3 cooker: only return *Found events if something was actually found

In reply to Joshua Lock

The cooker methods which fire FooBarFound style events should only fire the event when an item was actually found, rather than each time the method is called.

Fixes [YOCTO #1219]

---
 lib/bb/cooker.py |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
lib/bb/cooker.py +8 -4
index 7aa600f..8b6da1d 100644
@@ -546,14 +546,15 @@ class BBCooker:
 
     def findConfigFilePath(self, configfile):
         path = self._findConfigFile(configfile)
-        bb.event.fire(bb.event.ConfigFilePathFound(path), self.configuration.data)
+        if path:
+            bb.event.fire(bb.event.ConfigFilePathFound(path), self.configuration.data)
 
     def findFilesMatchingInDir(self, filepattern, directory):
         """
         Searches for files matching the regex 'pattern' which are children of
         'directory' in each BBPATH. i.e. to find all rootfs package classes available
         to BitBake one could call findFilesMatchingInDir(self, 'rootfs_', 'classes')
-        or to find all machine configuration files on could call
+        or to find all machine configuration files one could call:
         findFilesMatchingInDir(self, 'conf/machines', 'conf')
         """
         import re
@@ -569,7 +570,8 @@ class BBCooker:
                         if p.search(f):
                             matches.append(f)
 
-        bb.event.fire(bb.event.FilesMatchingFound(filepattern, matches), self.configuration.data)
+        if len(matches):
+            bb.event.fire(bb.event.FilesMatchingFound(filepattern, matches), self.configuration.data)
 
     def findConfigFiles(self, varname):
         """
@@ -592,7 +594,8 @@ class BBCooker:
                         if end == 'conf':
                             possible.append(val)
 
-        bb.event.fire(bb.event.ConfigFilesFound(var, possible), self.configuration.data)
+        if len(possible):
+            bb.event.fire(bb.event.ConfigFilesFound(var, possible), self.configuration.data)
 
     def findInheritsClass(self, klass):
         """
@@ -667,6 +670,7 @@ class BBCooker:
                 return confpath
 
             path, _ = os.path.split(path)
+        return None
 
     def _findLayerConf(self):
         return self._findConfigFile("bblayers.conf")
Signature · 1 line
1.7.6
#4 lore raw

Re: [PATCH 3/3] cooker: only return *Found events if something was actually found

lib/bb/cooker.py class BBCooker: · line 574

Quoted 7 lines · Joshua Lock
lib/bb/cooker.py +2 -1
@@ -569,7 +570,8 @@ class BBCooker:
                         if p.search(f):
                             matches.append(f)
 
-        bb.event.fire(bb.event.FilesMatchingFound(filepattern, matches), self.configuration.data)
+        if len(matches):
+            bb.event.fire(bb.event.FilesMatchingFound(filepattern, matches), self.configuration.data)

I think this can just be "if matches:"

lib/bb/cooker.py class BBCooker: · line 601

Quoted 12 lines
lib/bb/cooker.py +2 -1
     def findConfigFiles(self, varname):
         """
@@ -592,7 +594,8 @@ class BBCooker:
                         if end == 'conf':
                             possible.append(val)
 
-        bb.event.fire(bb.event.ConfigFilesFound(var, possible), self.configuration.data)
+        if len(possible):
+            bb.event.fire(bb.event.ConfigFilesFound(var, possible), self.configuration.data)
 
     def findInheritsClass(self, klass):
         """

ditto.

Cheers,

Richard

#5 lore raw
In reply to Joshua Lock
Quoted 7 lines · Joshua Lock

The attached series contains three patches which fix Yocto bugs #1218 and #1219. More detail in the commit headers.

The following changes since commit 521909d1350a415d19516aa1710041e30950c7cc:

bitbake cooker/ui: handle cmd line parsing result by individual UI. (2011-07-08 17:38:06 +0100)

Quoted 7 lines

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

Joshua Lock (3):
ui/crumbs/tasklistmodel: update brought in by column when possible ui/crumbs/tasklistmodel: fix automatic removal of orphaned items

These have merged to master, thanks.

Quoted 1 line

cooker: only return *Found events if something was actually found

and this one will be fine with a tweak :)

Cheers,

Richard