summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2007-08-11 23:49:36 +0000
committerRichard Purdie <rpurdie@rpsys.net>2007-08-11 23:49:36 +0000
commit1f4287261e131a7bf472bd6424acafe8b05592ae (patch)
tree48de799de1bef22f4bcddaf12be15be762cf86f6 /classes
parentd09261da3f61354ec8cdcda444f8000feaa1753f (diff)
package.bbclass: Improve dependency chain handling function to differentiate when multiple -dev or -dbg packages are generated and when a single one is generated (from poky)
Diffstat (limited to 'classes')
-rw-r--r--classes/package.bbclass79
1 files changed, 53 insertions, 26 deletions
diff --git a/classes/package.bbclass b/classes/package.bbclass
index 62f09967d3..95e4acd4d6 100644
--- a/classes/package.bbclass
+++ b/classes/package.bbclass
@@ -823,54 +823,81 @@ python read_shlibdeps () {
python package_depchains() {
"""
For a given set of prefix and postfix modifiers, make those packages
- RRECOMMENDS on the corresponding packages for its DEPENDS.
+ RRECOMMENDS on the corresponding packages for its RDEPENDS.
Example: If package A depends upon package B, and A's .bb emits an
A-dev package, this would make A-dev Recommends: B-dev.
+
+ If only one of a given suffix is specified, it will take the RRECOMMENDS
+ based on the RDEPENDS of *all* other packages. If more than one of a given
+ suffix is specified, its will only use the RDEPENDS of the single parent
+ package.
"""
packages = bb.data.getVar('PACKAGES', d, 1)
postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split()
prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split()
- def pkg_addrrecs(pkg, base, func, d):
- rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "")
- # bb.note('rdepends for %s is %s' % (base, rdepends))
+ def pkg_addrrecs(pkg, base, suffix, getname, rdepends, d):
+ def packaged(pkg, d):
+ return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK)
+
+ #bb.note('rdepends for %s is %s' % (base, rdepends))
+
rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 1) or bb.data.getVar('RRECOMMENDS', d, 1) or "")
for depend in rdepends:
- split_depend = depend.split(' (')
- name = split_depend[0].strip()
- func(rreclist, name)
+ pkgname = getname(depend, suffix)
+ if not pkgname in rreclist and packaged(pkgname, d):
+ rreclist.append(pkgname)
+ #bb.note('setting: RRECOMMENDS_%s=%s' % (pkg, ' '.join(rreclist)))
bb.data.setVar('RRECOMMENDS_%s' % pkg, ' '.join(rreclist), d)
- def packaged(pkg, d):
- return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK)
+ def add_dep(list, dep):
+ dep = dep.split(' (')[0].strip()
+ if dep not in list:
+ list.append(dep)
+
+ rdepends = []
+ for dep in explode_deps(bb.data.getVar('RDEPENDS', d, 1) or ""):
+ add_dep(rdepends, dep)
for pkg in packages.split():
- for postfix in postfixes:
- def func(list, name):
- pkg = '%s%s' % (name, postfix)
- if not pkg in list:
- if packaged(pkg, d):
- list.append(pkg)
+ for dep in explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 1) or ""):
+ add_dep(rdepends, dep)
+
+ #bb.note('rdepends is %s' % rdepends)
- base = pkg[:-len(postfix)]
+ def post_getname(name, suffix):
+ return '%s%s' % (name, suffix)
+ def pre_getname(name, suffix):
+ return '%s%s' % (suffix, name)
+
+ pkgs = {}
+ for pkg in packages.split():
+ for postfix in postfixes:
if pkg.endswith(postfix):
- pkg_addrrecs(pkg, base, func, d)
- continue
+ if not postfix in pkgs:
+ pkgs[postfix] = {}
+ pkgs[postfix][pkg] = (pkg[:-len(postfix)], post_getname)
for prefix in prefixes:
- def func(list, name):
- pkg = '%s%s' % (prefix, name)
- if not pkg in list:
- if packaged(pkg, d):
- list.append(pkg)
-
- base = pkg[len(prefix):]
if pkg.startswith(prefix):
- pkg_addrrecs(pkg, base, func, d)
+ if not prefix in pkgs:
+ pkgs[prefix] = {}
+ pkgs[prefix][pkg] = (pkg[:-len(prefix)], pre_getname)
+
+ for suffix in pkgs:
+ for pkg in pkgs[suffix]:
+ (base, func) = pkgs[suffix][pkg]
+ if len(pkgs[suffix]) == 1:
+ pkg_addrrecs(pkg, base, suffix, func, rdepends, d)
+ else:
+ rdeps = []
+ for dep in explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or ""):
+ add_dep(rdeps, dep)
+ pkg_addrrecs(pkg, base, suffix, func, rdeps, d)
}