summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cooker.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-12-13 20:07:06 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-14 12:25:07 +0000
commit7d5c9860de05efc4272256ccefc530113f01d24e (patch)
tree659eb51c50941c2920215512e38d59da9cb85ee5 /bitbake/lib/bb/cooker.py
parente271d7dc606185130e0e47327205bd423490b7c2 (diff)
downloadpoky-7d5c9860de05efc4272256ccefc530113f01d24e.tar.gz
bitbake: tinfoil: rewrite as a wrapper around the UI
Rewrite tinfoil as a wrapper around the UI, instead of the earlier approach of starting up just enough of cooker to do what we want. This has several advantages: * It now works when bitbake is memory-resident instead of failing with "ERROR: Only one copy of bitbake should be run against a build directory". * We can now connect an actual UI, thus you get things like the recipe parsing / cache loading progress bar and parse error handling for free * We can now handle events generated by the server if we wish to do so * We can potentially extend this to do more stuff, e.g. actually running build operations - this needs to be made more practical before we can use it though (since you effectively have to become the UI yourself for this at the moment.) The downside is that tinfoil no longer has direct access to cooker, the global datastore, or the cache. To mitigate this I have extended data_smart to provide remote access capability for the datastore, and created "fake" cooker and cooker.recipecache / cooker.collection adapter objects in order to avoid breaking too many tinfoil-using scripts that might be out there (we've never officially documented tinfoil or BitBake's internal code, but we can still make accommodations where practical). I've at least gone far enough to support all of the utilities that use tinfoil in OE-Core with some changes, but I know there are scripts such as Chris Larson's "bb" out there that do make other calls into BitBake code that I'm not currently providing access to through the adapters. Part of the fix for [YOCTO #5470]. (Bitbake rev: 3bbf8d611c859f74d563778115677a04f5c4ab43) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r--bitbake/lib/bb/cooker.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 2614c4485a..48904a52d6 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -583,13 +583,12 @@ class BBCooker:
583 583
584 def showVersions(self): 584 def showVersions(self):
585 585
586 pkg_pn = self.recipecaches[''].pkg_pn 586 (latest_versions, preferred_versions) = self.findProviders()
587 (latest_versions, preferred_versions) = bb.providers.findProviders(self.data, self.recipecaches[''], pkg_pn)
588 587
589 logger.plain("%-35s %25s %25s", "Recipe Name", "Latest Version", "Preferred Version") 588 logger.plain("%-35s %25s %25s", "Recipe Name", "Latest Version", "Preferred Version")
590 logger.plain("%-35s %25s %25s\n", "===========", "==============", "=================") 589 logger.plain("%-35s %25s %25s\n", "===========", "==============", "=================")
591 590
592 for p in sorted(pkg_pn): 591 for p in sorted(self.recipecaches[''].pkg_pn):
593 pref = preferred_versions[p] 592 pref = preferred_versions[p]
594 latest = latest_versions[p] 593 latest = latest_versions[p]
595 594
@@ -1084,6 +1083,20 @@ class BBCooker:
1084 if matches: 1083 if matches:
1085 bb.event.fire(bb.event.FilesMatchingFound(filepattern, matches), self.data) 1084 bb.event.fire(bb.event.FilesMatchingFound(filepattern, matches), self.data)
1086 1085
1086 def findProviders(self, mc=''):
1087 return bb.providers.findProviders(self.data, self.recipecaches[mc], self.recipecaches[mc].pkg_pn)
1088
1089 def findBestProvider(self, pn, mc=''):
1090 if pn in self.recipecaches[mc].providers:
1091 filenames = self.recipecaches[mc].providers[pn]
1092 eligible, foundUnique = bb.providers.filterProviders(filenames, pn, self.expanded_data, self.recipecaches[mc])
1093 filename = eligible[0]
1094 return None, None, None, filename
1095 elif pn in self.recipecaches[mc].pkg_pn:
1096 return bb.providers.findBestProvider(pn, self.data, self.recipecaches[mc], self.recipecaches[mc].pkg_pn)
1097 else:
1098 return None, None, None, None
1099
1087 def findConfigFiles(self, varname): 1100 def findConfigFiles(self, varname):
1088 """ 1101 """
1089 Find config files which are appropriate values for varname. 1102 Find config files which are appropriate values for varname.