diff options
author | Richard Purdie <richard@openedhand.com> | 2007-08-15 08:39:19 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2007-08-15 08:39:19 +0000 |
commit | 75306742144eb1bd2d57c986d1f836a59a1f0e8b (patch) | |
tree | d1a15e84c1ae3c5c2dff906bbdba3d12bf5186e3 /bitbake/lib | |
parent | d7892c265b0e820a28e62a4aa0819d90ea354a5b (diff) | |
download | poky-75306742144eb1bd2d57c986d1f836a59a1f0e8b.tar.gz |
bitbake: Sync with upstream 1.8 branch
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2497 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/__init__.py | 14 | ||||
-rw-r--r-- | bitbake/lib/bb/msg.py | 44 | ||||
-rw-r--r-- | bitbake/lib/bb/providers.py | 63 | ||||
-rw-r--r-- | bitbake/lib/bb/taskdata.py | 46 |
4 files changed, 98 insertions, 69 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py index 1bfecc49ec..585eec8875 100644 --- a/bitbake/lib/bb/__init__.py +++ b/bitbake/lib/bb/__init__.py | |||
@@ -97,17 +97,23 @@ class MalformedUrl(Exception): | |||
97 | ####################################################################### | 97 | ####################################################################### |
98 | ####################################################################### | 98 | ####################################################################### |
99 | 99 | ||
100 | def plain(*args): | ||
101 | bb.msg.warn(''.join(args)) | ||
102 | |||
100 | def debug(lvl, *args): | 103 | def debug(lvl, *args): |
101 | bb.msg.std_debug(lvl, ''.join(args)) | 104 | bb.msg.debug(lvl, None, ''.join(args)) |
102 | 105 | ||
103 | def note(*args): | 106 | def note(*args): |
104 | bb.msg.std_note(''.join(args)) | 107 | bb.msg.note(1, None, ''.join(args)) |
108 | |||
109 | def warn(*args): | ||
110 | bb.msg.warn(1, None, ''.join(args)) | ||
105 | 111 | ||
106 | def error(*args): | 112 | def error(*args): |
107 | bb.msg.std_error(''.join(args)) | 113 | bb.msg.error(None, ''.join(args)) |
108 | 114 | ||
109 | def fatal(*args): | 115 | def fatal(*args): |
110 | bb.msg.std_fatal(''.join(args)) | 116 | bb.msg.fatal(None, ''.join(args)) |
111 | 117 | ||
112 | 118 | ||
113 | ####################################################################### | 119 | ####################################################################### |
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py index 98cb6e6bf3..a1b31e5d60 100644 --- a/bitbake/lib/bb/msg.py +++ b/bitbake/lib/bb/msg.py | |||
@@ -66,6 +66,9 @@ class MsgError(MsgBase): | |||
66 | class MsgFatal(MsgBase): | 66 | class MsgFatal(MsgBase): |
67 | """Fatal Message""" | 67 | """Fatal Message""" |
68 | 68 | ||
69 | class MsgPlain(MsgBase): | ||
70 | """General output""" | ||
71 | |||
69 | # | 72 | # |
70 | # Message control functions | 73 | # Message control functions |
71 | # | 74 | # |
@@ -87,51 +90,40 @@ def set_debug_domains(domains): | |||
87 | bb.msg.debug_level[ddomain] = bb.msg.debug_level[ddomain] + 1 | 90 | bb.msg.debug_level[ddomain] = bb.msg.debug_level[ddomain] + 1 |
88 | found = True | 91 | found = True |
89 | if not found: | 92 | if not found: |
90 | std_warn("Logging domain %s is not valid, ignoring" % domain) | 93 | bb.msg.warn(None, "Logging domain %s is not valid, ignoring" % domain) |
91 | 94 | ||
92 | # | 95 | # |
93 | # Message handling functions | 96 | # Message handling functions |
94 | # | 97 | # |
95 | 98 | ||
96 | def debug(level, domain, msg, fn = None): | 99 | def debug(level, domain, msg, fn = None): |
100 | bb.event.fire(MsgDebug(msg, None)) | ||
101 | if not domain: | ||
102 | domain = 'default' | ||
97 | if debug_level[domain] >= level: | 103 | if debug_level[domain] >= level: |
98 | bb.event.fire(MsgDebug(msg, None)) | ||
99 | print 'DEBUG: ' + msg | 104 | print 'DEBUG: ' + msg |
100 | 105 | ||
101 | def note(level, domain, msg, fn = None): | 106 | def note(level, domain, msg, fn = None): |
107 | bb.event.fire(MsgNote(msg, None)) | ||
108 | if not domain: | ||
109 | domain = 'default' | ||
102 | if level == 1 or verbose or debug_level[domain] >= 1: | 110 | if level == 1 or verbose or debug_level[domain] >= 1: |
103 | std_note(msg) | 111 | print 'NOTE: ' + msg |
104 | 112 | ||
105 | def warn(domain, msg, fn = None): | 113 | def warn(domain, msg, fn = None): |
106 | std_warn(msg) | ||
107 | |||
108 | def error(domain, msg, fn = None): | ||
109 | std_error(msg) | ||
110 | |||
111 | def fatal(domain, msg, fn = None): | ||
112 | std_fatal(msg) | ||
113 | |||
114 | # | ||
115 | # Compatibility functions for the original message interface | ||
116 | # | ||
117 | def std_debug(lvl, msg): | ||
118 | if debug_level['default'] >= lvl: | ||
119 | bb.event.fire(MsgDebug(msg, None)) | ||
120 | print 'DEBUG: ' + msg | ||
121 | |||
122 | def std_note(msg): | ||
123 | bb.event.fire(MsgNote(msg, None)) | ||
124 | print 'NOTE: ' + msg | ||
125 | |||
126 | def std_warn(msg): | ||
127 | bb.event.fire(MsgWarn(msg, None)) | 114 | bb.event.fire(MsgWarn(msg, None)) |
128 | print 'WARNING: ' + msg | 115 | print 'WARNING: ' + msg |
129 | 116 | ||
130 | def std_error(msg): | 117 | def error(domain, msg, fn = None): |
131 | bb.event.fire(MsgError(msg, None)) | 118 | bb.event.fire(MsgError(msg, None)) |
132 | print 'ERROR: ' + msg | 119 | print 'ERROR: ' + msg |
133 | 120 | ||
134 | def std_fatal(msg): | 121 | def fatal(domain, msg, fn = None): |
135 | bb.event.fire(MsgFatal(msg, None)) | 122 | bb.event.fire(MsgFatal(msg, None)) |
136 | print 'ERROR: ' + msg | 123 | print 'ERROR: ' + msg |
137 | sys.exit(1) | 124 | sys.exit(1) |
125 | |||
126 | def plain(msg, fn = None): | ||
127 | bb.event.fire(MsgPlain(msg, None)) | ||
128 | print msg | ||
129 | |||
diff --git a/bitbake/lib/bb/providers.py b/bitbake/lib/bb/providers.py index 81de85e760..e6f08fb4bd 100644 --- a/bitbake/lib/bb/providers.py +++ b/bitbake/lib/bb/providers.py | |||
@@ -120,7 +120,7 @@ def findBestProvider(pn, cfgData, dataCache, pkg_pn = None, item = None): | |||
120 | 120 | ||
121 | return (latest,latest_f,preferred_ver, preferred_file) | 121 | return (latest,latest_f,preferred_ver, preferred_file) |
122 | 122 | ||
123 | def filterProviders(providers, item, cfgData, dataCache): | 123 | def _filterProviders(providers, item, cfgData, dataCache): |
124 | """ | 124 | """ |
125 | Take a list of providers and filter/reorder according to the | 125 | Take a list of providers and filter/reorder according to the |
126 | environment variables and previous build results | 126 | environment variables and previous build results |
@@ -128,6 +128,11 @@ def filterProviders(providers, item, cfgData, dataCache): | |||
128 | eligible = [] | 128 | eligible = [] |
129 | preferred_versions = {} | 129 | preferred_versions = {} |
130 | 130 | ||
131 | # The order of providers depends on the order of the files on the disk | ||
132 | # up to here. Sort pkg_pn to make dependency issues reproducible rather | ||
133 | # than effectively random. | ||
134 | providers.sort() | ||
135 | |||
131 | # Collate providers by PN | 136 | # Collate providers by PN |
132 | pkg_pn = {} | 137 | pkg_pn = {} |
133 | for p in providers: | 138 | for p in providers: |
@@ -187,7 +192,61 @@ def filterProviders(providers, item, cfgData, dataCache): | |||
187 | eligible = [fn] + eligible | 192 | eligible = [fn] + eligible |
188 | break | 193 | break |
189 | 194 | ||
190 | return eligible | 195 | return eligible, preferred_versions |
196 | |||
197 | |||
198 | def filterProviders(providers, item, cfgData, dataCache): | ||
199 | """ | ||
200 | Take a list of providers and filter/reorder according to the | ||
201 | environment variables and previous build results | ||
202 | Takes a "normal" target item | ||
203 | """ | ||
204 | |||
205 | eligible, pref_vers = _filterProviders(providers, item, cfgData, dataCache) | ||
206 | |||
207 | prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % item, cfgData, 1) | ||
208 | if prefervar: | ||
209 | dataCache.preferred[item] = prefervar | ||
210 | |||
211 | foundUnique = False | ||
212 | if item in dataCache.preferred: | ||
213 | for p in eligible: | ||
214 | pn = dataCache.pkg_fn[p] | ||
215 | if dataCache.preferred[item] == pn: | ||
216 | bb.msg.note(2, bb.msg.domain.Provider, "selecting %s to satisfy %s due to PREFERRED_PROVIDERS" % (pn, item)) | ||
217 | eligible.remove(p) | ||
218 | eligible = [p] + eligible | ||
219 | foundUnique = True | ||
220 | break | ||
221 | |||
222 | return eligible, foundUnique | ||
223 | |||
224 | def filterProvidersRunTime(providers, item, cfgData, dataCache): | ||
225 | """ | ||
226 | Take a list of providers and filter/reorder according to the | ||
227 | environment variables and previous build results | ||
228 | Takes a "runtime" target item | ||
229 | """ | ||
230 | |||
231 | eligible, pref_vers = _filterProviders(providers, item, cfgData, dataCache) | ||
232 | |||
233 | # Should use dataCache.preferred here? | ||
234 | preferred = [] | ||
235 | for p in eligible: | ||
236 | pn = dataCache.pkg_fn[p] | ||
237 | provides = dataCache.pn_provides[pn] | ||
238 | for provide in provides: | ||
239 | prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % provide, cfgData, 1) | ||
240 | if prefervar == pn: | ||
241 | bb.msg.note(2, bb.msg.domain.Provider, "selecting %s to satisfy runtime %s due to PREFERRED_PROVIDERS" % (pn, item)) | ||
242 | eligible.remove(p) | ||
243 | eligible = [p] + eligible | ||
244 | preferred.append(p) | ||
245 | break | ||
246 | |||
247 | numberPreferred = len(preferred) | ||
248 | |||
249 | return eligible, numberPreferred | ||
191 | 250 | ||
192 | def getRuntimeProviders(dataCache, rdepend): | 251 | def getRuntimeProviders(dataCache, rdepend): |
193 | """ | 252 | """ |
diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py index 632a842763..f448b5b666 100644 --- a/bitbake/lib/bb/taskdata.py +++ b/bitbake/lib/bb/taskdata.py | |||
@@ -23,7 +23,7 @@ Task data collection and handling | |||
23 | # with this program; if not, write to the Free Software Foundation, Inc., | 23 | # with this program; if not, write to the Free Software Foundation, Inc., |
24 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 24 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
25 | 25 | ||
26 | from bb import data, fetch, event, mkdirhier, utils | 26 | from bb import data, event, mkdirhier, utils |
27 | import bb, os | 27 | import bb, os |
28 | 28 | ||
29 | class TaskData: | 29 | class TaskData: |
@@ -357,7 +357,7 @@ class TaskData: | |||
357 | 357 | ||
358 | all_p = dataCache.providers[item] | 358 | all_p = dataCache.providers[item] |
359 | 359 | ||
360 | eligible = bb.providers.filterProviders(all_p, item, cfgData, dataCache) | 360 | eligible, foundUnique = bb.providers.filterProviders(all_p, item, cfgData, dataCache) |
361 | 361 | ||
362 | for p in eligible: | 362 | for p in eligible: |
363 | fnid = self.getfn_id(p) | 363 | fnid = self.getfn_id(p) |
@@ -369,22 +369,7 @@ class TaskData: | |||
369 | bb.event.fire(bb.event.NoProvider(item, cfgData)) | 369 | bb.event.fire(bb.event.NoProvider(item, cfgData)) |
370 | raise bb.providers.NoProvider(item) | 370 | raise bb.providers.NoProvider(item) |
371 | 371 | ||
372 | prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % item, cfgData, 1) | 372 | if len(eligible) > 1 and foundUnique == False: |
373 | if prefervar: | ||
374 | dataCache.preferred[item] = prefervar | ||
375 | |||
376 | discriminated = False | ||
377 | if item in dataCache.preferred: | ||
378 | for p in eligible: | ||
379 | pn = dataCache.pkg_fn[p] | ||
380 | if dataCache.preferred[item] == pn: | ||
381 | bb.msg.note(2, bb.msg.domain.Provider, "selecting %s to satisfy %s due to PREFERRED_PROVIDERS" % (pn, item)) | ||
382 | eligible.remove(p) | ||
383 | eligible = [p] + eligible | ||
384 | discriminated = True | ||
385 | break | ||
386 | |||
387 | if len(eligible) > 1 and discriminated == False: | ||
388 | if item not in self.consider_msgs_cache: | 373 | if item not in self.consider_msgs_cache: |
389 | providers_list = [] | 374 | providers_list = [] |
390 | for fn in eligible: | 375 | for fn in eligible: |
@@ -424,7 +409,7 @@ class TaskData: | |||
424 | bb.event.fire(bb.event.NoProvider(item, cfgData, runtime=True)) | 409 | bb.event.fire(bb.event.NoProvider(item, cfgData, runtime=True)) |
425 | raise bb.providers.NoRProvider(item) | 410 | raise bb.providers.NoRProvider(item) |
426 | 411 | ||
427 | eligible = bb.providers.filterProviders(all_p, item, cfgData, dataCache) | 412 | eligible, numberPreferred = bb.providers.filterProvidersRunTime(all_p, item, cfgData, dataCache) |
428 | 413 | ||
429 | for p in eligible: | 414 | for p in eligible: |
430 | fnid = self.getfn_id(p) | 415 | fnid = self.getfn_id(p) |
@@ -436,21 +421,7 @@ class TaskData: | |||
436 | bb.event.fire(bb.event.NoProvider(item, cfgData, runtime=True)) | 421 | bb.event.fire(bb.event.NoProvider(item, cfgData, runtime=True)) |
437 | raise bb.providers.NoRProvider(item) | 422 | raise bb.providers.NoRProvider(item) |
438 | 423 | ||
439 | # Should use dataCache.preferred here? | 424 | if len(eligible) > 1 and numberPreferred == 0: |
440 | preferred = [] | ||
441 | for p in eligible: | ||
442 | pn = dataCache.pkg_fn[p] | ||
443 | provides = dataCache.pn_provides[pn] | ||
444 | for provide in provides: | ||
445 | prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % provide, cfgData, 1) | ||
446 | if prefervar == pn: | ||
447 | bb.msg.note(2, bb.msg.domain.Provider, "selecting %s to satisfy runtime %s due to PREFERRED_PROVIDERS" % (pn, item)) | ||
448 | eligible.remove(p) | ||
449 | eligible = [p] + eligible | ||
450 | preferred.append(p) | ||
451 | break | ||
452 | |||
453 | if len(eligible) > 1 and len(preferred) == 0: | ||
454 | if item not in self.consider_msgs_cache: | 425 | if item not in self.consider_msgs_cache: |
455 | providers_list = [] | 426 | providers_list = [] |
456 | for fn in eligible: | 427 | for fn in eligible: |
@@ -460,12 +431,12 @@ class TaskData: | |||
460 | bb.event.fire(bb.event.MultipleProviders(item,providers_list, cfgData, runtime=True)) | 431 | bb.event.fire(bb.event.MultipleProviders(item,providers_list, cfgData, runtime=True)) |
461 | self.consider_msgs_cache.append(item) | 432 | self.consider_msgs_cache.append(item) |
462 | 433 | ||
463 | if len(preferred) > 1: | 434 | if numberPreferred > 1: |
464 | if item not in self.consider_msgs_cache: | 435 | if item not in self.consider_msgs_cache: |
465 | providers_list = [] | 436 | providers_list = [] |
466 | for fn in preferred: | 437 | for fn in eligible: |
467 | providers_list.append(dataCache.pkg_fn[fn]) | 438 | providers_list.append(dataCache.pkg_fn[fn]) |
468 | bb.msg.note(2, bb.msg.domain.Provider, "multiple preferred providers are available for runtime %s (%s);" % (item, ", ".join(providers_list))) | 439 | bb.msg.note(2, bb.msg.domain.Provider, "multiple providers are available for runtime %s (top %s entries preferred) (%s);" % (item, numberPreferred, ", ".join(providers_list))) |
469 | bb.msg.note(2, bb.msg.domain.Provider, "consider defining only one PREFERRED_PROVIDER entry to match runtime %s" % item) | 440 | bb.msg.note(2, bb.msg.domain.Provider, "consider defining only one PREFERRED_PROVIDER entry to match runtime %s" % item) |
470 | bb.event.fire(bb.event.MultipleProviders(item,providers_list, cfgData, runtime=True)) | 441 | bb.event.fire(bb.event.MultipleProviders(item,providers_list, cfgData, runtime=True)) |
471 | self.consider_msgs_cache.append(item) | 442 | self.consider_msgs_cache.append(item) |
@@ -538,6 +509,7 @@ class TaskData: | |||
538 | except bb.providers.NoProvider: | 509 | except bb.providers.NoProvider: |
539 | targetid = self.getbuild_id(target) | 510 | targetid = self.getbuild_id(target) |
540 | if self.abort and targetid in self.external_targets: | 511 | if self.abort and targetid in self.external_targets: |
512 | bb.msg.error(bb.msg.domain.Provider, "No providers of build target %s (for %s)" % (target, self.get_dependees_str(target))) | ||
541 | raise | 513 | raise |
542 | self.remove_buildtarget(targetid) | 514 | self.remove_buildtarget(targetid) |
543 | for target in self.get_unresolved_run_targets(dataCache): | 515 | for target in self.get_unresolved_run_targets(dataCache): |