From 0788436f2de5446fd78213d8d88f612ce49f1b3d Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Tue, 19 Jan 2010 13:01:41 -0700 Subject: package_dbg.bbclass: add current incarnation from MVL6 This optional bbclass implements per-subpackage debug packages. Among other things, this makes it much easier to automate creation of debug images (where you have the debug files for all installed packages). Signed-off-by: Chris Larson --- classes/package_dbg.bbclass | 125 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 classes/package_dbg.bbclass (limited to 'classes') diff --git a/classes/package_dbg.bbclass b/classes/package_dbg.bbclass new file mode 100644 index 0000000000..39dceaf9b3 --- /dev/null +++ b/classes/package_dbg.bbclass @@ -0,0 +1,125 @@ +# package_dbg.bbclass: populate -dbg versions for each package in PACKAGES +# +# Copyright (c) 2009 MontaVista Software, Inc. All rights reserved. +# +# Released under the MIT license (see LICENSE.MIT for the terms) + + +inherit package + + +PACKAGE_DBG_DIRS = "${bindir} ${sbindir} \ + ${libexecdir} ${libdir} \ + ${base_bindir} ${base_sbindir} \ + ${base_libdir}" +PACKAGE_DBG_DESC = "Debugging files for %s" +PACKAGE_DBG_EXCLUDE = "${PN}-locale* ${PN}-doc ${PN}-dev *-dbg" + + +def __find(dir): + """ Given a directory, recurses into that directory, + returning all files. """ + + from os import walk + from os.path import join + + for root, dirs, files in walk(dir): + for file in files: + yield join(root, file) + +def __package_get_files(pkg, d): + """ Obtains a list of files to be included in a package. + + Starting from the FILES_ variable, it expands any globs in the list, + which removes missing files, and traverses any directories in the list. + + It does *not* remove files which are also in other packages, it's left + to the user's discretion whether to allow overlap. """ + + from glob import glob + from os.path import join, isdir, islink + + installdir = d.getVar("D", True) + installdirlen = len(installdir) + + files = (d.getVar("FILES_%s" % pkg, True) or "").split() + for globbed in (glob(join(installdir, file[1:])) for file in files): + for path in globbed: + if isdir(path) and not islink(path): + for file in __find(path): + yield file[installdirlen:] + else: + yield path[installdirlen:] + +def add_dbg_packages(d): + from fnmatch import fnmatch + + packages = d.getVar("PACKAGES", True).split() + excludes = d.getVar("PACKAGE_DBG_EXCLUDE", True).split() + + for pkg in tuple(packages): + if any(fnmatch(pkg, excluded) for excluded in excludes): + continue + + dbgpkg = "%s-dbg" % pkg + if not dbgpkg in packages: + packages.insert(0, dbgpkg) + + d.setVar("PACKAGES", " ".join(packages)) + + +# Add the -dbg packages to PACKAGES +python () { + from bb.data import inherits_class as inherits + + # Task handles its own -dbg versions of its packages at the moment + if not inherits("task", d): + dynpkgs = d.getVar("PACKAGES_DYNAMIC", True).split() + dynpkgs += ["%s-dbg" % dyn for dyn in dynpkgs] + d.setVar("PACKAGES_DYNAMIC", " ".join(dynpkgs)) + + add_dbg_packages(d) +} + +python populate_packages_prepend () { + from bb.data import inherits_class as inherits + + if not inherits("task", d): + bb.build.exec_func("package_do_dbg", d) +} + +# Populate the -dbg subpackage metadata +python package_do_dbg() { + """ Populate the -dbg subpackage metadata. """ + + from os.path import join, basename, dirname + + def setVar(key, val): + if d.getVar(key, val) is None: + d.setVar(key, val) + + add_dbg_packages(d) + packages = d.getVar("PACKAGES", True).split() + desc = d.getVar("PACKAGE_DBG_DESC", True) + debug_dirs = d.getVar("PACKAGE_DBG_DIRS", True).split() + + done = [] + for pkgname in tuple(packages): + files = tuple(__package_get_files(pkgname, d)) + dbg = [join(dirname(file), ".debug", basename(file)) + for file in files + if not file in done and + any(file.startswith(dir) for dir in debug_dirs)] + done.extend(files) + + if dbg: + setVar("FILES_%s-dbg" % pkgname, " ".join(dbg)) + setVar("DESCRIPTION_%s-dbg" % pkgname, desc % pkgname) + setVar("RDEPENDS_%s-dbg" % pkgname, pkgname) + else: + try: + packages.remove("%s-dbg" % pkgname) + except ValueError: + pass + d.setVar("PACKAGES", " ".join(packages)) +} -- cgit v1.2.3 From c4408fc35e6ce5fa3f08a5f8635471a6bb346dd3 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Fri, 15 Jan 2010 18:14:38 +0100 Subject: qt3e.bbclass: fix paths for staging Without that patch uicmoc3-native fails to build. --- classes/qt3e.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'classes') diff --git a/classes/qt3e.bbclass b/classes/qt3e.bbclass index 35958b34ab..d3d4a14e8a 100644 --- a/classes/qt3e.bbclass +++ b/classes/qt3e.bbclass @@ -6,6 +6,6 @@ export QTEDIR="${STAGING_DIR_HOST}/qte3" export OE_QMAKE_UIC="${STAGING_BINDIR_NATIVE}/uic3" export OE_QMAKE_MOC="${STAGING_BINDIR_NATIVE}/moc3" export OE_QMAKE_CXXFLAGS="${CXXFLAGS} " -export OE_QMAKE_INCDIR_QT="${QTEDIR}/include" -export OE_QMAKE_LIBDIR_QT="${QTEDIR}/lib" +export OE_QMAKE_INCDIR_QT="${STAGING_INCDIR}/qte3/include" +export OE_QMAKE_LIBDIR_QT="${STAGING_LIBDIR}/qte3/lib" export OE_QMAKE_LIBS_QT="qte" -- cgit v1.2.3 From 1b426b8382d2a7864b63051b0707e577f2c0ce69 Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Fri, 15 Jan 2010 18:10:29 +0100 Subject: sanity.bbclass: handle lack of permission to read /proc/sys/vm/mmap_min_addr * With 2.6.33-rc2-00252-ge9e5521 on my host I noticed that "cat /proc/sys/vm/mmap_min_addr" returns now "cat: /proc/sys/vm/mmap_min_addr: Operation not permitted" Its probably becuse of http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0e1a6ef2dea88101b056b6d9984f3325c5efced3 But I'm not sure if checking CAP_SYS_RAWIO even for reading this value is intentional or just bug which should be fixed in kernel. This patch makes bitbake ignore reading error. Possible QEmu failure is not handled yet. Acked-by: Marcin Juszkiewicz --- classes/sanity.bbclass | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'classes') diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass index f65df61c1d..f57d8e47d0 100644 --- a/classes/sanity.bbclass +++ b/classes/sanity.bbclass @@ -96,11 +96,14 @@ def check_sanity(e): if not check_app_exists("qemu-arm", e.data): messages = messages + "qemu-native was in ASSUME_PROVIDED but the QEMU binaries (qemu-arm) can't be found in PATH" - if os.path.exists("/proc/sys/vm/mmap_min_addr"): - f = file("/proc/sys/vm/mmap_min_addr", "r") - if (f.read().strip() != "0"): - messages = messages + "/proc/sys/vm/mmap_min_addr is not 0. This will cause problems with qemu so please fix the value (as root).\n\nTo fix this in later reboots, set vm.mmap_min_addr = 0 in /etc/sysctl.conf.\n" - f.close() + try: + if os.path.exists("/proc/sys/vm/mmap_min_addr"): + f = file("/proc/sys/vm/mmap_min_addr", "r") + if (f.read().strip() != "0"): + messages = messages + "/proc/sys/vm/mmap_min_addr is not 0. This will cause problems with qemu so please fix the value (as root).\n\nTo fix this in later reboots, set vm.mmap_min_addr = 0 in /etc/sysctl.conf.\n" + f.close() + except: + pass for util in required_utilities.split(): if not check_app_exists( util, e.data ): -- cgit v1.2.3