diff options
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 14 | ||||
-rw-r--r-- | bitbake/lib/bb/providers.py | 36 |
2 files changed, 37 insertions, 13 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index b6bd7400fe..652cd5d5c2 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -259,20 +259,8 @@ class BBCooker: | |||
259 | # Need files parsed | 259 | # Need files parsed |
260 | self.updateCache() | 260 | self.updateCache() |
261 | 261 | ||
262 | # Need to ensure data store is expanded | ||
263 | localdata = data.createCopy(self.configuration.data) | ||
264 | bb.data.update_data(localdata) | ||
265 | bb.data.expandKeys(localdata) | ||
266 | |||
267 | pkg_pn = self.status.pkg_pn | 262 | pkg_pn = self.status.pkg_pn |
268 | preferred_versions = {} | 263 | (latest_versions, preferred_versions) = bb.providers.findProviders(self.configuration.data, self.status, pkg_pn) |
269 | latest_versions = {} | ||
270 | |||
271 | # Sort by priority | ||
272 | for pn in pkg_pn: | ||
273 | (last_ver, last_file, pref_ver, pref_file) = bb.providers.findBestProvider(pn, localdata, self.status) | ||
274 | preferred_versions[pn] = (pref_ver, pref_file) | ||
275 | latest_versions[pn] = (last_ver, last_file) | ||
276 | 264 | ||
277 | logger.plain("%-35s %25s %25s", "Package Name", "Latest Version", "Preferred Version") | 265 | logger.plain("%-35s %25s %25s", "Package Name", "Latest Version", "Preferred Version") |
278 | logger.plain("%-35s %25s %25s\n", "============", "==============", "=================") | 266 | logger.plain("%-35s %25s %25s\n", "============", "==============", "=================") |
diff --git a/bitbake/lib/bb/providers.py b/bitbake/lib/bb/providers.py index 398c8ea115..1dc6a8e8bf 100644 --- a/bitbake/lib/bb/providers.py +++ b/bitbake/lib/bb/providers.py | |||
@@ -24,6 +24,7 @@ | |||
24 | import re | 24 | import re |
25 | import logging | 25 | import logging |
26 | from bb import data, utils | 26 | from bb import data, utils |
27 | from collections import defaultdict | ||
27 | import bb | 28 | import bb |
28 | 29 | ||
29 | logger = logging.getLogger("BitBake.Provider") | 30 | logger = logging.getLogger("BitBake.Provider") |
@@ -35,6 +36,41 @@ class NoRProvider(bb.BBHandledException): | |||
35 | """Exception raised when no provider of a runtime dependency can be found""" | 36 | """Exception raised when no provider of a runtime dependency can be found""" |
36 | 37 | ||
37 | 38 | ||
39 | def findProviders(cfgData, dataCache, pkg_pn = None): | ||
40 | """ | ||
41 | Convenience function to get latest and preferred providers in pkg_pn | ||
42 | """ | ||
43 | |||
44 | if not pkg_pn: | ||
45 | pkg_pn = dataCache.pkg_pn | ||
46 | |||
47 | # Need to ensure data store is expanded | ||
48 | localdata = data.createCopy(cfgData) | ||
49 | bb.data.update_data(localdata) | ||
50 | bb.data.expandKeys(localdata) | ||
51 | |||
52 | preferred_versions = {} | ||
53 | latest_versions = {} | ||
54 | |||
55 | for pn in pkg_pn: | ||
56 | (last_ver, last_file, pref_ver, pref_file) = findBestProvider(pn, localdata, dataCache, pkg_pn) | ||
57 | preferred_versions[pn] = (pref_ver, pref_file) | ||
58 | latest_versions[pn] = (last_ver, last_file) | ||
59 | |||
60 | return (latest_versions, preferred_versions) | ||
61 | |||
62 | |||
63 | def allProviders(dataCache): | ||
64 | """ | ||
65 | Find all providers for each pn | ||
66 | """ | ||
67 | all_providers = defaultdict(list) | ||
68 | for (fn, pn) in dataCache.pkg_fn.items(): | ||
69 | ver = dataCache.pkg_pepvpr[fn] | ||
70 | all_providers[pn].append((ver, fn)) | ||
71 | return all_providers | ||
72 | |||
73 | |||
38 | def sortPriorities(pn, dataCache, pkg_pn = None): | 74 | def sortPriorities(pn, dataCache, pkg_pn = None): |
39 | """ | 75 | """ |
40 | Reorder pkg_pn by file priority and default preference | 76 | Reorder pkg_pn by file priority and default preference |