diff options
-rw-r--r-- | bitbake/ChangeLog | 17 | ||||
-rw-r--r-- | bitbake/MANIFEST | 8 | ||||
-rwxr-xr-x | bitbake/bin/bitbake | 244 | ||||
-rw-r--r-- | bitbake/bin/bitbakec | bin | 27715 -> 38998 bytes | |||
-rw-r--r-- | bitbake/doc/manual/usermanual.xml | 6 | ||||
-rw-r--r-- | bitbake/lib/bb/__init__.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/__init__.py | 9 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 19 | ||||
-rw-r--r-- | bitbake/lib/bb/shell.py | 33 | ||||
-rw-r--r-- | bitbake/lib/bb/utils.py | 24 | ||||
-rwxr-xr-x | bitbake/setup.py | 2 |
11 files changed, 325 insertions, 39 deletions
diff --git a/bitbake/ChangeLog b/bitbake/ChangeLog index db503ffb1a..e8a91c1701 100644 --- a/bitbake/ChangeLog +++ b/bitbake/ChangeLog | |||
@@ -1,3 +1,20 @@ | |||
1 | Changes in BitBake 1.3.?: | ||
2 | - Create a new Fetcher module to ease the | ||
3 | development of new Fetchers. | ||
4 | Issue #438 fixed by rpurdie@openedhand.com | ||
5 | - Make the Subversion fetcher honor the SRC Date | ||
6 | (CVSDATE). | ||
7 | Issue #555 fixed by chris@openedhand.com | ||
8 | - Expand PREFERRED_PROVIDER properly | ||
9 | Issue #436 fixed by rprudie@openedhand.com | ||
10 | - Typo fix for Issue #531 Philipp Zabel for the | ||
11 | BitBake Shell | ||
12 | - Introduce a new special variable SRCDATE as | ||
13 | a generic naming to take over CVSDATE. | ||
14 | - Introduce a new keyword 'required' In contrast | ||
15 | to include parsing will fail if a to be included | ||
16 | can not be found. | ||
17 | |||
1 | Changes in BitBake 1.3.2: | 18 | Changes in BitBake 1.3.2: |
2 | - reintegration of make.py into BitBake | 19 | - reintegration of make.py into BitBake |
3 | - bbread is gone, use bitbake -e | 20 | - bbread is gone, use bitbake -e |
diff --git a/bitbake/MANIFEST b/bitbake/MANIFEST index 71e3605a47..cf0aac99d9 100644 --- a/bitbake/MANIFEST +++ b/bitbake/MANIFEST | |||
@@ -9,7 +9,13 @@ lib/bb/build.py | |||
9 | lib/bb/data.py | 9 | lib/bb/data.py |
10 | lib/bb/data_smart.py | 10 | lib/bb/data_smart.py |
11 | lib/bb/event.py | 11 | lib/bb/event.py |
12 | lib/bb/fetch.py | 12 | lib/bb/fetch/bk.py |
13 | lib/bb/fetch/cvs.py | ||
14 | lib/bb/fetch/git.py | ||
15 | lib/bb/fetch/__init__.py | ||
16 | lib/bb/fetch/local.py | ||
17 | lib/bb/fetch/svn.py | ||
18 | lib/bb/fetch/wget.py | ||
13 | lib/bb/manifest.py | 19 | lib/bb/manifest.py |
14 | lib/bb/parse/__init__.py | 20 | lib/bb/parse/__init__.py |
15 | lib/bb/parse/parse_py/BBHandler.py | 21 | lib/bb/parse/parse_py/BBHandler.py |
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake index dac3c93749..09417f6eca 100755 --- a/bitbake/bin/bitbake +++ b/bitbake/bin/bitbake | |||
@@ -46,9 +46,12 @@ class BBParsingStatus: | |||
46 | def __init__(self): | 46 | def __init__(self): |
47 | self.cache_dirty = False | 47 | self.cache_dirty = False |
48 | self.providers = {} | 48 | self.providers = {} |
49 | self.rproviders = {} | ||
50 | self.packages = {} | ||
51 | self.packages_dynamic = {} | ||
49 | self.bbfile_priority = {} | 52 | self.bbfile_priority = {} |
50 | self.bbfile_config_priorities = [] | 53 | self.bbfile_config_priorities = [] |
51 | self.ignored_depedencies = None | 54 | self.ignored_dependencies = None |
52 | self.possible_world = [] | 55 | self.possible_world = [] |
53 | self.world_target = Set() | 56 | self.world_target = Set() |
54 | self.pkg_pn = {} | 57 | self.pkg_pn = {} |
@@ -74,7 +77,10 @@ class BBParsingStatus: | |||
74 | pr = bb.data.getVar('PR', bb_data, True) | 77 | pr = bb.data.getVar('PR', bb_data, True) |
75 | dp = int(bb.data.getVar('DEFAULT_PREFERENCE', bb_data, True) or "0") | 78 | dp = int(bb.data.getVar('DEFAULT_PREFERENCE', bb_data, True) or "0") |
76 | provides = Set([pn] + (bb.data.getVar("PROVIDES", bb_data, 1) or "").split()) | 79 | provides = Set([pn] + (bb.data.getVar("PROVIDES", bb_data, 1) or "").split()) |
80 | rprovides = (bb.data.getVar("RPROVIDES", bb_data, 1) or "").split() | ||
77 | depends = (bb.data.getVar("DEPENDS", bb_data, True) or "").split() | 81 | depends = (bb.data.getVar("DEPENDS", bb_data, True) or "").split() |
82 | packages = (bb.data.getVar('PACKAGES', bb_data, True) or "").split() | ||
83 | packages_dynamic = (bb.data.getVar('PACKAGES_DYNAMIC', bb_data, True) or "").split() | ||
78 | 84 | ||
79 | 85 | ||
80 | # build PackageName to FileName lookup table | 86 | # build PackageName to FileName lookup table |
@@ -102,6 +108,24 @@ class BBParsingStatus: | |||
102 | for dep in depends: | 108 | for dep in depends: |
103 | self.all_depends.add(dep) | 109 | self.all_depends.add(dep) |
104 | 110 | ||
111 | # Build reverse hash for PACKAGES, so runtime dependencies | ||
112 | # can be be resolved (RDEPENDS, RRECOMMENDS etc.) | ||
113 | |||
114 | for package in packages: | ||
115 | if not package in self.packages: | ||
116 | self.packages[package] = [] | ||
117 | self.packages[package].append(file_name) | ||
118 | |||
119 | for package in packages_dynamic: | ||
120 | if not package in self.packages_dynamic: | ||
121 | self.packages_dynamic[package] = [] | ||
122 | self.packages_dynamic[package].append(file_name) | ||
123 | |||
124 | for rprovide in rprovides: | ||
125 | if not rprovide in self.rproviders: | ||
126 | self.rproviders[rprovide] = [] | ||
127 | self.rproviders[rprovide].append(file_name) | ||
128 | |||
105 | # Collect files we may need for possible world-dep | 129 | # Collect files we may need for possible world-dep |
106 | # calculations | 130 | # calculations |
107 | if not bb.data.getVar('BROKEN', bb_data, True) and not bb.data.getVar('EXCLUDE_FROM_WORLD', bb_data, True): | 131 | if not bb.data.getVar('BROKEN', bb_data, True) and not bb.data.getVar('EXCLUDE_FROM_WORLD', bb_data, True): |
@@ -158,6 +182,7 @@ class BBCooker: | |||
158 | def __init__( self ): | 182 | def __init__( self ): |
159 | self.build_cache_fail = [] | 183 | self.build_cache_fail = [] |
160 | self.build_cache = [] | 184 | self.build_cache = [] |
185 | self.rbuild_cache = [] | ||
161 | self.building_list = [] | 186 | self.building_list = [] |
162 | self.build_path = [] | 187 | self.build_path = [] |
163 | self.consider_msgs_cache = [] | 188 | self.consider_msgs_cache = [] |
@@ -194,14 +219,29 @@ class BBCooker: | |||
194 | self.build_cache_fail.append(fn) | 219 | self.build_cache_fail.append(fn) |
195 | raise | 220 | raise |
196 | 221 | ||
197 | def tryBuild( self, fn, virtual ): | 222 | def tryBuild( self, fn, virtual , buildAllDeps , build_depends = []): |
198 | """Build a provider and its dependencies""" | 223 | """ |
199 | if fn in self.building_list: | 224 | Build a provider and its dependencies. |
225 | build_depends is a list of previous build dependencies (not runtime) | ||
226 | If build_depends is empty, we're dealing with a runtime depends | ||
227 | """ | ||
228 | |||
229 | the_data = self.pkgdata[fn] | ||
230 | |||
231 | if not buildAllDeps: | ||
232 | buildAllDeps = bb.data.getVar('BUILD_ALL_DEPS', the_data, True) or False | ||
233 | |||
234 | # Error on build time dependency loops | ||
235 | if build_depends and build_depends.count(fn) > 1: | ||
200 | bb.error("%s depends on itself (eventually)" % fn) | 236 | bb.error("%s depends on itself (eventually)" % fn) |
201 | bb.error("upwards chain is: %s" % (" -> ".join(self.build_path))) | 237 | bb.error("upwards chain is: %s" % (" -> ".join(self.build_path))) |
202 | return False | 238 | return False |
203 | 239 | ||
204 | the_data = self.pkgdata[fn] | 240 | # See if this is a runtime dependency we've already built |
241 | # Or a build dependency being handled in a different build chain | ||
242 | if fn in self.building_list: | ||
243 | return self.addRunDeps(fn, virtual , buildAllDeps) | ||
244 | |||
205 | item = self.status.pkg_fn[fn] | 245 | item = self.status.pkg_fn[fn] |
206 | 246 | ||
207 | self.building_list.append(fn) | 247 | self.building_list.append(fn) |
@@ -209,7 +249,8 @@ class BBCooker: | |||
209 | pathstr = "%s (%s)" % (item, virtual) | 249 | pathstr = "%s (%s)" % (item, virtual) |
210 | self.build_path.append(pathstr) | 250 | self.build_path.append(pathstr) |
211 | 251 | ||
212 | depends_list = (bb.data.getVar('DEPENDS', the_data, 1) or "").split() | 252 | depends_list = (bb.data.getVar('DEPENDS', the_data, True) or "").split() |
253 | |||
213 | if self.configuration.verbose: | 254 | if self.configuration.verbose: |
214 | bb.note("current path: %s" % (" -> ".join(self.build_path))) | 255 | bb.note("current path: %s" % (" -> ".join(self.build_path))) |
215 | bb.note("dependencies for %s are: %s" % (item, " ".join(depends_list))) | 256 | bb.note("dependencies for %s are: %s" % (item, " ".join(depends_list))) |
@@ -234,7 +275,7 @@ class BBCooker: | |||
234 | continue | 275 | continue |
235 | if not depcmd: | 276 | if not depcmd: |
236 | continue | 277 | continue |
237 | if self.buildProvider( dependency ) == 0: | 278 | if self.buildProvider( dependency , buildAllDeps , build_depends ) == 0: |
238 | bb.error("dependency %s (for %s) not satisfied" % (dependency,item)) | 279 | bb.error("dependency %s (for %s) not satisfied" % (dependency,item)) |
239 | failed = True | 280 | failed = True |
240 | if self.configuration.abort: | 281 | if self.configuration.abort: |
@@ -247,6 +288,9 @@ class BBCooker: | |||
247 | self.stats.deps += 1 | 288 | self.stats.deps += 1 |
248 | return False | 289 | return False |
249 | 290 | ||
291 | if not self.addRunDeps(fn, virtual , buildAllDeps): | ||
292 | return False | ||
293 | |||
250 | if bb.build.stamp_is_current('do_%s' % self.configuration.cmd, the_data): | 294 | if bb.build.stamp_is_current('do_%s' % self.configuration.cmd, the_data): |
251 | self.build_cache.append(fn) | 295 | self.build_cache.append(fn) |
252 | return True | 296 | return True |
@@ -285,7 +329,7 @@ class BBCooker: | |||
285 | bb.data.setVar('OVERRIDES', "%s:%s" % (pn, data.getVar('OVERRIDES', localdata)), localdata) | 329 | bb.data.setVar('OVERRIDES', "%s:%s" % (pn, data.getVar('OVERRIDES', localdata)), localdata) |
286 | bb.data.update_data(localdata) | 330 | bb.data.update_data(localdata) |
287 | 331 | ||
288 | preferred_v = bb.data.getVar('PREFERRED_VERSION_%s' % pn, localdata, 1) | 332 | preferred_v = bb.data.getVar('PREFERRED_VERSION_%s' % pn, localdata, True) |
289 | if preferred_v: | 333 | if preferred_v: |
290 | m = re.match('(.*)_(.*)', preferred_v) | 334 | m = re.match('(.*)_(.*)', preferred_v) |
291 | if m: | 335 | if m: |
@@ -379,28 +423,17 @@ class BBCooker: | |||
379 | if data.getVarFlag( e, 'python', self.configuration.data ): | 423 | if data.getVarFlag( e, 'python', self.configuration.data ): |
380 | sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, data.getVar(e, self.configuration.data, 1))) | 424 | sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, data.getVar(e, self.configuration.data, 1))) |
381 | 425 | ||
382 | def buildProvider( self, item ): | 426 | def filterProviders(self, providers, item): |
383 | fn = None | 427 | """ |
384 | 428 | Take a list of providers and filter/reorder according to the | |
385 | discriminated = False | 429 | environment variables and previous build results |
386 | 430 | """ | |
387 | if item not in self.status.providers: | ||
388 | bb.error("Nothing provides %s" % item) | ||
389 | return 0 | ||
390 | |||
391 | all_p = self.status.providers[item] | ||
392 | |||
393 | for p in all_p: | ||
394 | if p in self.build_cache: | ||
395 | bb.debug(1, "already built %s in this run\n" % p) | ||
396 | return 1 | ||
397 | |||
398 | eligible = [] | 431 | eligible = [] |
399 | preferred_versions = {} | 432 | preferred_versions = {} |
400 | 433 | ||
401 | # Collate providers by PN | 434 | # Collate providers by PN |
402 | pkg_pn = {} | 435 | pkg_pn = {} |
403 | for p in all_p: | 436 | for p in providers: |
404 | pn = self.status.pkg_fn[p] | 437 | pn = self.status.pkg_fn[p] |
405 | if pn not in pkg_pn: | 438 | if pn not in pkg_pn: |
406 | pkg_pn[pn] = [] | 439 | pkg_pn[pn] = [] |
@@ -423,7 +456,7 @@ class BBCooker: | |||
423 | 456 | ||
424 | # look to see if one of them is already staged, or marked as preferred. | 457 | # look to see if one of them is already staged, or marked as preferred. |
425 | # if so, bump it to the head of the queue | 458 | # if so, bump it to the head of the queue |
426 | for p in all_p: | 459 | for p in providers: |
427 | the_data = self.pkgdata[p] | 460 | the_data = self.pkgdata[p] |
428 | pn = bb.data.getVar('PN', the_data, 1) | 461 | pn = bb.data.getVar('PN', the_data, 1) |
429 | pv = bb.data.getVar('PV', the_data, 1) | 462 | pv = bb.data.getVar('PV', the_data, 1) |
@@ -448,6 +481,33 @@ class BBCooker: | |||
448 | discriminated = True | 481 | discriminated = True |
449 | break | 482 | break |
450 | 483 | ||
484 | return eligible | ||
485 | |||
486 | def buildProvider( self, item , buildAllDeps , build_depends = [] ): | ||
487 | """ | ||
488 | Build something to provide a named build requirement | ||
489 | (takes item names from DEPENDS namespace) | ||
490 | """ | ||
491 | |||
492 | fn = None | ||
493 | discriminated = False | ||
494 | |||
495 | if not item in self.status.providers: | ||
496 | bb.error("Nothing provides dependency %s" % item) | ||
497 | return 0 | ||
498 | |||
499 | all_p = self.status.providers[item] | ||
500 | |||
501 | for p in all_p: | ||
502 | if p in self.build_cache: | ||
503 | bb.debug(1, "already built %s in this run\n" % p) | ||
504 | return 1 | ||
505 | |||
506 | eligible = self.filterProviders(all_p, item) | ||
507 | |||
508 | if not eligible: | ||
509 | return 0 | ||
510 | |||
451 | prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % item, self.configuration.data, 1) | 511 | prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % item, self.configuration.data, 1) |
452 | if prefervar: | 512 | if prefervar: |
453 | self.preferred[item] = prefervar | 513 | self.preferred[item] = prefervar |
@@ -476,12 +536,140 @@ class BBCooker: | |||
476 | # run through the list until we find one that we can build | 536 | # run through the list until we find one that we can build |
477 | for fn in eligible: | 537 | for fn in eligible: |
478 | bb.debug(2, "selecting %s to satisfy %s" % (fn, item)) | 538 | bb.debug(2, "selecting %s to satisfy %s" % (fn, item)) |
479 | if self.tryBuild(fn, item): | 539 | if self.tryBuild(fn, item, buildAllDeps, build_depends + [fn]): |
480 | return 1 | 540 | return 1 |
481 | 541 | ||
482 | bb.note("no buildable providers for %s" % item) | 542 | bb.note("no buildable providers for %s" % item) |
483 | return 0 | 543 | return 0 |
484 | 544 | ||
545 | def buildRProvider( self, item , buildAllDeps ): | ||
546 | """ | ||
547 | Build something to provide a named runtime requirement | ||
548 | (takes item names from RDEPENDS/PACKAGES namespace) | ||
549 | """ | ||
550 | |||
551 | fn = None | ||
552 | all_p = [] | ||
553 | discriminated = False | ||
554 | |||
555 | if not buildAllDeps: | ||
556 | return True | ||
557 | |||
558 | all_p = self.getProvidersRun(item) | ||
559 | |||
560 | if not all_p: | ||
561 | bb.error("Nothing provides runtime dependency %s" % (item)) | ||
562 | return False | ||
563 | |||
564 | for p in all_p: | ||
565 | if p in self.rbuild_cache: | ||
566 | bb.debug(2, "Already built %s providing runtime %s\n" % (p,item)) | ||
567 | return True | ||
568 | if p in self.build_cache: | ||
569 | bb.debug(2, "Already built %s but adding any further RDEPENDS for %s\n" % (p, item)) | ||
570 | return self.addRunDeps(p, item , buildAllDeps) | ||
571 | |||
572 | eligible = self.filterProviders(all_p, item) | ||
573 | if not eligible: | ||
574 | return 0 | ||
575 | |||
576 | preferred = [] | ||
577 | for p in eligible: | ||
578 | pn = self.status.pkg_fn[p] | ||
579 | provides = self.status.pn_provides[pn] | ||
580 | for provide in provides: | ||
581 | prefervar = bb.data.getVar('PREFERRED_PROVIDER_%s' % provide, self.configuration.data, 1) | ||
582 | if prefervar == pn: | ||
583 | if self.configuration.verbose: | ||
584 | bb.note("selecting %s to satisfy runtime %s due to PREFERRED_PROVIDERS" % (pn, item)) | ||
585 | eligible.remove(p) | ||
586 | eligible = [p] + eligible | ||
587 | preferred.append(p) | ||
588 | |||
589 | if len(eligible) > 1 and len(preferred) == 0: | ||
590 | if item not in self.consider_msgs_cache: | ||
591 | providers_list = [] | ||
592 | for fn in eligible: | ||
593 | providers_list.append(self.status.pkg_fn[fn]) | ||
594 | bb.note("multiple providers are available (%s);" % ", ".join(providers_list)) | ||
595 | bb.note("consider defining a PREFERRED_PROVIDER to match runtime %s" % item) | ||
596 | self.consider_msgs_cache.append(item) | ||
597 | |||
598 | if len(preferred) > 1: | ||
599 | if item not in self.consider_msgs_cache: | ||
600 | providers_list = [] | ||
601 | for fn in preferred: | ||
602 | providers_list.append(self.status.pkg_fn[fn]) | ||
603 | bb.note("multiple preferred providers are available (%s);" % ", ".join(providers_list)) | ||
604 | bb.note("consider defining only one PREFERRED_PROVIDER to match runtime %s" % item) | ||
605 | self.consider_msgs_cache.append(item) | ||
606 | |||
607 | # run through the list until we find one that we can build | ||
608 | for fn in eligible: | ||
609 | bb.debug(2, "selecting %s to satisfy runtime %s" % (fn, item)) | ||
610 | if self.tryBuild(fn, item, buildAllDeps): | ||
611 | return True | ||
612 | |||
613 | bb.error("No buildable providers for runtime %s" % item) | ||
614 | return False | ||
615 | |||
616 | def getProvidersRun(self, rdepend): | ||
617 | """ | ||
618 | Return any potential providers of runtime rdepend | ||
619 | """ | ||
620 | rproviders = [] | ||
621 | |||
622 | if rdepend in self.status.rproviders: | ||
623 | rproviders += self.status.rproviders[rdepend] | ||
624 | |||
625 | if rdepend in self.status.packages: | ||
626 | rproviders += self.status.packages[rdepend] | ||
627 | |||
628 | if rproviders: | ||
629 | return rproviders | ||
630 | |||
631 | # Only search dynamic packages if we can't find anything in other variables | ||
632 | for pattern in self.status.packages_dynamic: | ||
633 | regexp = re.compile(pattern) | ||
634 | if regexp.match(rdepend): | ||
635 | rproviders += self.status.packages_dynamic[pattern] | ||
636 | |||
637 | return rproviders | ||
638 | |||
639 | def addRunDeps(self , fn, item , buildAllDeps): | ||
640 | """ | ||
641 | Add any runtime dependencies of runtime item provided by fn | ||
642 | as long as item has't previously been processed by this function. | ||
643 | """ | ||
644 | |||
645 | if item in self.rbuild_cache: | ||
646 | return True | ||
647 | |||
648 | if not buildAllDeps: | ||
649 | return True | ||
650 | |||
651 | rdepends = [] | ||
652 | self.rbuild_cache.append(item) | ||
653 | the_data = self.pkgdata[fn] | ||
654 | pn = self.status.pkg_fn[fn] | ||
655 | |||
656 | if (item == pn): | ||
657 | rdepends += bb.utils.explode_deps(bb.data.getVar('RDEPENDS', the_data, True) or "") | ||
658 | rdepends += bb.utils.explode_deps(bb.data.getVar('RRECOMMENDS', the_data, True) or "") | ||
659 | else: | ||
660 | packages = (bb.data.getVar('PACKAGES', the_data, 1).split() or "") | ||
661 | for package in packages: | ||
662 | if package == item: | ||
663 | rdepends += bb.utils.explode_deps(bb.data.getVar("RDEPENDS_%s" % package, the_data, True) or "") | ||
664 | rdepends += bb.utils.explode_deps(bb.data.getVar("RRECOMMENDS_%s" % package, the_data, True) or "") | ||
665 | |||
666 | bb.debug(2, "Additional runtime dependencies for %s are: %s" % (item, " ".join(rdepends))) | ||
667 | |||
668 | for rdepend in rdepends: | ||
669 | if not self.buildRProvider(rdepend, buildAllDeps): | ||
670 | return False | ||
671 | return True | ||
672 | |||
485 | def buildDepgraph( self ): | 673 | def buildDepgraph( self ): |
486 | all_depends = self.status.all_depends | 674 | all_depends = self.status.all_depends |
487 | pn_provides = self.status.pn_provides | 675 | pn_provides = self.status.pn_provides |
@@ -694,7 +882,7 @@ class BBCooker: | |||
694 | for k in pkgs_to_build: | 882 | for k in pkgs_to_build: |
695 | failed = False | 883 | failed = False |
696 | try: | 884 | try: |
697 | if self.buildProvider( k ) == 0: | 885 | if self.buildProvider( k , False ) == 0: |
698 | # already diagnosed | 886 | # already diagnosed |
699 | failed = True | 887 | failed = True |
700 | except bb.build.EventException: | 888 | except bb.build.EventException: |
diff --git a/bitbake/bin/bitbakec b/bitbake/bin/bitbakec index dc2e0a9fa9..db6a160303 100644 --- a/bitbake/bin/bitbakec +++ b/bitbake/bin/bitbakec | |||
Binary files differ | |||
diff --git a/bitbake/doc/manual/usermanual.xml b/bitbake/doc/manual/usermanual.xml index b96863c031..277e615100 100644 --- a/bitbake/doc/manual/usermanual.xml +++ b/bitbake/doc/manual/usermanual.xml | |||
@@ -139,6 +139,12 @@ will be introduced.</para> | |||
139 | <para>Next, there is the <literal>include</literal> directive, which causes BitBake to parse in whatever file you specify, and insert it at that location, which is not unlike <command>make</command>. However, if the path specified on the <literal>include</literal> line is a relative path, BitBake will locate the first one it can find within <envar>BBPATH</envar>.</para> | 139 | <para>Next, there is the <literal>include</literal> directive, which causes BitBake to parse in whatever file you specify, and insert it at that location, which is not unlike <command>make</command>. However, if the path specified on the <literal>include</literal> line is a relative path, BitBake will locate the first one it can find within <envar>BBPATH</envar>.</para> |
140 | </section> | 140 | </section> |
141 | <section> | 141 | <section> |
142 | <title>Requiring Inclusion</title> | ||
143 | <para>In contrast to the <literal>include</literal> directive, <literal>require</literal> will | ||
144 | raise an ParseError if the to be included file can not be found. Otherwise it will behave just like the <literal> | ||
145 | include</literal> directive.</para> | ||
146 | </section> | ||
147 | <section> | ||
142 | <title>Python variable expansion</title> | 148 | <title>Python variable expansion</title> |
143 | <para><screen><varname>DATE</varname> = "${@time.strftime('%Y%m%d',time.gmtime())}"</screen></para> | 149 | <para><screen><varname>DATE</varname> = "${@time.strftime('%Y%m%d',time.gmtime())}"</screen></para> |
144 | <para>This would result in the <varname>DATE</varname> variable containing today's date.</para> | 150 | <para>This would result in the <varname>DATE</varname> variable containing today's date.</para> |
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py index 00b0e8b57f..f27f53b39d 100644 --- a/bitbake/lib/bb/__init__.py +++ b/bitbake/lib/bb/__init__.py | |||
@@ -23,7 +23,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |||
23 | Place, Suite 330, Boston, MA 02111-1307 USA. | 23 | Place, Suite 330, Boston, MA 02111-1307 USA. |
24 | """ | 24 | """ |
25 | 25 | ||
26 | __version__ = "1.3.2" | 26 | __version__ = "1.3.2.1" |
27 | 27 | ||
28 | __all__ = [ | 28 | __all__ = [ |
29 | 29 | ||
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py index b8839c09fd..cb27416061 100644 --- a/bitbake/lib/bb/parse/__init__.py +++ b/bitbake/lib/bb/parse/__init__.py | |||
@@ -26,6 +26,8 @@ __all__ = [ 'ParseError', 'SkipPackage', 'cached_mtime', 'mark_dependency', | |||
26 | 'supports', 'handle', 'init' ] | 26 | 'supports', 'handle', 'init' ] |
27 | handlers = [] | 27 | handlers = [] |
28 | 28 | ||
29 | import bb, os | ||
30 | |||
29 | class ParseError(Exception): | 31 | class ParseError(Exception): |
30 | """Exception raised when parsing fails""" | 32 | """Exception raised when parsing fails""" |
31 | 33 | ||
@@ -34,13 +36,14 @@ class SkipPackage(Exception): | |||
34 | 36 | ||
35 | __mtime_cache = {} | 37 | __mtime_cache = {} |
36 | def cached_mtime(f): | 38 | def cached_mtime(f): |
37 | import os | ||
38 | if not __mtime_cache.has_key(f): | 39 | if not __mtime_cache.has_key(f): |
39 | __mtime_cache[f] = os.stat(f)[8] | 40 | update_mtime(f) |
40 | return __mtime_cache[f] | 41 | return __mtime_cache[f] |
41 | 42 | ||
43 | def update_mtime(f): | ||
44 | __mtime_cache[f] = os.stat(f)[8] | ||
45 | |||
42 | def mark_dependency(d, f): | 46 | def mark_dependency(d, f): |
43 | import bb, os | ||
44 | if f.startswith('./'): | 47 | if f.startswith('./'): |
45 | f = "%s/%s" % (os.getcwd(), f[2:]) | 48 | f = "%s/%s" % (os.getcwd(), f[2:]) |
46 | deps = (bb.data.getVar('__depends', d) or "").split() | 49 | deps = (bb.data.getVar('__depends', d) or "").split() |
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index 41ef96d557..90978300af 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py | |||
@@ -28,6 +28,7 @@ from bb.parse import ParseError | |||
28 | #__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}]+)\s*(?P<colon>:)?(?P<ques>\?)?=\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") | 28 | #__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}]+)\s*(?P<colon>:)?(?P<ques>\?)?=\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") |
29 | __config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}/]+)(\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])?\s*((?P<colon>:=)|(?P<ques>\?=)|(?P<append>\+=)|(?P<prepend>=\+)|(?P<predot>=\.)|(?P<postdot>\.=)|=)\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") | 29 | __config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}/]+)(\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])?\s*((?P<colon>:=)|(?P<ques>\?=)|(?P<append>\+=)|(?P<prepend>=\+)|(?P<predot>=\.)|(?P<postdot>\.=)|=)\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") |
30 | __include_regexp__ = re.compile( r"include\s+(.+)" ) | 30 | __include_regexp__ = re.compile( r"include\s+(.+)" ) |
31 | __require_regexp__ = re.compile( r"require\s+(.+)" ) | ||
31 | 32 | ||
32 | def init(data): | 33 | def init(data): |
33 | if not bb.data.getVar('TOPDIR', data): | 34 | if not bb.data.getVar('TOPDIR', data): |
@@ -83,7 +84,11 @@ def obtain(fn, data = bb.data.init()): | |||
83 | return localfn | 84 | return localfn |
84 | 85 | ||
85 | 86 | ||
86 | def include(oldfn, fn, data = bb.data.init()): | 87 | def include(oldfn, fn, data = bb.data.init(), error_out = False): |
88 | """ | ||
89 | |||
90 | error_out If True a ParseError will be reaised if the to be included | ||
91 | """ | ||
87 | if oldfn == fn: # prevent infinate recursion | 92 | if oldfn == fn: # prevent infinate recursion |
88 | return None | 93 | return None |
89 | 94 | ||
@@ -93,8 +98,10 @@ def include(oldfn, fn, data = bb.data.init()): | |||
93 | 98 | ||
94 | from bb.parse import handle | 99 | from bb.parse import handle |
95 | try: | 100 | try: |
96 | ret = handle(fn, data, 1) | 101 | ret = handle(fn, data, True) |
97 | except IOError: | 102 | except IOError: |
103 | if error_out: | ||
104 | raise ParseError("Could not include required file %(fn)s" % vars() ) | ||
98 | debug(2, "CONF file '%s' not found" % fn) | 105 | debug(2, "CONF file '%s' not found" % fn) |
99 | 106 | ||
100 | def handle(fn, data = bb.data.init(), include = 0): | 107 | def handle(fn, data = bb.data.init(), include = 0): |
@@ -125,7 +132,7 @@ def handle(fn, data = bb.data.init(), include = 0): | |||
125 | debug(1, "CONF %s %s" % (inc_string, currname)) | 132 | debug(1, "CONF %s %s" % (inc_string, currname)) |
126 | break | 133 | break |
127 | if f is None: | 134 | if f is None: |
128 | raise IOError("file not found") | 135 | raise IOError("file '%s' not found" % fn) |
129 | else: | 136 | else: |
130 | f = open(fn,'r') | 137 | f = open(fn,'r') |
131 | debug(1, "CONF %s %s" % (inc_string,fn)) | 138 | debug(1, "CONF %s %s" % (inc_string,fn)) |
@@ -191,6 +198,12 @@ def feeder(lineno, s, fn, data = bb.data.init()): | |||
191 | include(fn, s, data) | 198 | include(fn, s, data) |
192 | return | 199 | return |
193 | 200 | ||
201 | m = __require_regexp__.match(s) | ||
202 | if m: | ||
203 | s = bb.data.expand(m.group(1), data) | ||
204 | include(fn, s, data, True) | ||
205 | return | ||
206 | |||
194 | raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s)); | 207 | raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s)); |
195 | 208 | ||
196 | # Add us to the handlers list | 209 | # Add us to the handlers list |
diff --git a/bitbake/lib/bb/shell.py b/bitbake/lib/bb/shell.py index 97e61e1169..b86dc9753c 100644 --- a/bitbake/lib/bb/shell.py +++ b/bitbake/lib/bb/shell.py | |||
@@ -18,6 +18,12 @@ | |||
18 | # Place, Suite 330, Boston, MA 02111-1307 USA. | 18 | # Place, Suite 330, Boston, MA 02111-1307 USA. |
19 | # | 19 | # |
20 | ########################################################################## | 20 | ########################################################################## |
21 | # | ||
22 | # Thanks to: | ||
23 | # * Holger Freyther <zecke@handhelds.org> | ||
24 | # * Justin Patrin <papercrane@reversefold.com> | ||
25 | # | ||
26 | ########################################################################## | ||
21 | 27 | ||
22 | """ | 28 | """ |
23 | BitBake Shell | 29 | BitBake Shell |
@@ -53,7 +59,7 @@ import sys, os, imp, readline, socket, httplib, urllib, commands, popen2, copy, | |||
53 | imp.load_source( "bitbake", os.path.dirname( sys.argv[0] )+"/bitbake" ) | 59 | imp.load_source( "bitbake", os.path.dirname( sys.argv[0] )+"/bitbake" ) |
54 | from bb import data, parse, build, fatal | 60 | from bb import data, parse, build, fatal |
55 | 61 | ||
56 | __version__ = "0.5.2" | 62 | __version__ = "0.5.3" |
57 | __credits__ = """BitBake Shell Version %s (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 63 | __credits__ = """BitBake Shell Version %s (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
58 | Type 'help' for more information, press CTRL-D to exit.""" % __version__ | 64 | Type 'help' for more information, press CTRL-D to exit.""" % __version__ |
59 | 65 | ||
@@ -151,7 +157,7 @@ class BitBakeShellCommands: | |||
151 | 157 | ||
152 | for name in names: | 158 | for name in names: |
153 | try: | 159 | try: |
154 | cooker.buildProvider( name ) | 160 | cooker.buildProvider( name, data.getVar("BUILD_ALL_DEPS", cooker.configuration.data, True) ) |
155 | except build.EventException, e: | 161 | except build.EventException, e: |
156 | print "ERROR: Couldn't build '%s'" % name | 162 | print "ERROR: Couldn't build '%s'" % name |
157 | global last_exception | 163 | global last_exception |
@@ -252,6 +258,19 @@ class BitBakeShellCommands: | |||
252 | self.fileBuild( params ) | 258 | self.fileBuild( params ) |
253 | fileRebuild.usage = "<bbfile>" | 259 | fileRebuild.usage = "<bbfile>" |
254 | 260 | ||
261 | def fileReparse( self, params ): | ||
262 | """(re)Parse a bb file""" | ||
263 | bbfile = params[0] | ||
264 | print "SHELL: Parsing '%s'" % bbfile | ||
265 | parse.update_mtime( bbfile ) | ||
266 | bb_data, fromCache = cooker.load_bbfile( bbfile ) | ||
267 | cooker.pkgdata[bbfile] = bb_data | ||
268 | if fromCache: | ||
269 | print "SHELL: File has not been updated, not reparsing" | ||
270 | else: | ||
271 | print "SHELL: Parsed" | ||
272 | fileReparse.usage = "<bbfile>" | ||
273 | |||
255 | def force( self, params ): | 274 | def force( self, params ): |
256 | """Toggle force task execution flag (see bitbake -f)""" | 275 | """Toggle force task execution flag (see bitbake -f)""" |
257 | cooker.configuration.force = not cooker.configuration.force | 276 | cooker.configuration.force = not cooker.configuration.force |
@@ -391,6 +410,16 @@ SRC_URI = "" | |||
391 | parsed = True | 410 | parsed = True |
392 | 411 | ||
393 | 412 | ||
413 | def reparse( self, params ): | ||
414 | """(re)Parse a providee's bb file""" | ||
415 | bbfile = self._findProvider( params[0] ) | ||
416 | if bbfile is not None: | ||
417 | print "SHELL: Found bbfile '%s' for '%s'" % ( bbfile, params[0] ) | ||
418 | self.fileReparse( [ bbfile ] ) | ||
419 | else: | ||
420 | print "ERROR: Nothing provides '%s'" % params[0] | ||
421 | reparse.usage = "<providee>" | ||
422 | |||
394 | def getvar( self, params ): | 423 | def getvar( self, params ): |
395 | """Dump the contents of an outer BitBake environment variable""" | 424 | """Dump the contents of an outer BitBake environment variable""" |
396 | var = params[0] | 425 | var = params[0] |
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index ee8713a2d0..e2319aa123 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -69,3 +69,27 @@ def vercmp(ta, tb): | |||
69 | if (r == 0): | 69 | if (r == 0): |
70 | r = vercmp_part(ra, rb) | 70 | r = vercmp_part(ra, rb) |
71 | return r | 71 | return r |
72 | |||
73 | def explode_deps(s): | ||
74 | """ | ||
75 | Take an RDEPENDS style string of format: | ||
76 | "DEPEND1 (optional version) DEPEND2 (optional version) ..." | ||
77 | and return a list of dependencies. | ||
78 | Version information is ignored. | ||
79 | """ | ||
80 | r = [] | ||
81 | l = s.split() | ||
82 | flag = False | ||
83 | for i in l: | ||
84 | if i[0] == '(': | ||
85 | flag = True | ||
86 | j = [] | ||
87 | if flag: | ||
88 | j.append(i) | ||
89 | if i.endswith(')'): | ||
90 | flag = False | ||
91 | # Ignore version | ||
92 | #r[-1] += ' ' + ' '.join(j) | ||
93 | else: | ||
94 | r.append(i) | ||
95 | return r | ||
diff --git a/bitbake/setup.py b/bitbake/setup.py index a94c967d99..adb14a7553 100755 --- a/bitbake/setup.py +++ b/bitbake/setup.py | |||
@@ -55,7 +55,7 @@ setup(name='bitbake', | |||
55 | long_description='BitBake is a simple tool for the execution of tasks. It is derived from Portage, which is the package management system used by the Gentoo Linux distribution. It is most commonly used to build packages, as it can easily use its rudamentary inheritence to abstract common operations, such as fetching sources, unpacking them, patching them, compiling them, and so on. It is the basis of the OpenEmbedded project, which is being used for OpenZaurus, Familiar, and a number of other Linux distributions.', | 55 | long_description='BitBake is a simple tool for the execution of tasks. It is derived from Portage, which is the package management system used by the Gentoo Linux distribution. It is most commonly used to build packages, as it can easily use its rudamentary inheritence to abstract common operations, such as fetching sources, unpacking them, patching them, compiling them, and so on. It is the basis of the OpenEmbedded project, which is being used for OpenZaurus, Familiar, and a number of other Linux distributions.', |
56 | author='Chris Larson', | 56 | author='Chris Larson', |
57 | author_email='clarson@elinux.org', | 57 | author_email='clarson@elinux.org', |
58 | packages=['bb', 'bb.parse', 'bb.parse.parse_py'], | 58 | packages=['bb', 'bb.fetch', 'bb.parse', 'bb.parse.parse_py'], |
59 | package_dir={'bb': os.path.join('lib', 'bb')}, | 59 | package_dir={'bb': os.path.join('lib', 'bb')}, |
60 | scripts=[os.path.join('bin', 'bitbake'), | 60 | scripts=[os.path.join('bin', 'bitbake'), |
61 | os.path.join('bin', 'bbimage')], | 61 | os.path.join('bin', 'bbimage')], |