diff options
-rw-r--r-- | meta/classes/package.bbclass | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 4aeb00d3ab..70313a192e 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -804,24 +804,31 @@ python read_shlibdeps () { | |||
804 | python package_depchains() { | 804 | python package_depchains() { |
805 | """ | 805 | """ |
806 | For a given set of prefix and postfix modifiers, make those packages | 806 | For a given set of prefix and postfix modifiers, make those packages |
807 | RRECOMMENDS on the corresponding packages for its DEPENDS. | 807 | RRECOMMENDS on the corresponding packages for its RDEPENDS. |
808 | 808 | ||
809 | Example: If package A depends upon package B, and A's .bb emits an | 809 | Example: If package A depends upon package B, and A's .bb emits an |
810 | A-dev package, this would make A-dev Recommends: B-dev. | 810 | A-dev package, this would make A-dev Recommends: B-dev. |
811 | |||
812 | If only one of a given suffix is specified, it will take the RRECOMMENDS | ||
813 | based on the RDEPENDS of *all* other packages. If more than one of a given | ||
814 | suffix is specified, its will only use the RDEPENDS of the single parent | ||
815 | package. | ||
811 | """ | 816 | """ |
812 | 817 | ||
813 | packages = bb.data.getVar('PACKAGES', d, 1) | 818 | packages = bb.data.getVar('PACKAGES', d, 1) |
814 | postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split() | 819 | postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split() |
815 | prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split() | 820 | prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split() |
816 | 821 | ||
817 | def pkg_addrrecs(pkg, base, getname, rdepends, d): | 822 | def pkg_addrrecs(pkg, base, suffix, getname, rdepends, d): |
818 | def packaged(pkg, d): | 823 | def packaged(pkg, d): |
819 | return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK) | 824 | return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK) |
820 | 825 | ||
826 | #bb.note('rdepends for %s is %s' % (base, rdepends)) | ||
827 | |||
821 | rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 1) or bb.data.getVar('RRECOMMENDS', d, 1) or "") | 828 | rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 1) or bb.data.getVar('RRECOMMENDS', d, 1) or "") |
822 | 829 | ||
823 | for depend in rdepends: | 830 | for depend in rdepends: |
824 | pkgname = getname(depend) | 831 | pkgname = getname(depend, suffix) |
825 | if not pkgname in rreclist and packaged(pkgname, d): | 832 | if not pkgname in rreclist and packaged(pkgname, d): |
826 | rreclist.append(pkgname) | 833 | rreclist.append(pkgname) |
827 | 834 | ||
@@ -843,22 +850,35 @@ python package_depchains() { | |||
843 | 850 | ||
844 | #bb.note('rdepends is %s' % rdepends) | 851 | #bb.note('rdepends is %s' % rdepends) |
845 | 852 | ||
853 | def post_getname(name, suffix): | ||
854 | return '%s%s' % (name, suffix) | ||
855 | def pre_getname(name, suffix): | ||
856 | return '%s%s' % (suffix, name) | ||
857 | |||
858 | pkgs = {} | ||
846 | for pkg in packages.split(): | 859 | for pkg in packages.split(): |
847 | for postfix in postfixes: | 860 | for postfix in postfixes: |
848 | def getname(name): | ||
849 | return '%s%s' % (name, postfix) | ||
850 | |||
851 | base = pkg[:-len(postfix)] | ||
852 | if pkg.endswith(postfix): | 861 | if pkg.endswith(postfix): |
853 | pkg_addrrecs(pkg, base, getname, rdepends, d) | 862 | if not postfix in pkgs: |
863 | pkgs[postfix] = {} | ||
864 | pkgs[postfix][pkg] = (pkg[:-len(postfix)], post_getname) | ||
854 | 865 | ||
855 | for prefix in prefixes: | 866 | for prefix in prefixes: |
856 | def getname(name): | ||
857 | return '%s%s' % (prefix, name) | ||
858 | |||
859 | base = pkg[len(prefix):] | ||
860 | if pkg.startswith(prefix): | 867 | if pkg.startswith(prefix): |
861 | pkg_addrrecs(pkg, base, getname, rdepends, d) | 868 | if not prefix in pkgs: |
869 | pkgs[prefix] = {} | ||
870 | pkgs[prefix][pkg] = (pkg[:-len(prefix)], pre_getname) | ||
871 | |||
872 | for suffix in pkgs: | ||
873 | for pkg in pkgs[suffix]: | ||
874 | (base, func) = pkgs[suffix][pkg] | ||
875 | if len(pkgs[suffix]) == 1: | ||
876 | pkg_addrrecs(pkg, base, suffix, func, rdepends, d) | ||
877 | else: | ||
878 | rdeps = [] | ||
879 | for dep in explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or ""): | ||
880 | add_dep(rdeps, dep) | ||
881 | pkg_addrrecs(pkg, base, suffix, func, rdeps, d) | ||
862 | } | 882 | } |
863 | 883 | ||
864 | 884 | ||