1 # package_dbg.bbclass: populate -dbg versions for each package in PACKAGES
3 # Copyright (c) 2009 MontaVista Software, Inc. All rights reserved.
5 # Released under the MIT license (see LICENSE.MIT for the terms)
11 PACKAGE_DBG_DESC = "Debugging files for %s"
12 PACKAGE_DBG_EXCLUDE = "${PN}-locale* ${PN}-doc ${PN}-dev *-dbg"
15 def add_dbg_packages(d):
16 from fnmatch import fnmatch
18 packages = d.getVar("PACKAGES", True).split()
19 excludes = d.getVar("PACKAGE_DBG_EXCLUDE", True).split()
21 for pkg in tuple(packages):
22 if any(fnmatch(pkg, excluded) for excluded in excludes):
25 dbgpkg = "%s-dbg" % pkg
26 if not dbgpkg in packages:
27 packages.insert(0, dbgpkg)
29 d.setVar("PACKAGES", " ".join(packages))
32 # Add the -dbg packages to PACKAGES
34 from bb.data import inherits_class as inherits
36 # Task handles its own -dbg versions of its packages at the moment
37 if not inherits("task", d):
38 dynpkgs = d.getVar("PACKAGES_DYNAMIC", True).split()
39 dynpkgs += ["%s-dbg" % dyn for dyn in dynpkgs]
40 d.setVar("PACKAGES_DYNAMIC", " ".join(dynpkgs))
45 python populate_packages_prepend () {
46 from bb.data import inherits_class as inherits
48 if not inherits("task", d):
49 bb.build.exec_func("package_do_dbg", d)
52 # Populate the -dbg subpackage metadata
53 python package_do_dbg() {
54 """ Populate the -dbg subpackage metadata. """
57 from os.path import join, basename, dirname
60 if d.getVar(key, val) is None:
64 packages = d.getVar("PACKAGES", True).split()
65 desc = d.getVar("PACKAGE_DBG_DESC", True)
68 for pkgname in tuple(packages):
69 files = tuple(oe.package.files(pkgname, d))
70 dbg = [join(dirname(file), ".debug", basename(file))
76 setVar("FILES_%s-dbg" % pkgname, " ".join(dbg))
77 setVar("DESCRIPTION_%s-dbg" % pkgname, desc % pkgname)
78 setVar("RDEPENDS_%s-dbg" % pkgname, pkgname)
81 packages.remove("%s-dbg" % pkgname)
84 d.setVar("PACKAGES", " ".join(packages))