to make updating depends easier/more intuitive/eventually faster

Signed-off-by: Bernhard Reutner-Fischer <[email protected]>
---
 lib/bb/cache.py          |   10 ++++------
 lib/bb/parse/__init__.py |    4 ++--
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/lib/bb/cache.py b/lib/bb/cache.py
index 8c1e692..59ea8cf 100644
--- a/lib/bb/cache.py
+++ b/lib/bb/cache.py
@@ -106,8 +106,7 @@ class Cache:
         if fn in self.clean:
             return self.depends_cache[fn][var]
 
-        if not fn in self.depends_cache:
-            self.depends_cache[fn] = {}
+        self.depends_cache.setdefault(fn, {})
 
         if fn != self.data_fn:
             # We're trying to access data in the cache which doesn't exist
@@ -131,13 +130,12 @@ class Cache:
         # Make sure __depends makes the depends_cache
         # If we're a virtual class we need to make sure all our depends are 
appended
         # to the depends of fn.
-        depends = self.getVar("__depends", virtualfn) or []
+        depends = self.getVar("__depends", virtualfn) or set()
         self.depends_cache.setdefault(fn, {})
         if "__depends" not in self.depends_cache[fn] or not 
self.depends_cache[fn]["__depends"]:
             self.depends_cache[fn]["__depends"] = depends
-        for dep in depends:
-            if dep not in self.depends_cache[fn]["__depends"]:
-                self.depends_cache[fn]["__depends"].append(dep)
+        else:
+            self.depends_cache[fn]["__depends"].update(depends)
 
         # Make sure the variants always make it into the cache too
         self.getVar('__VARIANTS', virtualfn, True)
diff --git a/lib/bb/parse/__init__.py b/lib/bb/parse/__init__.py
index 4b95788..1233850 100644
--- a/lib/bb/parse/__init__.py
+++ b/lib/bb/parse/__init__.py
@@ -56,8 +56,8 @@ 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 []
-    deps.append( (f, cached_mtime(f)) )
+    deps = bb.data.getVar('__depends', d) or set()
+    deps.update([(f, cached_mtime(f))])
     bb.data.setVar('__depends', deps, d)
 
 def supports(fn, data):
-- 
1.7.1

_______________________________________________
Bitbake-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bitbake-dev

Reply via email to