Skip to contentSkip to conversation

command.py: multiconfig support for findBestProvider

PATCH Superseded Juro Bystricky 2 participants 3 messages Apr 8, 2017 – Apr 10, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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 | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
bitbake/lib/bb/command.py +9 -2
index 78a86ac..340842b 100644
@@ -141,6 +141,13 @@ class Command:
         self.currentAsyncCommand = None
         self.cooker.finishcommand()
 
+def split_mc_pn(pn):
+    if pn.startswith("multiconfig:"):
+        mc = pn.split(":")[1]
+        pn = ":".join(pn.split(":")[2:])
+        return (mc, pn)
+    return ('', pn)
+
 class CommandsSync:
     """
     A class of synchronous commands
@@ -425,8 +432,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
#1 lore raw
Quoted 27 lines · Juro Bystricky

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 | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
bitbake/lib/bb/command.py +0 -0
index 78a86ac..340842b 100644

bitbake/lib/bb/command.py class Command: · line 147

Quoted 7 lines
bitbake/lib/bb/command.py +4 -0
@@ -141,6 +141,13 @@ class Command:
         self.currentAsyncCommand = None
         self.cooker.finishcommand()
 
+def split_mc_pn(pn):
+    if pn.startswith("multiconfig:"):
+        mc = pn.split(":")[1]
+        pn = ":".join(pn.split(":")[2:])

I find this more readable:

if pn.startswith("multiconfig:"):

    _, mc, pn = pn.split(":", 2)

Not sure whether it is worth a v3, though.

Signature · 6 lines
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
#2 lore raw

I concur, it is more readable and I think it merits v3. V3 coming momentarily.

Juro

________________________________________
From: Patrick Ohly [[email protected]]
Sent: Sunday, April 09, 2017 11:01 PM
To: Bystricky, Juro
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2] command.py: multiconfig support for findBestProvider

bitbake/lib/bb/command.py class Command: · line 147

Quoted 4 lines
bitbake/lib/bb/command.py +4 -0
+def split_mc_pn(pn):
+    if pn.startswith("multiconfig:"):
+        mc = pn.split(":")[1]
+        pn = ":".join(pn.split(":")[2:])

I find this more readable:

if pn.startswith("multiconfig:"):

    _, mc, pn = pn.split(":", 2)

Not sure whether it is worth a v3, though.

--
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although I am an employee of Intel, the statements I make here in no way represent Intel's position on the issue, nor am I authorized to speak on behalf of Intel on this matter.