All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cooker.py: multiconfig support for findBestProvider
@ 2017-04-05 21:34 Juro Bystricky
  2017-04-06  8:43 ` Patrick Ohly
  0 siblings, 1 reply; 4+ messages in thread
From: Juro Bystricky @ 2017-04-05 21:34 UTC (permalink / raw)
  To: bitbake-devel

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@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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-06 14:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-05 21:34 [PATCH] cooker.py: multiconfig support for findBestProvider Juro Bystricky
2017-04-06  8:43 ` Patrick Ohly
2017-04-06 11:45   ` Richard Purdie
2017-04-06 14:23     ` Bystricky, Juro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.