Skip to contentSkip to conversation

Switch from recipe-level to package-level data in hob

PATCH Applied Joshua Lock 2 participants 7 messages Aug 13, 2011 – Aug 15, 2011 Arm STM32

lore
Share & tools
lore
#0 lore raw

cover Switch from recipe-level to package-level data in hob

We currently store recipe-level data in the tasklistmodel (include the contents of foo recipe) whereas in reality we're likely want to do package-level operations, as required by EXTRA_IMAGE_INSTALL.

This series enables package-level data in the model and optimises a few methods to cope with the increased model size.

Regards,
Joshua

The following changes since commit b3ad7acebfad3063c3364f4492f53b25bf53cf81:

lib/bb/ui/crumbs/hobprefs: fix erroneous save/reparse (2011-08-12 17:48:13 +0100)

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

Joshua Lock (5):
bb/crumbs/tasklistmodel: filter nativesdk packages out of views bb/ui/crumbs/tasklistmodel: include package level information bb/ui/crumbs/tasklistmodel: optimise find_path_for_item bb/ui/crumbs/tasklistmodel: make package_model_filter a little safer bb/ui/crumbs/tasklistmodel: simplify conditional in include_item

 lib/bb/ui/crumbs/tasklistmodel.py |   56 ++++++++++++++++++------------------
 1 files changed, 28 insertions(+), 28 deletions(-)
Signature · 1 line
1.7.6
#1 lore raw

PATCH 1/5 bb/crumbs/tasklistmodel: filter nativesdk packages out of views

---
 lib/bb/ui/crumbs/tasklistmodel.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
lib/bb/ui/crumbs/tasklistmodel.py +1 -1
index 7a463a6..c0b0495 100644
@@ -132,7 +132,7 @@ class TaskListModel(gtk.ListStore):
         if not model.get_value(it, self.COL_INC) or model.get_value(it, self.COL_TYPE) == 'image':
             return False
         name = model.get_value(it, self.COL_NAME)
-        if name.endswith('-native') or name.endswith('-cross'):
+        if name.count('-native') or name.count('-cross'):
             return False
         else:
             return True
Signature · 1 line
1.7.6
#2 lore raw

PATCH 2/5 bb/ui/crumbs/tasklistmodel: include package level information

In reply to Joshua Lock

Until now the hob UI has only contained recipe (pn) level targets in the data store, this patch switches to including package level information.

This is slightly slower in all model related cases (more entries) but gives much more flexibility for image customisation.

---
 lib/bb/ui/crumbs/tasklistmodel.py |   40 +++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 21 deletions(-)
lib/bb/ui/crumbs/tasklistmodel.py +19 -21
index c0b0495..1f00f6c 100644
@@ -226,32 +226,30 @@ class TaskListModel(gtk.ListStore):
             lic = event_model["pn"][item]["license"]
             group = event_model["pn"][item]["section"]
             filename = event_model["pn"][item]["filename"]
-            depends = event_model["depends"].get(item, "")
-            rdepends = event_model["rdepends-pn"].get(item, "")
-            if rdepends:
-                for rdep in rdepends:
-                    if event_model["packages"].get(rdep, ""):
-                        pn = event_model["packages"][rdep].get("pn", "")
-                        if pn:
-                            depends.append(pn)
-
-            # uniquify the list of depends
-            depends = self.squish(depends)
-            # remove circular dependencies
-            if name in depends:
-                depends.remove(name)
-            deps = " ".join(depends)
-
             if name.count('task-') > 0:
                 atype = 'task'
             elif name.count('-image-') > 0:
                 atype = 'image'
 
