summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cooker.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r--bitbake/lib/bb/cooker.py63
1 files changed, 42 insertions, 21 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 52a402cd91..0992ec4c2e 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -226,7 +226,7 @@ class BBCooker:
226 226
227 if fn: 227 if fn:
228 try: 228 try:
229 envdata = self.bb_cache.loadDataFull(fn, self.configuration.data) 229 envdata = self.bb_cache.loadDataFull(fn, self.get_file_appends(fn), self.configuration.data)
230 except IOError as e: 230 except IOError as e:
231 bb.msg.error(bb.msg.domain.Parsing, "Unable to read %s: %s" % (fn, e)) 231 bb.msg.error(bb.msg.domain.Parsing, "Unable to read %s: %s" % (fn, e))
232 raise 232 raise
@@ -637,7 +637,7 @@ class BBCooker:
637 self.buildSetVars() 637 self.buildSetVars()
638 638
639 # Load data into the cache for fn and parse the loaded cache data 639 # Load data into the cache for fn and parse the loaded cache data
640 the_data = self.bb_cache.loadDataFull(fn, self.configuration.data) 640 the_data = self.bb_cache.loadDataFull(fn, self.get_file_appends(fn), self.configuration.data)
641 self.bb_cache.setData(fn, buildfile, the_data) 641 self.bb_cache.setData(fn, buildfile, the_data)
642 self.bb_cache.handle_data(fn, self.status) 642 self.bb_cache.handle_data(fn, self.status)
643 643
@@ -778,7 +778,6 @@ class BBCooker:
778 778
779 self.handleCollections( bb.data.getVar("BBFILE_COLLECTIONS", self.configuration.data, 1) ) 779 self.handleCollections( bb.data.getVar("BBFILE_COLLECTIONS", self.configuration.data, 1) )
780 780
781 bb.msg.debug(1, bb.msg.domain.Collection, "collecting .bb files")
782 (filelist, masked) = self.collect_bbfiles() 781 (filelist, masked) = self.collect_bbfiles()
783 bb.data.renameVar("__depends", "__base_depends", self.configuration.data) 782 bb.data.renameVar("__depends", "__base_depends", self.configuration.data)
784 783
@@ -817,7 +816,7 @@ class BBCooker:
817 return bbfiles 816 return bbfiles
818 817
819 def find_bbfiles( self, path ): 818 def find_bbfiles( self, path ):
820 """Find all the .bb files in a directory""" 819 """Find all the .bb and .bbappend files in a directory"""
821 from os.path import join 820 from os.path import join
822 821
823 found = [] 822 found = []
@@ -825,7 +824,7 @@ class BBCooker:
825 for ignored in ('SCCS', 'CVS', '.svn'): 824 for ignored in ('SCCS', 'CVS', '.svn'):
826 if ignored in dirs: 825 if ignored in dirs:
827 dirs.remove(ignored) 826 dirs.remove(ignored)
828 found += [join(dir, f) for f in files if f.endswith('.bb')] 827 found += [join(dir, f) for f in files if (f.endswith('.bb') or f.endswith('.bbappend'))]
829 828
830 return found 829 return found
831 830
@@ -834,6 +833,8 @@ class BBCooker:
834 parsed, cached, skipped, masked = 0, 0, 0, 0 833 parsed, cached, skipped, masked = 0, 0, 0, 0
835 self.bb_cache = bb.cache.init(self) 834 self.bb_cache = bb.cache.init(self)
836 835
836 bb.msg.debug(1, bb.msg.domain.Collection, "collecting .bb files")
837
837 files = (data.getVar( "BBFILES", self.configuration.data, 1 ) or "").split() 838 files = (data.getVar( "BBFILES", self.configuration.data, 1 ) or "").split()
838 data.setVar("BBFILES", " ".join(files), self.configuration.data) 839 data.setVar("BBFILES", " ".join(files), self.configuration.data)
839 840
@@ -848,9 +849,7 @@ class BBCooker:
848 for f in files: 849 for f in files:
849 if os.path.isdir(f): 850 if os.path.isdir(f):
850 dirfiles = self.find_bbfiles(f) 851 dirfiles = self.find_bbfiles(f)
851 if dirfiles: 852 newfiles.update(dirfiles)
852 newfiles.update(dirfiles)
853 continue
854 else: 853 else:
855 globbed = glob.glob(f) 854 globbed = glob.glob(f)
856 if not globbed and os.path.exists(f): 855 if not globbed and os.path.exists(f):
@@ -859,23 +858,45 @@ class BBCooker:
859 858
860 bbmask = bb.data.getVar('BBMASK', self.configuration.data, 1) 859 bbmask = bb.data.getVar('BBMASK', self.configuration.data, 1)
861 860
862 if not bbmask: 861 if bbmask:
863 return (list(newfiles), 0) 862 try:
864 863 bbmask_compiled = re.compile(bbmask)
865 try: 864 except sre_constants.error:
866 bbmask_compiled = re.compile(bbmask) 865 bb.msg.fatal(bb.msg.domain.Collection, "BBMASK is not a valid regular expression.")
867 except sre_constants.error:
868 bb.msg.fatal(bb.msg.domain.Collection, "BBMASK is not a valid regular expression.")
869 866
870 finalfiles = [] 867 bbfiles = []
868 bbappend = []
871 for f in newfiles: 869 for f in newfiles:
872 if bbmask_compiled.search(f): 870 if bbmask and bbmask_compiled.search(f):
873 bb.msg.debug(1, bb.msg.domain.Collection, "skipping masked file %s" % f) 871 bb.msg.debug(1, bb.msg.domain.Collection, "skipping masked file %s" % f)
874 masked += 1 872 masked += 1
875 continue 873 continue
876 finalfiles.append(f) 874 if f.endswith('.bb'):
877 875 bbfiles.append(f)
878 return (finalfiles, masked) 876 elif f.endswith('.bbappend'):
877 bbappend.append(f)
878 else:
879 bb.msg.note(1, bb.msg.domain.Collection, "File %s of unknown filetype in BBFILES? Ignorning..." % f)
880
881 # Build a list of .bbappend files for each .bb file
882 self.appendlist = {}
883 for f in bbappend:
884 base = os.path.basename(f).replace('.bbappend', '.bb')
885 if not base in self.appendlist:
886 self.appendlist[base] = []
887 self.appendlist[base].append(f)
888
889 return (bbfiles, masked)
890
891 def get_file_appends(self, fn):
892 """
893 Returns a list of .bbappend files to apply to fn
894 NB: collect_files() must have been called prior to this
895 """
896 f = os.path.basename(fn)
897 if f in self.appendlist:
898 return self.appendlist[f]
899 return []
879 900
880 def serve(self): 901 def serve(self):
881 902
@@ -945,7 +966,7 @@ class CookerParser:
945 f = self.filelist[self.pointer] 966 f = self.filelist[self.pointer]
946 967
947 try: 968 try:
948 fromCache, skipped, virtuals = cooker.bb_cache.loadData(f, cooker.configuration.data, cooker.status) 969 fromCache, skipped, virtuals = cooker.bb_cache.loadData(f, cooker.get_file_appends(f), cooker.configuration.data, cooker.status)
949 if fromCache: 970 if fromCache:
950 self.cached += 1 971 self.cached += 1
951 else: 972 else: