[bitbake-devel] [PATCH] cooker.py: multiconfig support for findBestProvider

Juro Bystricky juro.bystricky at intel.com
Wed Apr 5 21:34:05 UTC 2017


In a multiconfig environment, a tinfoil call such as

    tinfoil.parse_recipe("multiconfig:arduino-101-sss:gcc")

can fail with an error such as:

  File "/data/master/poky/bitbake/lib/bb/tinfoil.py", line 373, in get_recipe_file
    raise bb.providers.NoProvider('Unable to find any recipe file matching "%s"' % pn)
bb.providers.NoProvider: Unable to find any recipe file matching "multiconfig:arduino-101-sss:gcc"

The culprit is findBestProvider (only called from tinfoil), which does not
handle multiconfig. This patch fixes the error and the tinfoil call returns absolute path
to the recipe, i.e:

  "/data/master/poky/meta/recipes-devtools/gcc/gcc_6.3.bb"

[YOCTO#11210]

Signed-off-by: Juro Bystricky <juro.bystricky at intel.com>
---
 bitbake/lib/bb/cooker.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index bc8574a..bf9593e 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -160,6 +160,19 @@ class EventWriter:
 #============================================================================#
 # BBCooker
 #============================================================================#
+
+def split_mc_pn(pn):
+    if pn.startswith("multiconfig:"):
+        mc = pn.split(":")[1]
+        pn = ":".join(pn.split(":")[2:])
+        return (mc, pn)
+    return ('', pn)
+
+def split_pn(pn):
+    if pn.startswith("multiconfig:"):
+       return ":".join(pn.split(":")[2:])
+    return pn
+
 class BBCooker:
     """
     Manages one bitbake build run
@@ -1104,11 +1117,12 @@ class BBCooker:
     def findProviders(self, mc=''):
         return bb.providers.findProviders(self.data, self.recipecaches[mc], self.recipecaches[mc].pkg_pn)
 
-    def findBestProvider(self, pn, mc=''):
+    def findBestProvider(self, pn):
+        (mc, pn) = split_mc_pn(pn)
         if pn in self.recipecaches[mc].providers:
             filenames = self.recipecaches[mc].providers[pn]
             eligible, foundUnique = bb.providers.filterProviders(filenames, pn, self.data, self.recipecaches[mc])
-            filename = eligible[0]
+            filename = split_pn(eligible[0])
             return None, None, None, filename
         elif pn in self.recipecaches[mc].pkg_pn:
             return bb.providers.findBestProvider(pn, self.data, self.recipecaches[mc], self.recipecaches[mc].pkg_pn)
-- 
2.7.4




More information about the bitbake-devel mailing list