summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2014-09-08 12:58:21 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-09-10 11:33:22 +0100
commit60bfdb0f1945ac7da4522b8f411ab62f0c44e18d (patch)
treefd1e084656cbd3b4f04fc9ee6a57690d71e14446 /meta/classes
parente7a78bdc9715ed82541d5b8308d5cc4656ce58dd (diff)
downloadpoky-60bfdb0f1945ac7da4522b8f411ab62f0c44e18d.tar.gz
insane.bbclass: add QA check: file-rdeps
The ipk or deb can't depend on file such as "/bin/bash" or "/usr/bin/perl", so it knows nothing about the pkg depends bash or perl, thus there would be dependencies problems when we run "apt-get install/remove <pkg>" on the target, this check can help us find the issues and then fix them manually. * Benefits: - Help to fix file rdepends issues for ipk and deb - Help to fix abnormal rdepends. - Help to check whether the rdepends is OK or not after build each recipe (don't have to install to the image), for example, a recipe may generate 10 binary packages, only a part of them will be installed to the image by default, we can know whether the rdepends are OK or not for the ones which are installed, but can't know the ones which are not installed, this patch can help check all the 10 binary packages' rdepends. * Basic designs: - Get all the RDEPENDS on the chain. - Get the pkg's FILERPROVIDES from oe.packagedata.read_subpkgdata() and save to set filerdepends. - Get each RPDEPENDS' FILERPROVIDES, RPROVIDES and FILERPROVIDESFLIST, and save to set rdep_rprovides. - Do the set "filerdepends -= rdep_rprovides" and QA issue if filerdepends is not null. [YOCTO #1662] (From OE-Core rev: cd5e0f01cdb4e7c759c01cf3f87952a20253737c) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/insane.bbclass72
1 files changed, 71 insertions, 1 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 3dd2e7fb6a..c6dea22618 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -29,7 +29,7 @@ QA_SANE = "True"
29WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \ 29WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
30 textrel already-stripped incompatible-license files-invalid \ 30 textrel already-stripped incompatible-license files-invalid \
31 installed-vs-shipped compile-host-path install-host-path \ 31 installed-vs-shipped compile-host-path install-host-path \
32 pn-overrides infodir build-deps \ 32 pn-overrides infodir build-deps file-rdeps \
33 " 33 "
34ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ 34ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
35 perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ 35 perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -797,6 +797,76 @@ def package_qa_check_rdepends(pkg, pkgdest, skip, taskdeps, packages, d):
797 error_msg = "%s rdepends on %s, but it isn't a build dependency?" % (pkg, rdepend) 797 error_msg = "%s rdepends on %s, but it isn't a build dependency?" % (pkg, rdepend)
798 sane = package_qa_handle_error("build-deps", error_msg, d) 798 sane = package_qa_handle_error("build-deps", error_msg, d)
799 799
800 if "file-rdeps" not in skip:
801 ignored_file_rdeps = set(['/bin/sh', '/usr/bin/env', 'rtld(GNU_HASH)'])
802 if bb.data.inherits_class('nativesdk', d):
803 ignored_file_rdeps |= set(['/bin/bash', '/usr/bin/perl'])
804 # For Saving the FILERDEPENDS
805 filerdepends = set()
806 rdep_data = oe.packagedata.read_subpkgdata(pkg, d)
807 for key in rdep_data:
808 if key.startswith("FILERDEPENDS_"):
809 for subkey in rdep_data[key].split():
810 filerdepends.add(subkey)
811 filerdepends -= ignored_file_rdeps
812
813 if filerdepends:
814 next = rdepends
815 done = rdepends[:]
816 # Find all the rdepends on the dependency chain
817 while next:
818 new = []
819 for rdep in next:
820 rdep_data = oe.packagedata.read_subpkgdata(rdep, d)
821 sub_rdeps = rdep_data.get("RDEPENDS_" + rdep)
822 if not sub_rdeps:
823 continue
824 for sub_rdep in sub_rdeps.split():
825 if sub_rdep in done:
826 continue
827 if not sub_rdep.startswith('(') and \
828 oe.packagedata.has_subpkgdata(sub_rdep, d):
829 # It's a new rdep
830 done.append(sub_rdep)
831 new.append(sub_rdep)
832 next = new
833
834 # Add the rprovides of itself
835 if pkg not in done:
836 done.insert(0, pkg)
837
838 # The python is not a package, but python-core provides it, so
839 # skip checking /usr/bin/python if python is in the rdeps, in
840 # case there is a RDEPENDS_pkg = "python" in the recipe.
841 for py in [ d.getVar('MLPREFIX', True) + "python", "python" ]:
842 if py in done:
843 filerdepends.discard("/usr/bin/python")
844 done.remove(py)
845 for rdep in done:
846 # For Saving the FILERPROVIDES, RPROVIDES and FILES_INFO
847 rdep_rprovides = set()
848 rdep_data = oe.packagedata.read_subpkgdata(rdep, d)
849 for key in rdep_data:
850 if key.startswith("FILERPROVIDES_") or key.startswith("RPROVIDES_"):
851 for subkey in rdep_data[key].split():
852 rdep_rprovides.add(subkey)
853 # Add the files list to the rprovides
854 if key == "FILES_INFO":
855 # Use eval() to make it as a dict
856 for subkey in eval(rdep_data[key]):
857 rdep_rprovides.add(subkey)
858 filerdepends -= rdep_rprovides
859 if not filerdepends:
860 # Break if all the file rdepends are met
861 break
862 else:
863 # Clear it for the next loop
864 rdep_rprovides.clear()
865 if filerdepends:
866 error_msg = "%s requires %s, but no providers in its RDEPENDS" % \
867 (pkg, ', '.join(str(e) for e in filerdepends))
868 sane = package_qa_handle_error("file-rdeps", error_msg, d)
869
800 return sane 870 return sane
801 871
802def package_qa_check_deps(pkg, pkgdest, skip, d): 872def package_qa_check_deps(pkg, pkgdest, skip, d):