From 71ecfaa13b377fdde1e9db4781e58d2fe6bc70d9 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sun, 12 Aug 2007 21:18:02 +0000 Subject: cooker.py: Allow the -b -e option combination to take regular expressions --- ChangeLog | 1 + lib/bb/cooker.py | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1c7921a3..2e70d5e34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,7 @@ Changes in Bitbake 1.8.x: - Add SRCREV_FORMAT support - Fix local fetcher's localpath return values - Apply OVERRIDES before performing immediate expansions + - Allow the -b -e option combination to take regular expressions Changes in Bitbake 1.8.6: - Correctly redirect stdin when forking diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py index 7db3529bb..955fbb434 100644 --- a/lib/bb/cooker.py +++ b/lib/bb/cooker.py @@ -143,10 +143,11 @@ class BBCooker: if self.configuration.buildfile: self.cb = None self.bb_cache = bb.cache.init(self) + bf = self.matchFile(self.configuration.buildfile) try: - self.configuration.data = self.bb_cache.loadDataFull(self.configuration.buildfile, self.configuration.data) + self.configuration.data = self.bb_cache.loadDataFull(bf, self.configuration.data) except IOError, e: - bb.msg.fatal(bb.msg.domain.Parsing, "Unable to read %s: %s" % ( self.configuration.buildfile, e )) + bb.msg.fatal(bb.msg.domain.Parsing, "Unable to read %s: %s" % (bf, e)) except Exception, e: bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e) # emit variables and shell functions @@ -377,14 +378,15 @@ class BBCooker: bb.data.setVar("BUILDNAME", os.popen('date +%Y%m%d%H%M').readline().strip(), self.configuration.data) bb.data.setVar("BUILDSTART", time.strftime('%m/%d/%Y %H:%M:%S',time.gmtime()),self.configuration.data) - def buildFile(self, buildfile): + def matchFile(self, buildfile): """ - Build the file matching regexp buildfile + Convert the fragment buildfile into a real file + Error if there are too many matches """ - bf = os.path.abspath(buildfile) try: os.stat(bf) + return bf except OSError: (filelist, masked) = self.collect_bbfiles() regexp = re.compile(buildfile) @@ -398,7 +400,14 @@ class BBCooker: for f in matches: bb.msg.error(bb.msg.domain.Parsing, " %s" % f) sys.exit(1) - bf = matches[0] + return matches[0] + + def buildFile(self, buildfile): + """ + Build the file matching regexp buildfile + """ + + bf = self.matchFile(buildfile) bbfile_data = bb.parse.handle(bf, self.configuration.data) -- cgit 1.2.3-korg