From 6d7d68d1c50d2d5abc09f00167310cd60fc58d8d Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 28 Apr 2006 21:07:16 +0000 Subject: bitbake/lib/bb/parse/__init__.py: Bug 895. __depends is a single string with "filename@time" the string gets splitted by ' ' as it is assumed that "filename@time filename2@time2" is true. Basicly on PPC/Darwin we have "PowerPC Macintosh.conf" splitting by space leads to the error observed by koen. Resolution: As we use __depends only as a list, save it as a list. This avoids the int->str->int, and split, append, join operations. bitbake/lib/bb/cache.py: __depends is now a list, change the version of the cache and simplify the method. --- lib/bb/cache.py | 19 ++++++++----------- lib/bb/parse/__init__.py | 6 +++--- 2 files changed, 11 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/bb/cache.py b/lib/bb/cache.py index d4be9d7ff..e3e0d6a16 100644 --- a/lib/bb/cache.py +++ b/lib/bb/cache.py @@ -40,7 +40,8 @@ except ImportError: import pickle print "NOTE: Importing cPickle failed. Falling back to a very slow implementation." -__cache_version__ = "123" +# __cache_version__ = "123" +__cache_version__ = "124" # changes the __depends structure class Cache: """ @@ -192,16 +193,12 @@ class Cache: # Check dependencies are still valid depends = self.getVar("__depends", fn, True) - if depends: - deps = depends.split(" ") - for dep in deps: - (f,old_mtime_s) = dep.split("@") - old_mtime = int(old_mtime_s) - new_mtime = bb.parse.cached_mtime(f) - if (new_mtime > old_mtime): - bb.debug(2, "Cache: %s's dependency %s changed" % (fn, f)) - self.remove(fn) - return False + for f,old_mtime in depends: + new_mtime = bb.parse.cached_mtime(f) + if (new_mtime > old_mtime): + bb.debug(2, "Cache: %s's dependency %s changed" % (fn, f)) + self.remove(fn) + return False bb.debug(2, "Depends Cache: %s is clean" % fn) if not fn in self.clean: diff --git a/lib/bb/parse/__init__.py b/lib/bb/parse/__init__.py index cb2741606..58e17d154 100644 --- a/lib/bb/parse/__init__.py +++ b/lib/bb/parse/__init__.py @@ -46,9 +46,9 @@ def update_mtime(f): def mark_dependency(d, f): if f.startswith('./'): f = "%s/%s" % (os.getcwd(), f[2:]) - deps = (bb.data.getVar('__depends', d) or "").split() - deps.append("%s@%s" % (f, cached_mtime(f))) - bb.data.setVar('__depends', " ".join(deps), d) + deps = bb.data.getVar('__depends', d) or [] + deps.append( (f, cached_mtime(f)) ) + bb.data.setVar('__depends', deps, d) def supports(fn, data): """Returns true if we have a handler for this file, false otherwise""" -- cgit 1.2.3-korg