From b8b2ca6b0d13df3aea2d6974e5a6b9c65a220756 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Thu, 19 Aug 2010 18:33:28 -0700 Subject: 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 --- classes/amend.bbclass | 38 +++++++++++++++++++++++++------------- 1 file 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) } -- cgit v1.2.3