Patchwork [2/2] classes/package: reduce dbg package dependencies

login
register
mail settings
Submitter Paul Eggleton
Date July 26, 2012, 2:35 p.m.
Message ID <e24b9ab4ba9c67f929f71d2c5dccab2118403488.1343313237.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/33133/
State Accepted
Commit 352522d474cb75992d7865545b6fbe4e157a5f99
Headers show

Comments

Paul Eggleton - July 26, 2012, 2:35 p.m.
Make dbg package dependencies added via DEPCHAIN_POST less aggressive -
only add dependencies on dbg packages for shared library dependencies.
This avoids dragging in extraneous packages (such as eglibc-dbg forcing
bash-dbg to be installed) whilst preserving the ability to easily debug
into shared libraries in use by an application by just requesting the
installation of the single dbg package for that application.

For task recipes however we preserve the previous behaviour, since when
you install task-xxx-dbg you expect the dbg packages for every package
in the task to be installed. Unfortunately not all of our tasks inherit
from task.bbclass so we just use a name match - this should be tidied up
later.

Fixes [YOCTO #2599].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/classes/package.bbclass |   32 +++++++++++++++++++++++++++-----
 meta/classes/task.bbclass    |    3 +++
 2 files changed, 30 insertions(+), 5 deletions(-)

Patch

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 962abcd..efb03f8 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1580,19 +1580,28 @@  python package_do_pkgconfig () {
     bb.utils.unlockfile(lf)
 }
 
-python read_shlibdeps () {
+def read_libdep_files(d):
+    pkglibdeps = {}
     packages = d.getVar('PACKAGES', True).split()
     for pkg in packages:
-        rdepends = bb.utils.explode_dep_versions(d.getVar('RDEPENDS_' + pkg, False) or d.getVar('RDEPENDS', False) or "")
-
+        pkglibdeps[pkg] = []
         for extension in ".shlibdeps", ".pcdeps", ".clilibdeps":
             depsfile = d.expand("${PKGDEST}/" + pkg + extension)
             if os.access(depsfile, os.R_OK):
                 fd = file(depsfile)
                 lines = fd.readlines()
                 fd.close()
-                for l in lines:
-                    rdepends[l.rstrip()] = ""
+                pkglibdeps[pkg].extend([l.rstrip() for l in lines])
+    return pkglibdeps
+
+python read_shlibdeps () {
+    pkglibdeps = read_libdep_files(d)
+
+    packages = d.getVar('PACKAGES', True).split()
+    for pkg in packages:
+        rdepends = bb.utils.explode_dep_versions(d.getVar('RDEPENDS_' + pkg, False) or d.getVar('RDEPENDS', False) or "")
+        for dep in pkglibdeps[pkg]:
+            rdepends[dep] = ""
         d.setVar('RDEPENDS_' + pkg, bb.utils.join_deps(rdepends, commasep=False))
 }
 
@@ -1694,6 +1703,15 @@  python package_depchains() {
                     pkgs[prefix] = {}
                 pkgs[prefix][pkg] = (pkg[:-len(prefix)], pre_getname)
 
+    if "-dbg" in pkgs:
+        pkglibdeps = read_libdep_files(d)
+        pkglibdeplist = []
+        for pkg in pkglibdeps:
+            for dep in pkglibdeps[pkg]:
+                add_dep(pkglibdeplist, dep)
+        # FIXME this should not look at PN once all task recipes inherit from task.bbclass
+        dbgdefaultdeps = ((d.getVar('DEPCHAIN_DBGDEFAULTDEPS', True) == '1') or (d.getVar('PN', True) or '').startswith('task-'))
+
     for suffix in pkgs:
         for pkg in pkgs[suffix]:
             if d.getVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs'):
@@ -1701,6 +1719,10 @@  python package_depchains() {
             (base, func) = pkgs[suffix][pkg]
             if suffix == "-dev":
                 pkg_adddeprrecs(pkg, base, suffix, func, depends, d)
+            elif suffix == "-dbg":
+                if not dbgdefaultdeps:
+                    pkg_addrrecs(pkg, base, suffix, func, pkglibdeplist, d)
+                    continue
             if len(pkgs[suffix]) == 1:
                 pkg_addrrecs(pkg, base, suffix, func, rdepends, d)
             else:
diff --git a/meta/classes/task.bbclass b/meta/classes/task.bbclass
index 22c2fd3..6ec154a 100644
--- a/meta/classes/task.bbclass
+++ b/meta/classes/task.bbclass
@@ -25,3 +25,6 @@  python () {
     d.setVar('PACKAGES', ' '.join(packages+genpackages))
 }
 
+# We don't want to look at shared library dependencies for the
+# dbg packages
+DEPCHAIN_DBGDEFAULTDEPS = "1"