]> code.ossystems Code Review - openembedded-core.git/commitdiff
package.bbclass: Improve recommends dependency code to catch all dependencies for...
authorRichard Purdie <richard@openedhand.com>
Thu, 29 Mar 2007 09:49:07 +0000 (09:49 +0000)
committerRichard Purdie <richard@openedhand.com>
Thu, 29 Mar 2007 09:49:07 +0000 (09:49 +0000)
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1409 311d38ba-8fff-0310-9ca6-ca027cbcb966

meta/classes/package.bbclass

index 415eb326c0368f6123dbc1c50c9c8ed2eaaf40ea..21fe94e94e91fe52ed0c970fbd88fdb7f17411d8 100644 (file)
@@ -805,44 +805,51 @@ python package_depchains() {
        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, getname, rdepends, d):
+               def packaged(pkg, d):
+                       return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK)
+
                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)
+                       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 dep in explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 1) or ""):
+                       add_dep(rdepends, dep)
+
+       #bb.note('rdepends is %s' % rdepends)
 
        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)
+                       def getname(name):
+                               return '%s%s' % (name, postfix)
 
                        base = pkg[:-len(postfix)]
                        if pkg.endswith(postfix):
-                               pkg_addrrecs(pkg, base, func, d)
-                               continue
+                               pkg_addrrecs(pkg, base, getname, rdepends, d)
 
                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)
+                       def getname(name):
+                               return '%s%s' % (prefix, name)
 
                        base = pkg[len(prefix):]
                        if pkg.startswith(prefix):
-                               pkg_addrrecs(pkg, base, func, d)
+                               pkg_addrrecs(pkg, base, getname, rdepends, d)
 }