bitbake之findProvider
def findProvider (self, item, runtime = False, elig = False):
"""
find something to provide a named build requirement
(takes item names from DEPENDS namespace)
"""
fn = None
discriminated = False
if runtime:
all_p = bb.providers.getRuntimeProviders(self.status, item)
else:
if not item in self.status.providers:
// 如果在provider中没有找到item,如果在ignored_dependecies也没有发现,
// 就会提示 Nothing provider dependency
if not (item in self.status.ignored_dependencies):
print self.status.ignored_dependencies
bb.msg.error(bb.msg.domain.Depends, "Nothing provides dependency '%s'" % item)
bb.event.fire(bb.event.NoProvider(item,self.configuration.data))
return ""
all_p = self.status.providers[item]
verbose = bb.msg.verbose
bb.msg.set_verbose (False)
eligible = bb.providers.filterProviders(all_p, item, self.configuration.data, self.status)
bb.msg.set_verbose (verbose)
if not eligible:
return None
prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % item, self.configuration.data, 1)
if prefervar:
self.status.preferred[item] = prefervar
if item in self.status.preferred:
for p in eligible:
pn = self.status.pkg_fn[p]
if self.status.preferred[item] == pn:
# bb.msg.note(2, bb.msg.domain.Provider, "selecting %s to satisfy %s due to PREFERRED_PROVIDERS" % (pn, item))
eligible.remove(p)
eligible = [p] + eligible
discriminated = True
break
if elig:
return eligible
else:
return self.status.pkg_fn[eligible[0]]