Skip to contentSkip to conversation

Fix NameError in generatePkgDepTreeData

PATCH New Andy Voltz 1 participant 3 messages May 18, 2017

lore
Share & tools
lore

Andy Voltz

author
#0 lore raw

cover Fix NameError in generatePkgDepTreeData

As part of the multi-config changes it looks like the wrong loop variable is used which causes a NameError. The rdepends loop which follows is correct, so the fix mimics that.

The first patch is needed to run this script which demonstrates the issue:
https://gist.github.com/avoltz/e28fb3d6d9980f2d8c073e0d146cbc69

I run that script from bitbake/bin with and without the 2nd patch for testing.

The second patch fixes:

File "../poky/bitbake/lib/bb/cooker.py", line 910, in generatePkgDepTreeData
if dep in taskdata[mc].build_targets and taskdata[mc].build_targets[dep]:
NameError: name 'dep' is not defined

I'm not sure if the first patch is the best method to enable HOB caches, but it helps with the test case..

author
#1 lore raw

PATCH 1/2 tinfoil: allow extra features to be passed to prepare

---
 lib/bb/tinfoil.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
lib/bb/tinfoil.py +4 -1
index 928333a..563c0c4 100644
@@ -228,12 +228,15 @@ class Tinfoil:
     def __exit__(self, type, value, traceback):
         self.shutdown()
 
-    def prepare(self, config_only=False, config_params=None, quiet=0):
+    def prepare(self, config_only=False, config_params=None, quiet=0, extra_features=None):
         if self.tracking:
             extrafeatures = [bb.cooker.CookerFeatures.BASEDATASTORE_TRACKING]
         else:
             extrafeatures = []
 
+        if extra_features:
+            extrafeatures += extra_features
+
         if not config_params:
             config_params = TinfoilConfigParameters(config_only=config_only, quiet=quiet)
 
Signature · 1 line
2.1.4
author
#2 lore raw

PATCH 2/2 cooker: fix undefined dep in generatePkgDepTreeData

In reply to Andy Voltz

The loop for populating the depends of the tree data should use dep instead of item.

---
 lib/bb/cooker.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/bb/cooker.py +2 -2
index bc8574a..8846690 100644
@@ -905,13 +905,13 @@ class BBCooker:
                 seen_fns.append(taskfn)
 
                 depend_tree["depends"][pn] = []
-                for item in taskdata[mc].depids[taskfn]:
+                for dep in taskdata[mc].depids[taskfn]:
                     pn_provider = ""
                     if dep in taskdata[mc].build_targets and taskdata[mc].build_targets[dep]:
                         fn_provider = taskdata[mc].build_targets[dep][0]
                         pn_provider = self.recipecaches[mc].pkg_fn[fn_provider]
                     else:
-                        pn_provider = item
+                        pn_provider = dep
                     pn_provider = self.add_mc_prefix(mc, pn_provider)
                     depend_tree["depends"][pn].append(pn_provider)
 
Signature · 1 line
2.1.4