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.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 7db3529bb4..955fbb434c 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -143,10 +143,11 @@ class BBCooker:
143 if self.configuration.buildfile: 143 if self.configuration.buildfile:
144 self.cb = None 144 self.cb = None
145 self.bb_cache = bb.cache.init(self) 145 self.bb_cache = bb.cache.init(self)
146 bf = self.matchFile(self.configuration.buildfile)
146 try: 147 try:
147 self.configuration.data = self.bb_cache.loadDataFull(self.configuration.buildfile, self.configuration.data) 148 self.configuration.data = self.bb_cache.loadDataFull(bf, self.configuration.data)
148 except IOError, e: 149 except IOError, e:
149 bb.msg.fatal(bb.msg.domain.Parsing, "Unable to read %s: %s" % ( self.configuration.buildfile, e )) 150 bb.msg.fatal(bb.msg.domain.Parsing, "Unable to read %s: %s" % (bf, e))
150 except Exception, e: 151 except Exception, e:
151 bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e) 152 bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e)
152 # emit variables and shell functions 153 # emit variables and shell functions
@@ -377,14 +378,15 @@ class BBCooker:
377 bb.data.setVar("BUILDNAME", os.popen('date +%Y%m%d%H%M').readline().strip(), self.configuration.data) 378 bb.data.setVar("BUILDNAME", os.popen('date +%Y%m%d%H%M').readline().strip(), self.configuration.data)
378 bb.data.setVar("BUILDSTART", time.strftime('%m/%d/%Y %H:%M:%S',time.gmtime()),self.configuration.data) 379 bb.data.setVar("BUILDSTART", time.strftime('%m/%d/%Y %H:%M:%S',time.gmtime()),self.configuration.data)
379 380
380 def buildFile(self, buildfile): 381 def matchFile(self, buildfile):
381 """ 382 """
382 Build the file matching regexp buildfile 383 Convert the fragment buildfile into a real file
384 Error if there are too many matches
383 """ 385 """
384
385 bf = os.path.abspath(buildfile) 386 bf = os.path.abspath(buildfile)
386 try: 387 try:
387 os.stat(bf) 388 os.stat(bf)
389 return bf
388 except OSError: 390 except OSError:
389 (filelist, masked) = self.collect_bbfiles() 391 (filelist, masked) = self.collect_bbfiles()
390 regexp = re.compile(buildfile) 392 regexp = re.compile(buildfile)
@@ -398,7 +400,14 @@ class BBCooker:
398 for f in matches: 400 for f in matches:
399 bb.msg.error(bb.msg.domain.Parsing, " %s" % f) 401 bb.msg.error(bb.msg.domain.Parsing, " %s" % f)
400 sys.exit(1) 402 sys.exit(1)
401 bf = matches[0] 403 return matches[0]
404
405 def buildFile(self, buildfile):
406 """
407 Build the file matching regexp buildfile
408 """
409
410 bf = self.matchFile(buildfile)
402 411
403 bbfile_data = bb.parse.handle(bf, self.configuration.data) 412 bbfile_data = bb.parse.handle(bf, self.configuration.data)
404 413