aboutsummaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-08-19 18:33:28 -0700
committerChris Larson <chris_larson@mentor.com>2010-08-19 18:34:59 -0700
commitb8b2ca6b0d13df3aea2d6974e5a6b9c65a220756 (patch)
treea6fe3151fbdb85797b9ee14963dcab70e8404db7 /classes
parentc323496195aaec26055da823a6c0166c7836c6b2 (diff)
downloadopenembedded-b8b2ca6b0d13df3aea2d6974e5a6b9c65a220756.tar.gz
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@mentor.com>
Diffstat (limited to 'classes')
-rw-r--r--classes/amend.bbclass38
1 files changed, 25 insertions, 13 deletions
diff --git a/classes/amend.bbclass b/classes/amend.bbclass
index fb67b4ebb1..2d928286b3 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)
}