cooker.py: multiconfig support for findBestProvider
PATCH 1/1 cooker.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 (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]
--- bitbake/lib/bb/cooker.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
bitbake/lib/bb/cooker.py +16 -2
@@ -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)
Signature · 1 line
2.7.4
Quoted 10 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
raisebb.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"
Quoted 5 lines
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"
So tinfoil.parse_recipe("multiconfig:arduino-101-sss:gcc") and tinfoil.parse_recipe("gcc") then return identical data, because both end up parsing "/data/master/poky/meta/recipes-devtools/gcc/gcc_6.3.bb" without taking the "arduino-101-sss" config into account?
That wouldn't be correct.
As far as I understand it, the mapping has to be:
multiconfig:arduino-101-sss:gcc -> multiconfig:arduino-101-sss:/data/master/poky/meta/recipes-devtools/gcc/gcc_6.3.bb
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.
Quoted 28 lines · Patrick Ohly
Quoted 14 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
raisebb.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"Quoted 7 lines
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"
So
tinfoil.parse_recipe("multiconfig:arduino-101-sss:gcc")andtinfoil.parse_recipe("gcc")then return identical data, because both end
up parsing "/data/master/poky/meta/recipes-devtools/gcc/gcc_6.3.bb" without taking the "arduino-101-sss" config into account?
Quoted 6 lines
That wouldn't be correct.
As far as I understand it, the mapping has to be:
multiconfig:arduino-101-sss:gcc -> multiconfig:arduino-101-sss:/data/master/poky/meta/recipes- devtools/gcc/gcc_6.3.bb
I agree with Patrick. At a quick glance, I think the caller of findBestProvider is going to need to handle the mc, which is why findBestProvider takes it as a parameter.
Cheers,
Richard
Thanks, v2 coming soon. This clarifies some other issues as well.
Juro
________________________________________
From: Richard Purdie [[email protected]]
Sent: Thursday, April 06, 2017 4:45 AM
To: Ohly, Patrick; Bystricky, Juro
Cc: [email protected]
Subject: Re: [bitbake-devel] [PATCH] cooker.py: multiconfig support for findBestProvider
Quoted 28 lines · Patrick Ohly
Quoted 14 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"Quoted 7 lines
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"
So
tinfoil.parse_recipe("multiconfig:arduino-101-sss:gcc")andtinfoil.parse_recipe("gcc")then return identical data, because both end
up parsing "/data/master/poky/meta/recipes-devtools/gcc/gcc_6.3.bb" without taking the "arduino-101-sss" config into account?
Quoted 6 lines
That wouldn't be correct.
As far as I understand it, the mapping has to be:
multiconfig:arduino-101-sss:gcc -> multiconfig:arduino-101-sss:/data/master/poky/meta/recipes- devtools/gcc/gcc_6.3.bb
I agree with Patrick. At a quick glance, I think the caller of findBestProvider is going to need to handle the mc, which is why findBestProvider takes it as a parameter.
Cheers,
Richard