[oe-commits] Chris Larson : amend.bbclass: work with all versions of bitbake

git version control git at git.openembedded.org
Fri Aug 20 01:35:12 UTC 2010


Module: openembedded.git
Branch: org.openembedded.dev
Commit: b8b2ca6b0d13df3aea2d6974e5a6b9c65a220756
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=b8b2ca6b0d13df3aea2d6974e5a6b9c65a220756

Author: Chris Larson <chris_larson at mentor.com>
Date:   Thu Aug 19 18:33:28 2010 -0700

amend.bbclass: work with all versions of bitbake

Latest bitbake uses a set for __depends, rather than a list, so handle that
when we add the nonexistent files.

Signed-off-by: Chris Larson <chris_larson at mentor.com>

---

 classes/amend.bbclass |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/classes/amend.bbclass b/classes/amend.bbclass
index fb67b4e..2d92828 100644
--- a/classes/amend.bbclass
+++ b/classes/amend.bbclass
@@ -14,20 +14,32 @@ python () {
     amendfiles = [os.path.join(fpath, "amend.inc")
                   for fpath in filespath]
 
-    # Adding all amend.incs that can exist to the __depends, to ensure that
-    # creating one of them invalidates the bitbake cache.  Note that it
-    # requires a fix in bitbake.  Without the bitbake fix, the cache will be
-    # completely invalidated on every bitbake execution.
-    depends = d.getVar("__depends", 0) or []
-    d.setVar("__depends", depends + [(file, 0) for file in amendfiles if not os.path.exists(file)])
-
-    # Make sure we don't parse the same amend.inc file more than once, if
-    # there are duplicates in FILESPATH
+    newdata = []
     seen = set()
-
     for file in amendfiles:
+        if file in seen:
+            continue
+        seen.add(file)
+
         if os.path.exists(file):
-            if file not in seen:
-                bb.parse.handle(file, d, 1)
-                seen.add(file)
+            bb.parse.handle(file, d, 1)
+        else:
+            # Manually add amend.inc files that don't exist to the __depends, to
+            # ensure that creating them invalidates the bitbake cache for that recipe.
+            newdata.append((file, 0))
+
+    if not newdata:
+        return
+
+    depends = d.getVar("__depends", False)
+    bbversion = tuple(int(i) for i in bb.__version__.split("."))
+    if bbversion < (1, 11, 0):
+        if depends is None:
+            depends = []
+        depends += newdata
+    else:
+        if depends is None:
+            depends = set()
+        depends |= set(newdata)
+    d.setVar("__depends", depends)
 }





More information about the Openembedded-commits mailing list