Skip to contentSkip to conversation

command.py: multiconfig support for findBestProvider

PATCH New Juro Bystricky 1 participant 1 message Apr 10, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 command.py: multiconfig support for findBestProvider

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, which does not handle multiconfig. This patch fixes the error and in the case mentioned above the tinfoil call returns:

"multiconfig:arduino-101-sss:/data/master/poky/meta/recipes-devtools/gcc/gcc_6.3.bb"

[YOCTO#11210]

---
 bitbake/lib/bb/command.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
bitbake/lib/bb/command.py +8 -2
index 78a86ac..390d4f1 100644
@@ -141,6 +141,12 @@ class Command:
         self.currentAsyncCommand = None
         self.cooker.finishcommand()
 
+def split_mc_pn(pn):
+    if pn.startswith("multiconfig:"):
+        _, mc, pn = pn.split(":", 2)
+        return (mc, pn)
+    return ('', pn)
+
 class CommandsSync:
     """
     A class of synchronous commands
@@ -425,8 +431,8 @@ class CommandsSync:
     findProviders.readonly = True
 
     def findBestProvider(self, command, params):
-        pn = params[0]
-        return command.cooker.findBestProvider(pn)
+        (mc, pn) = split_mc_pn(params[0])
+        return command.cooker.findBestProvider(pn, mc)
     findBestProvider.readonly = True
 
     def allProviders(self, command, params):
Signature · 1 line
2.7.4