diff options
author | Richard Purdie <richard@openedhand.com> | 2007-08-12 23:06:49 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2007-08-12 23:06:49 +0000 |
commit | ce800d3aea333919302a490838906983c18fe54d (patch) | |
tree | 14754c6d6de07f47a6f917b4d4d0e9bf52468beb /bitbake/lib | |
parent | fc136f0b4c9f6c0bed18fb565f5c83d041abdd39 (diff) | |
download | poky-ce800d3aea333919302a490838906983c18fe54d.tar.gz |
bitbake: Sync with upstream 1.8 branch for fixes
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2484 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/__init__.py | 20 | ||||
-rw-r--r-- | bitbake/lib/bb/cooker.py | 21 | ||||
-rw-r--r-- | bitbake/lib/bb/data.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 17 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/local.py | 4 |
5 files changed, 50 insertions, 16 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py index e601eda469..1bfecc49ec 100644 --- a/bitbake/lib/bb/__init__.py +++ b/bitbake/lib/bb/__init__.py | |||
@@ -345,14 +345,20 @@ def encodeurl(decoded): | |||
345 | ####################################################################### | 345 | ####################################################################### |
346 | 346 | ||
347 | def which(path, item, direction = 0): | 347 | def which(path, item, direction = 0): |
348 | """Useful function for locating a file in a PATH""" | 348 | """ |
349 | found = "" | 349 | Locate a file in a PATH |
350 | """ | ||
351 | |||
352 | paths = (path or "").split(':') | ||
353 | if direction != 0: | ||
354 | paths.reverse() | ||
355 | |||
350 | for p in (path or "").split(':'): | 356 | for p in (path or "").split(':'): |
351 | if os.path.exists(os.path.join(p, item)): | 357 | next = os.path.join(p, item) |
352 | found = os.path.join(p, item) | 358 | if os.path.exists(next): |
353 | if direction == 0: | 359 | return next |
354 | break | 360 | |
355 | return found | 361 | return "" |
356 | 362 | ||
357 | ####################################################################### | 363 | ####################################################################### |
358 | 364 | ||
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 | ||
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index 9782c9f546..b2025f0694 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py | |||
@@ -288,6 +288,10 @@ def expandKeys(alterdata, readdata = None): | |||
288 | src = getVarFlag(key, i, readdata) or [] | 288 | src = getVarFlag(key, i, readdata) or [] |
289 | dest.extend(src) | 289 | dest.extend(src) |
290 | setVarFlag(ekey, i, dest, alterdata) | 290 | setVarFlag(ekey, i, dest, alterdata) |
291 | |||
292 | if key in alterdata._special_values[i]: | ||
293 | alterdata._special_values[i].remove(key) | ||
294 | alterdata._special_values[i].add(ekey) | ||
291 | 295 | ||
292 | delVar(key, alterdata) | 296 | delVar(key, alterdata) |
293 | 297 | ||
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index f739245bd1..229b28c19d 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py | |||
@@ -182,8 +182,21 @@ def get_srcrev(d): | |||
182 | if len(scms) == 1: | 182 | if len(scms) == 1: |
183 | return urldata[scms[0]].method.sortable_revision(scms[0], urldata[scms[0]], d) | 183 | return urldata[scms[0]].method.sortable_revision(scms[0], urldata[scms[0]], d) |
184 | 184 | ||
185 | bb.msg.error(bb.msg.domain.Fetcher, "Sorry, support for SRCREV_FORMAT still needs to be written") | 185 | # |
186 | raise ParameterError | 186 | # Mutiple SCMs are in SRC_URI so we resort to SRCREV_FORMAT |
187 | # | ||
188 | format = bb.data.getVar('SRCREV_FORMAT', d, 1) | ||
189 | if not format: | ||
190 | bb.msg.error(bb.msg.domain.Fetcher, "The SRCREV_FORMAT variable must be set when multiple SCMs are used.") | ||
191 | raise ParameterError | ||
192 | |||
193 | for scm in scms: | ||
194 | if 'name' in urldata[scm].parm: | ||
195 | name = urldata[scm].parm["name"] | ||
196 | rev = urldata[scm].method.sortable_revision(scm, urldata[scm], d) | ||
197 | format = format.replace(name, rev) | ||
198 | |||
199 | return format | ||
187 | 200 | ||
188 | def localpath(url, d, cache = True): | 201 | def localpath(url, d, cache = True): |
189 | """ | 202 | """ |
diff --git a/bitbake/lib/bb/fetch/local.py b/bitbake/lib/bb/fetch/local.py index 9be8f1ce4b..5e480a208e 100644 --- a/bitbake/lib/bb/fetch/local.py +++ b/bitbake/lib/bb/fetch/local.py | |||
@@ -38,9 +38,11 @@ class Local(Fetch): | |||
38 | return urldata.type in ['file','patch'] | 38 | return urldata.type in ['file','patch'] |
39 | 39 | ||
40 | def localpath(self, url, urldata, d): | 40 | def localpath(self, url, urldata, d): |
41 | """Return the local filename of a given url assuming a successful fetch. | 41 | """ |
42 | Return the local filename of a given url assuming a successful fetch. | ||
42 | """ | 43 | """ |
43 | path = url.split("://")[1] | 44 | path = url.split("://")[1] |
45 | path = path.split(";")[0] | ||
44 | newpath = path | 46 | newpath = path |
45 | if path[0] != "/": | 47 | if path[0] != "/": |
46 | filespath = data.getVar('FILESPATH', d, 1) | 48 | filespath = data.getVar('FILESPATH', d, 1) |