-            self.set(self.append(), self.COL_NAME, name, self.COL_DESC, summary,
-                     self.COL_LIC, lic, self.COL_GROUP, group,
-                     self.COL_DEPS, deps, self.COL_BINB, "",
-                     self.COL_TYPE, atype, self.COL_INC, False,
-                     self.COL_IMG, False, self.COL_PATH, filename)
+            depends = event_model["depends"].get(item, [])
+            rdepends = event_model["rdepends-pn"].get(item, [])
+            if ("%s-dev" % item) in rdepends:
+                rdepends.remove("%s-dev" % item)
+            packages = {}
+            for pkg in event_model["packages"]:
+                if event_model["packages"][pkg]["pn"] == name:
+                    deps = []
+                    deps.extend(depends)
+                    deps.extend(event_model["rdepends-pkg"].get(pkg, []))
+                    deps.extend(rdepends)
+                    packages[pkg] = deps
+
+            for p in packages:
+                self.set(self.append(), self.COL_NAME, p, self.COL_DESC, summary,
+                         self.COL_LIC, lic, self.COL_GROUP, group,
+                         self.COL_DEPS, " ".join(packages[p]), self.COL_BINB, "",
+                         self.COL_TYPE, atype, self.COL_INC, False,
+                         self.COL_IMG, False, self.COL_PATH, filename)
 
 	self.emit("tasklist-populated")
 
Signature · 1 line
1.7.6
#3 lore raw

PATCH 3/5 bb/ui/crumbs/tasklistmodel: optimise find_path_for_item

In reply to Joshua Lock

If the item_name contains virtual/, -native or -cross it won't be present in the model. Return None early in this circumstance rather than iterating the entire model and still returning None.

---
 lib/bb/ui/crumbs/tasklistmodel.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
lib/bb/ui/crumbs/tasklistmodel.py +5 -0
index 1f00f6c..baf4ede 100644
@@ -472,6 +472,11 @@ class TaskListModel(gtk.ListStore):
     Returns the path in the model or None
     """
     def find_path_for_item(self, item_name):
+        # We don't include virtual/* or *-native items in the model so save a
+        # heavy iteration loop by exiting early for these items
+        if item_name.startswith("virtual/") or item_name.count('-native') or item_name.count('-cross'):
+            return None
+
         it = self.get_iter_first()
         path = None
         while it:
Signature · 1 line
1.7.6
#4 lore raw

PATCH 4/5 bb/ui/crumbs/tasklistmodel: make package_model_filter a little safer

In reply to Joshua Lock

Ignore names that include '-cross', rather than just 'cross'

---
 lib/bb/ui/crumbs/tasklistmodel.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
lib/bb/ui/crumbs/tasklistmodel.py +1 -1
index baf4ede..4da3e1e 100644
@@ -196,7 +196,7 @@ class TaskListModel(gtk.ListStore):
             return False
         else:
             name = model.get_value(it, self.COL_NAME)
-            if name.count('-native') or name.count('cross'):
+            if name.count('-native') or name.count('-cross'):
                 return False
             return True
 
Signature · 1 line
1.7.6
#5 lore raw

PATCH 5/5 bb/ui/crumbs/tasklistmodel: simplify conditional in include_item

In reply to Joshua Lock

No need to check if the name ends with -native or -cross as path will be None in this instance.

---
 lib/bb/ui/crumbs/tasklistmodel.py |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
lib/bb/ui/crumbs/tasklistmodel.py +2 -5
index 4da3e1e..203b628 100644
@@ -457,11 +457,8 @@ class TaskListModel(gtk.ListStore):
                 # resultant image, so filter cross and native recipes
                 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
+                if not dep_included and path:
+                    self.include_item(path, name, image_contents)
                 # Set brought in by for any no longer orphan packages
                 elif dep_included and path:
                     if not self[path][self.COL_BINB]:
Signature · 1 line
1.7.6
#6 lore raw
In reply to Joshua Lock
Quoted 18 lines · Joshua Lock

We currently store recipe-level data in the tasklistmodel (include the contents of foo recipe) whereas in reality we're likely want to do package-level operations, as required by EXTRA_IMAGE_INSTALL.

This series enables package-level data in the model and optimises a few methods to cope with the increased model size.

Regards,
Joshua

The following changes since commit b3ad7acebfad3063c3364f4492f53b25bf53cf81:

lib/bb/ui/crumbs/hobprefs: fix erroneous save/reparse (2011-08-12 17:48:13 +0100)

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

Quoted 6 lines

Joshua Lock (5):
bb/crumbs/tasklistmodel: filter nativesdk packages out of views bb/ui/crumbs/tasklistmodel: include package level information bb/ui/crumbs/tasklistmodel: optimise find_path_for_item bb/ui/crumbs/tasklistmodel: make package_model_filter a little safer bb/ui/crumbs/tasklistmodel: simplify conditional in include_item

Merged to master, thanks.

Richard