summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2007-08-12 21:18:02 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2007-08-12 21:18:02 +0000
commit71ecfaa13b377fdde1e9db4781e58d2fe6bc70d9 (patch)
tree5198f02268f8a872bd76e39183e82d4f660ff1bb
parent18cec169ad86f25fcc90352742c4d75dd297214e (diff)
downloadbitbake-71ecfaa13b377fdde1e9db4781e58d2fe6bc70d9.tar.gz
cooker.py: Allow the -b -e option combination to take regular expressions
-rw-r--r--ChangeLog1
-rw-r--r--lib/bb/cooker.py21
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)