summaryrefslogtreecommitdiffstats
path: root/bitbake/bin/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-05-09 15:44:08 +0000
committerRichard Purdie <richard@openedhand.com>2006-05-09 15:44:08 +0000
commit27dba1e6247ae48349aee1bce141a9eefaafaad1 (patch)
tree822235005ccbd2707f7874ad680dedc4df36760c /bitbake/bin/bitbake
parented234aca98d0867c7b32801fc63820b19cf67df9 (diff)
downloadpoky-27dba1e6247ae48349aee1bce141a9eefaafaad1.tar.gz
Update to bitbake 1.4.2 (latest stable branch release). This includes the caching speedups
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@371 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/bin/bitbake')
-rwxr-xr-xbitbake/bin/bitbake272
1 files changed, 129 insertions, 143 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 457fbb7527..10cf4bd00a 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -24,14 +24,14 @@
24import sys, os, getopt, glob, copy, os.path, re, time 24import sys, os, getopt, glob, copy, os.path, re, time
25sys.path.insert(0,os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib')) 25sys.path.insert(0,os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
26import bb 26import bb
27from bb import utils, data, parse, debug, event, fatal 27from bb import utils, data, parse, debug, event, fatal, cache
28from sets import Set 28from sets import Set
29import itertools, optparse 29import itertools, optparse
30 30
31parsespin = itertools.cycle( r'|/-\\' ) 31parsespin = itertools.cycle( r'|/-\\' )
32bbdebug = 0 32bbdebug = 0
33 33
34__version__ = "1.3.3.2" 34__version__ = "1.4.3"
35 35
36#============================================================================# 36#============================================================================#
37# BBParsingStatus 37# BBParsingStatus
@@ -44,7 +44,6 @@ class BBParsingStatus:
44 """ 44 """
45 45
46 def __init__(self): 46 def __init__(self):
47 self.cache_dirty = False
48 self.providers = {} 47 self.providers = {}
49 self.rproviders = {} 48 self.rproviders = {}
50 self.packages = {} 49 self.packages = {}
@@ -60,34 +59,35 @@ class BBParsingStatus:
60 self.pkg_dp = {} 59 self.pkg_dp = {}
61 self.pn_provides = {} 60 self.pn_provides = {}
62 self.all_depends = Set() 61 self.all_depends = Set()
62 self.build_all = {}
63 self.rundeps = {}
64 self.runrecs = {}
65 self.stamp = {}
63 66
64 def handle_bb_data(self, file_name, bb_data, cached): 67 def handle_bb_data(self, file_name, bb_cache, cached):
65 """ 68 """
66 We will fill the dictionaries with the stuff we 69 We will fill the dictionaries with the stuff we
67 need for building the tree more fast 70 need for building the tree more fast
68 """ 71 """
69 if bb_data == None:
70 return
71
72 if not cached:
73 self.cache_dirty = True
74
75 pn = bb.data.getVar('PN', bb_data, True)
76 pv = bb.data.getVar('PV', bb_data, True)
77 pr = bb.data.getVar('PR', bb_data, True)
78 dp = int(bb.data.getVar('DEFAULT_PREFERENCE', bb_data, True) or "0")
79 provides = Set([pn] + (bb.data.getVar("PROVIDES", bb_data, 1) or "").split())
80 depends = (bb.data.getVar("DEPENDS", bb_data, True) or "").split()
81 packages = (bb.data.getVar('PACKAGES', bb_data, True) or "").split()
82 packages_dynamic = (bb.data.getVar('PACKAGES_DYNAMIC', bb_data, True) or "").split()
83 rprovides = (bb.data.getVar("RPROVIDES", bb_data, 1) or "").split()
84 72
73 pn = bb_cache.getVar('PN', file_name, True)
74 pv = bb_cache.getVar('PV', file_name, True)
75 pr = bb_cache.getVar('PR', file_name, True)
76 dp = int(bb_cache.getVar('DEFAULT_PREFERENCE', file_name, True) or "0")
77 provides = Set([pn] + (bb_cache.getVar("PROVIDES", file_name, True) or "").split())
78 depends = (bb_cache.getVar("DEPENDS", file_name, True) or "").split()
79 packages = (bb_cache.getVar('PACKAGES', file_name, True) or "").split()
80 packages_dynamic = (bb_cache.getVar('PACKAGES_DYNAMIC', file_name, True) or "").split()
81 rprovides = (bb_cache.getVar("RPROVIDES", file_name, True) or "").split()
85 82
86 # build PackageName to FileName lookup table 83 # build PackageName to FileName lookup table
87 if pn not in self.pkg_pn: 84 if pn not in self.pkg_pn:
88 self.pkg_pn[pn] = [] 85 self.pkg_pn[pn] = []
89 self.pkg_pn[pn].append(file_name) 86 self.pkg_pn[pn].append(file_name)
90 87
88 self.build_all[file_name] = int(bb_cache.getVar('BUILD_ALL_DEPS', file_name, True) or "0")
89 self.stamp[file_name] = bb_cache.getVar('STAMP', file_name, True)
90
91 # build FileName to PackageName lookup table 91 # build FileName to PackageName lookup table
92 self.pkg_fn[file_name] = pn 92 self.pkg_fn[file_name] = pn
93 self.pkg_pvpr[file_name] = (pv,pr) 93 self.pkg_pvpr[file_name] = (pv,pr)
@@ -114,7 +114,7 @@ class BBParsingStatus:
114 if not package in self.packages: 114 if not package in self.packages:
115 self.packages[package] = [] 115 self.packages[package] = []
116 self.packages[package].append(file_name) 116 self.packages[package].append(file_name)
117 rprovides += (bb.data.getVar("RPROVIDES_%s" % package, bb_data, 1) or "").split() 117 rprovides += (bb_cache.getVar("RPROVIDES_%s" % package, file_name, 1) or "").split()
118 118
119 for package in packages_dynamic: 119 for package in packages_dynamic:
120 if not package in self.packages_dynamic: 120 if not package in self.packages_dynamic:
@@ -126,9 +126,32 @@ class BBParsingStatus:
126 self.rproviders[rprovide] = [] 126 self.rproviders[rprovide] = []
127 self.rproviders[rprovide].append(file_name) 127 self.rproviders[rprovide].append(file_name)
128 128
129 # Build hash of runtime depeneds and rececommends
130
131 def add_dep(deplist, deps):
132 for dep in deps:
133 if not dep in deplist:
134 deplist[dep] = ""
135
136 if not file_name in self.rundeps:
137 self.rundeps[file_name] = {}
138 if not file_name in self.runrecs:
139 self.runrecs[file_name] = {}
140
141 for package in packages + [pn]:
142 if not package in self.rundeps[file_name]:
143 self.rundeps[file_name][package] = {}
144 if not package in self.runrecs[file_name]:
145 self.runrecs[file_name][package] = {}
146
147 add_dep(self.rundeps[file_name][package], bb.utils.explode_deps(bb_cache.getVar('RDEPENDS', file_name, True) or ""))
148 add_dep(self.runrecs[file_name][package], bb.utils.explode_deps(bb_cache.getVar('RRECOMMENDS', file_name, True) or ""))
149 add_dep(self.rundeps[file_name][package], bb.utils.explode_deps(bb_cache.getVar("RDEPENDS_%s" % package, file_name, True) or ""))
150 add_dep(self.runrecs[file_name][package], bb.utils.explode_deps(bb_cache.getVar("RRECOMMENDS_%s" % package, file_name, True) or ""))
151
129 # Collect files we may need for possible world-dep 152 # Collect files we may need for possible world-dep
130 # calculations 153 # calculations
131 if not bb.data.getVar('BROKEN', bb_data, True) and not bb.data.getVar('EXCLUDE_FROM_WORLD', bb_data, True): 154 if not bb_cache.getVar('BROKEN', file_name, True) and not bb_cache.getVar('EXCLUDE_FROM_WORLD', file_name, True):
132 self.possible_world.append(file_name) 155 self.possible_world.append(file_name)
133 156
134 157
@@ -166,7 +189,6 @@ class BBConfiguration( object ):
166 def __init__( self, options ): 189 def __init__( self, options ):
167 for key, val in options.__dict__.items(): 190 for key, val in options.__dict__.items():
168 setattr( self, key, val ) 191 setattr( self, key, val )
169 self.data = data.init()
170 192
171#============================================================================# 193#============================================================================#
172# BBCooker 194# BBCooker
@@ -190,8 +212,8 @@ class BBCooker:
190 self.stats = BBStatistics() 212 self.stats = BBStatistics()
191 self.status = None 213 self.status = None
192 214
193 self.pkgdata = None
194 self.cache = None 215 self.cache = None
216 self.bb_cache = None
195 217
196 def tryBuildPackage( self, fn, item, the_data ): 218 def tryBuildPackage( self, fn, item, the_data ):
197 """Build one package""" 219 """Build one package"""
@@ -226,10 +248,11 @@ class BBCooker:
226 If build_depends is empty, we're dealing with a runtime depends 248 If build_depends is empty, we're dealing with a runtime depends
227 """ 249 """
228 250
229 the_data = self.pkgdata[fn] 251 the_data = self.bb_cache.loadDataFull(fn, self)
230 252
231 if not buildAllDeps: 253 # Only follow all (runtime) dependencies if doing a build
232 buildAllDeps = bb.data.getVar('BUILD_ALL_DEPS', the_data, True) or False 254 if not buildAllDeps and self.configuration.cmd is "build":
255 buildAllDeps = self.status.build_all[fn]
233 256
234 # Error on build time dependency loops 257 # Error on build time dependency loops
235 if build_depends and build_depends.count(fn) > 1: 258 if build_depends and build_depends.count(fn) > 1:
@@ -402,12 +425,15 @@ class BBCooker:
402 425
403 print "%-30s %20s %20s" % (p, latest[0][0] + "-" + latest[0][1], 426 print "%-30s %20s %20s" % (p, latest[0][0] + "-" + latest[0][1],
404 prefstr) 427 prefstr)
428
405 429
406 def showEnvironment( self ): 430 def showEnvironment( self ):
407 """Show the outer or per-package environment""" 431 """Show the outer or per-package environment"""
408 if self.configuration.buildfile: 432 if self.configuration.buildfile:
433 self.cb = None
434 self.bb_cache = bb.cache.init(self)
409 try: 435 try:
410 self.configuration.data, fromCache = self.load_bbfile( self.configuration.buildfile ) 436 self.configuration.data = self.bb_cache.loadDataFull(self.configuration.buildfile, self)
411 except IOError, e: 437 except IOError, e:
412 fatal("Unable to read %s: %s" % ( self.configuration.buildfile, e )) 438 fatal("Unable to read %s: %s" % ( self.configuration.buildfile, e ))
413 except Exception, e: 439 except Exception, e:
@@ -457,11 +483,10 @@ class BBCooker:
457 # look to see if one of them is already staged, or marked as preferred. 483 # look to see if one of them is already staged, or marked as preferred.
458 # if so, bump it to the head of the queue 484 # if so, bump it to the head of the queue
459 for p in providers: 485 for p in providers:
460 the_data = self.pkgdata[p] 486 pn = self.status.pkg_fn[p]
461 pn = bb.data.getVar('PN', the_data, 1) 487 pv, pr = self.status.pkg_pvpr[p]
462 pv = bb.data.getVar('PV', the_data, 1) 488
463 pr = bb.data.getVar('PR', the_data, 1) 489 stamp = '%s.do_populate_staging' % self.status.stamp[p]
464 stamp = '%s.do_populate_staging' % bb.data.getVar('STAMP', the_data, 1)
465 if os.path.exists(stamp): 490 if os.path.exists(stamp):
466 (newvers, fn) = preferred_versions[pn] 491 (newvers, fn) = preferred_versions[pn]
467 if not fn in eligible: 492 if not fn in eligible:
@@ -470,11 +495,11 @@ class BBCooker:
470 oldver = "%s-%s" % (pv, pr) 495 oldver = "%s-%s" % (pv, pr)
471 newver = '-'.join(newvers) 496 newver = '-'.join(newvers)
472 if (newver != oldver): 497 if (newver != oldver):
473 extra_chat = "; upgrading from %s to %s" % (oldver, newver) 498 extra_chat = "%s (%s) already staged but upgrading to %s to satisfy %s" % (pn, oldver, newver, item)
474 else: 499 else:
475 extra_chat = "" 500 extra_chat = "Selecting already-staged %s (%s) to satisfy %s" % (pn, oldver, item)
476 if self.configuration.verbose: 501 if self.configuration.verbose:
477 bb.note("selecting already-staged %s to satisfy %s%s" % (pn, item, extra_chat)) 502 bb.note("%s" % extra_chat)
478 eligible.remove(fn) 503 eligible.remove(fn)
479 eligible = [fn] + eligible 504 eligible = [fn] + eligible
480 discriminated = True 505 discriminated = True
@@ -656,20 +681,11 @@ class BBCooker:
656 681
657 rdepends = [] 682 rdepends = []
658 self.rbuild_cache.append(item) 683 self.rbuild_cache.append(item)
659 the_data = self.pkgdata[fn] 684
660 pn = self.status.pkg_fn[fn] 685 if fn in self.status.rundeps and item in self.status.rundeps[fn]:
661 686 rdepends += self.status.rundeps[fn][item].keys()
662 if (item == pn): 687 if fn in self.status.runrecs and item in self.status.runrecs[fn]:
663 rdepends += bb.utils.explode_deps(bb.data.getVar('RDEPENDS', the_data, True) or "") 688 rdepends += self.status.runrecs[fn][item].keys()
664 rdepends += bb.utils.explode_deps(bb.data.getVar('RRECOMMENDS', the_data, True) or "")
665 rdepends += bb.utils.explode_deps(bb.data.getVar("RDEPENDS_%s" % pn, the_data, True) or "")
666 rdepends += bb.utils.explode_deps(bb.data.getVar('RRECOMMENDS_%s' % pn, the_data, True) or "")
667 else:
668 packages = (bb.data.getVar('PACKAGES', the_data, 1).split() or "")
669 for package in packages:
670 if package == item:
671 rdepends += bb.utils.explode_deps(bb.data.getVar("RDEPENDS_%s" % package, the_data, True) or "")
672 rdepends += bb.utils.explode_deps(bb.data.getVar("RRECOMMENDS_%s" % package, the_data, True) or "")
673 689
674 bb.debug(2, "Additional runtime dependencies for %s are: %s" % (item, " ".join(rdepends))) 690 bb.debug(2, "Additional runtime dependencies for %s are: %s" % (item, " ".join(rdepends)))
675 691
@@ -684,6 +700,9 @@ class BBCooker:
684 all_depends = self.status.all_depends 700 all_depends = self.status.all_depends
685 pn_provides = self.status.pn_provides 701 pn_provides = self.status.pn_provides
686 702
703 localdata = data.createCopy(self.configuration.data)
704 bb.data.update_data(localdata)
705
687 def calc_bbfile_priority(filename): 706 def calc_bbfile_priority(filename):
688 for (regex, pri) in self.status.bbfile_config_priorities: 707 for (regex, pri) in self.status.bbfile_config_priorities:
689 if regex.match(filename): 708 if regex.match(filename):
@@ -691,17 +710,22 @@ class BBCooker:
691 return 0 710 return 0
692 711
693 # Handle PREFERRED_PROVIDERS 712 # Handle PREFERRED_PROVIDERS
694 for p in (bb.data.getVar('PREFERRED_PROVIDERS', self.configuration.data, 1) or "").split(): 713 for p in (bb.data.getVar('PREFERRED_PROVIDERS', localdata, 1) or "").split():
695 (providee, provider) = p.split(':') 714 (providee, provider) = p.split(':')
696 if providee in self.preferred and self.preferred[providee] != provider: 715 if providee in self.preferred and self.preferred[providee] != provider:
697 bb.error("conflicting preferences for %s: both %s and %s specified" % (providee, provider, self.preferred[providee])) 716 bb.error("conflicting preferences for %s: both %s and %s specified" % (providee, provider, self.preferred[providee]))
698 self.preferred[providee] = provider 717 self.preferred[providee] = provider
699 718
700 # Calculate priorities for each file 719 # Calculate priorities for each file
701 for p in self.pkgdata.keys(): 720 for p in self.status.pkg_fn.keys():
702 self.status.bbfile_priority[p] = calc_bbfile_priority(p) 721 self.status.bbfile_priority[p] = calc_bbfile_priority(p)
703 722
704 # Build package list for "bitbake world" 723 def buildWorldTargetList(self):
724 """
725 Build package list for "bitbake world"
726 """
727 all_depends = self.status.all_depends
728 pn_provides = self.status.pn_provides
705 bb.debug(1, "collating packages for \"world\"") 729 bb.debug(1, "collating packages for \"world\"")
706 for f in self.status.possible_world: 730 for f in self.status.possible_world:
707 terminal = True 731 terminal = True
@@ -724,9 +748,10 @@ class BBCooker:
724 self.status.possible_world = None 748 self.status.possible_world = None
725 self.status.all_depends = None 749 self.status.all_depends = None
726 750
727 def myProgressCallback( self, x, y, f, file_data, from_cache ): 751 def myProgressCallback( self, x, y, f, bb_cache, from_cache ):
728 # feed the status with new input 752 # feed the status with new input
729 self.status.handle_bb_data(f, file_data, from_cache) 753
754 self.status.handle_bb_data(f, bb_cache, from_cache)
730 755
731 if bbdebug > 0: 756 if bbdebug > 0:
732 return 757 return
@@ -755,6 +780,13 @@ class BBCooker:
755 def parseConfigurationFile( self, afile ): 780 def parseConfigurationFile( self, afile ):
756 try: 781 try:
757 self.configuration.data = bb.parse.handle( afile, self.configuration.data ) 782 self.configuration.data = bb.parse.handle( afile, self.configuration.data )
783
784 # Add the handlers we inherited by INHERITS
785 # FIXME: This assumes that we included at least one .inc file
786 for var in bb.data.keys(self.configuration.data):
787 if bb.data.getVarFlag(var, 'handler', self.configuration.data):
788 bb.event.register(var,bb.data.getVar(var,self.configuration.data))
789
758 except IOError: 790 except IOError:
759 bb.fatal( "Unable to open %s" % afile ) 791 bb.fatal( "Unable to open %s" % afile )
760 except bb.parse.ParseError, details: 792 except bb.parse.ParseError, details:
@@ -786,6 +818,12 @@ class BBCooker:
786 818
787 819
788 def cook( self, configuration, args ): 820 def cook( self, configuration, args ):
821 """
822 We are building stuff here. We do the building
823 from here. By default we try to execute task
824 build.
825 """
826
789 self.configuration = configuration 827 self.configuration = configuration
790 828
791 if not self.configuration.cmd: 829 if not self.configuration.cmd:
@@ -801,6 +839,13 @@ class BBCooker:
801 839
802 self.parseConfigurationFile( os.path.join( "conf", "bitbake.conf" ) ) 840 self.parseConfigurationFile( os.path.join( "conf", "bitbake.conf" ) )
803 841
842
843 #
844 # Special updated configuration we use for firing events
845 #
846 self.configuration.event_data = bb.data.createCopy(self.configuration.data)
847 bb.data.update_data(self.configuration.event_data)
848
804 if self.configuration.show_environment: 849 if self.configuration.show_environment:
805 self.showEnvironment() 850 self.showEnvironment()
806 sys.exit( 0 ) 851 sys.exit( 0 )
@@ -876,18 +921,18 @@ class BBCooker:
876 print "Requested parsing .bb files only. Exiting." 921 print "Requested parsing .bb files only. Exiting."
877 return 922 return
878 923
879 bb.data.update_data( self.configuration.data )
880 self.buildDepgraph() 924 self.buildDepgraph()
881 925
882 if self.configuration.show_versions: 926 if self.configuration.show_versions:
883 self.showVersions() 927 self.showVersions()
884 sys.exit( 0 ) 928 sys.exit( 0 )
885 if 'world' in pkgs_to_build: 929 if 'world' in pkgs_to_build:
930 self.buildWorldTargetList()
886 pkgs_to_build.remove('world') 931 pkgs_to_build.remove('world')
887 for t in self.status.world_target: 932 for t in self.status.world_target:
888 pkgs_to_build.append(t) 933 pkgs_to_build.append(t)
889 934
890 bb.event.fire(bb.event.BuildStarted(buildname, pkgs_to_build, self.configuration.data)) 935 bb.event.fire(bb.event.BuildStarted(buildname, pkgs_to_build, self.configuration.event_data))
891 936
892 failures = 0 937 failures = 0
893 for k in pkgs_to_build: 938 for k in pkgs_to_build:
@@ -905,7 +950,7 @@ class BBCooker:
905 if self.configuration.abort: 950 if self.configuration.abort:
906 sys.exit(1) 951 sys.exit(1)
907 952
908 bb.event.fire(bb.event.BuildCompleted(buildname, pkgs_to_build, self.configuration.data, failures)) 953 bb.event.fire(bb.event.BuildCompleted(buildname, pkgs_to_build, self.configuration.event_data, failures))
909 954
910 sys.exit( self.stats.show() ) 955 sys.exit( self.stats.show() )
911 956
@@ -932,77 +977,12 @@ class BBCooker:
932 return [] 977 return []
933 return finddata.readlines() 978 return finddata.readlines()
934 979
935 def deps_clean(self, d):
936 depstr = data.getVar('__depends', d)
937 if depstr:
938 deps = depstr.split(" ")
939 for dep in deps:
940 (f,old_mtime_s) = dep.split("@")
941 old_mtime = int(old_mtime_s)
942 new_mtime = parse.cached_mtime(f)
943 if (new_mtime > old_mtime):
944 return False
945 return True
946
947 def load_bbfile( self, bbfile ):
948 """Load and parse one .bb build file"""
949
950 if not self.cache in [None, '']:
951 # get the times
952 cache_mtime = data.init_db_mtime(self.cache, bbfile)
953 file_mtime = parse.cached_mtime(bbfile)
954
955 if file_mtime > cache_mtime:
956 #print " : '%s' dirty. reparsing..." % bbfile
957 pass
958 else:
959 #print " : '%s' clean. loading from cache..." % bbfile
960 cache_data = data.init_db( self.cache, bbfile, False )
961 if self.deps_clean(cache_data):
962 return cache_data, True
963
964 topdir = data.getVar('TOPDIR', self.configuration.data)
965 if not topdir:
966 topdir = os.path.abspath(os.getcwd())
967 # set topdir to here
968 data.setVar('TOPDIR', topdir, self.configuration)
969 bbfile = os.path.abspath(bbfile)
970 bbfile_loc = os.path.abspath(os.path.dirname(bbfile))
971 # expand tmpdir to include this topdir
972 data.setVar('TMPDIR', data.getVar('TMPDIR', self.configuration.data, 1) or "", self.configuration.data)
973 # set topdir to location of .bb file
974 topdir = bbfile_loc
975 #data.setVar('TOPDIR', topdir, cfg)
976 # go there
977 oldpath = os.path.abspath(os.getcwd())
978 os.chdir(topdir)
979 bb = data.init_db(self.cache,bbfile, True, self.configuration.data)
980 try:
981 parse.handle(bbfile, bb) # read .bb data
982 if not self.cache in [None, '']:
983 bb.commit(parse.cached_mtime(bbfile)) # write cache
984 os.chdir(oldpath)
985 return bb, False
986 finally:
987 os.chdir(oldpath)
988
989 def collect_bbfiles( self, progressCallback ): 980 def collect_bbfiles( self, progressCallback ):
990 """Collect all available .bb build files""" 981 """Collect all available .bb build files"""
991 self.cb = progressCallback 982 self.cb = progressCallback
992 parsed, cached, skipped, masked = 0, 0, 0, 0 983 parsed, cached, skipped, masked = 0, 0, 0, 0
993 self.cache = bb.data.getVar( "CACHE", self.configuration.data, 1 ) 984 self.bb_cache = bb.cache.init(self)
994 self.pkgdata = data.pkgdata( not self.cache in [None, ''], self.cache, self.configuration.data )
995 985
996 if not self.cache in [None, '']:
997 if self.cb is not None:
998 print "NOTE: Using cache in '%s'" % self.cache
999 try:
1000 os.stat( self.cache )
1001 except OSError:
1002 bb.mkdirhier( self.cache )
1003 else:
1004 if self.cb is not None:
1005 print "NOTE: Not using a cache. Set CACHE = <directory> to enable."
1006 files = (data.getVar( "BBFILES", self.configuration.data, 1 ) or "").split() 986 files = (data.getVar( "BBFILES", self.configuration.data, 1 ) or "").split()
1007 data.setVar("BBFILES", " ".join(files), self.configuration.data) 987 data.setVar("BBFILES", " ".join(files), self.configuration.data)
1008 988
@@ -1037,43 +1017,49 @@ class BBCooker:
1037 1017
1038 # read a file's metadata 1018 # read a file's metadata
1039 try: 1019 try:
1040 bb_data, fromCache = self.load_bbfile(f) 1020 fromCache, skip = self.bb_cache.loadData(f, self)
1041 if fromCache: cached += 1 1021 if skip:
1022 skipped += 1
1023 #bb.note("Skipping %s" % f)
1024 self.bb_cache.skip(f)
1025 continue
1026 elif fromCache: cached += 1
1042 else: parsed += 1 1027 else: parsed += 1
1043 deps = None 1028 deps = None
1044 if bb_data is not None: 1029
1045 # allow metadata files to add items to BBFILES 1030 # allow metadata files to add items to BBFILES
1046 #data.update_data(self.pkgdata[f]) 1031 #data.update_data(self.pkgdata[f])
1047 addbbfiles = data.getVar('BBFILES', bb_data) or None 1032 addbbfiles = self.bb_cache.getVar('BBFILES', f, False) or None
1048 if addbbfiles: 1033 if addbbfiles:
1049 for aof in addbbfiles.split(): 1034 for aof in addbbfiles.split():
1050 if not files.count(aof): 1035 if not files.count(aof):
1051 if not os.path.isabs(aof): 1036 if not os.path.isabs(aof):
1052 aof = os.path.join(os.path.dirname(f),aof) 1037 aof = os.path.join(os.path.dirname(f),aof)
1053 files.append(aof) 1038 files.append(aof)
1054 for var in bb_data.keys():
1055 if data.getVarFlag(var, "handler", bb_data) and data.getVar(var, bb_data):
1056 event.register(data.getVar(var, bb_data))
1057 self.pkgdata[f] = bb_data
1058 1039
1059 # now inform the caller 1040 # now inform the caller
1060 if self.cb is not None: 1041 if self.cb is not None:
1061 self.cb( i + 1, len( newfiles ), f, bb_data, fromCache ) 1042 self.cb( i + 1, len( newfiles ), f, self.bb_cache, fromCache )
1062 1043
1063 except IOError, e: 1044 except IOError, e:
1045 self.bb_cache.remove(f)
1064 bb.error("opening %s: %s" % (f, e)) 1046 bb.error("opening %s: %s" % (f, e))
1065 pass 1047 pass
1066 except bb.parse.SkipPackage:
1067 skipped += 1
1068 pass
1069 except KeyboardInterrupt: 1048 except KeyboardInterrupt:
1049 self.bb_cache.sync()
1070 raise 1050 raise
1071 except Exception, e: 1051 except Exception, e:
1052 self.bb_cache.remove(f)
1072 bb.error("%s while parsing %s" % (e, f)) 1053 bb.error("%s while parsing %s" % (e, f))
1054 except:
1055 self.bb_cache.remove(f)
1056 raise
1073 1057
1074 if self.cb is not None: 1058 if self.cb is not None:
1075 print "\rNOTE: Parsing finished. %d cached, %d parsed, %d skipped, %d masked." % ( cached, parsed, skipped, masked ), 1059 print "\rNOTE: Parsing finished. %d cached, %d parsed, %d skipped, %d masked." % ( cached, parsed, skipped, masked ),
1076 1060
1061 self.bb_cache.sync()
1062
1077#============================================================================# 1063#============================================================================#
1078# main 1064# main
1079#============================================================================# 1065#============================================================================#