angstrom: prefer the git version of tslib
[openembedded.git] / classes / amend.bbclass
blob048a8f377cc2ec6d9e37febdbf78ae8172753b1f
1 # Allows tweaks to be amended to a recipe via a .inc in its FILESPATH
3 # Simply drop amend.inc into an appropriate place in a recipe's FILESPATH and
4 # it'll be parsed in after the recipe itself is.
6 # Copyright (c) 2009 MontaVista Software, Inc.  All rights reserved.
8 # Released under the MIT license (see LICENSE.MIT for the terms)
10 python () {
11     import bb, os
13     seen = set()
14     def __amendfiles():
15         for base in d.getVar("FILESPATHBASE", True).split(":"):
16             for pkg in d.getVar("FILESPATHPKG", True).split(":"):
17                 path = os.path.join(base, pkg, "amend.inc")
18                 if path not in seen:
19                     seen.add(path)
20                     yield path
22     newdata = []
23     for amend in __amendfiles():
24         if os.path.exists(amend):
25             bb.parse.handle(amend, d, 1)
26         else:
27             # Manually add amend.inc files that don't exist to the __depends,
28             # to ensure that creating them invalidates the bitbake cache
29             newdata.append((amend, 0))
31     if not newdata:
32         return
34     depends = d.getVar("__depends", False)
35     bbversion = tuple(int(i) for i in bb.__version__.split("."))
36     if bbversion < (1, 11, 0):
37         if depends is None:
38             depends = []
39         depends += newdata
40     else:
41         if depends is None:
42             depends = set()
43         depends |= set(newdata)
44     d.setVar("__depends", depends)
46     set_multimach_arch(d)