summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-15 12:44:10 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-19 17:24:46 +0000
commitdd286953208489f8c9c5d02de06dbd75709b01a5 (patch)
tree2250fee6cb70a8bbfcddf44748a72497182403c0 /meta/classes
parent839fb1893546ad58a1f5475a9e852b81afb056d6 (diff)
downloadpoky-dd286953208489f8c9c5d02de06dbd75709b01a5.tar.gz
insane: Clean up horrible return value processing code
Whilst in theory return values are nice, handling the complex aggregation of the return values is ugly. The code already uses QA_SANE as a marker to signal problems. Whilst that isn't as idealistic, it makes the code massively cleaner, so rely on this instead. (From OE-Core rev: ebee3caeaa18daf4974ea90e264d64467681f57a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/insane.bbclass55
1 files changed, 16 insertions, 39 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index ba9c6511fd..70d5fb828d 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -779,15 +779,12 @@ def package_qa_walk(path, warnfuncs, errorfuncs, skip, package, d):
779 for e in errors: 779 for e in errors:
780 package_qa_handle_error(e, errors[e], d) 780 package_qa_handle_error(e, errors[e], d)
781 781
782 return len(errors) == 0
783
784def package_qa_check_rdepends(pkg, pkgdest, skip, taskdeps, packages, d): 782def package_qa_check_rdepends(pkg, pkgdest, skip, taskdeps, packages, d):
785 # Don't do this check for kernel/module recipes, there aren't too many debug/development 783 # Don't do this check for kernel/module recipes, there aren't too many debug/development
786 # packages and you can get false positives e.g. on kernel-module-lirc-dev 784 # packages and you can get false positives e.g. on kernel-module-lirc-dev
787 if bb.data.inherits_class("kernel", d) or bb.data.inherits_class("module-base", d): 785 if bb.data.inherits_class("kernel", d) or bb.data.inherits_class("module-base", d):
788 return True 786 return
789 787
790 sane = True
791 if not "-dbg" in pkg and not "packagegroup-" in pkg and not "-image" in pkg: 788 if not "-dbg" in pkg and not "packagegroup-" in pkg and not "-image" in pkg:
792 localdata = bb.data.createCopy(d) 789 localdata = bb.data.createCopy(d)
793 localdata.setVar('OVERRIDES', pkg) 790 localdata.setVar('OVERRIDES', pkg)
@@ -801,10 +798,10 @@ def package_qa_check_rdepends(pkg, pkgdest, skip, taskdeps, packages, d):
801 for rdepend in rdepends: 798 for rdepend in rdepends:
802 if "-dbg" in rdepend and "debug-deps" not in skip: 799 if "-dbg" in rdepend and "debug-deps" not in skip:
803 error_msg = "%s rdepends on %s" % (pkg,rdepend) 800 error_msg = "%s rdepends on %s" % (pkg,rdepend)
804 sane = package_qa_handle_error("debug-deps", error_msg, d) 801 package_qa_handle_error("debug-deps", error_msg, d)
805 if (not "-dev" in pkg and not "-staticdev" in pkg) and rdepend.endswith("-dev") and "dev-deps" not in skip: 802 if (not "-dev" in pkg and not "-staticdev" in pkg) and rdepend.endswith("-dev") and "dev-deps" not in skip:
806 error_msg = "%s rdepends on %s" % (pkg, rdepend) 803 error_msg = "%s rdepends on %s" % (pkg, rdepend)
807 sane = package_qa_handle_error("dev-deps", error_msg, d) 804 package_qa_handle_error("dev-deps", error_msg, d)
808 if rdepend not in packages: 805 if rdepend not in packages:
809 rdep_data = oe.packagedata.read_subpkgdata(rdepend, d) 806 rdep_data = oe.packagedata.read_subpkgdata(rdepend, d)
810 if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps: 807 if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
@@ -822,7 +819,7 @@ def package_qa_check_rdepends(pkg, pkgdest, skip, taskdeps, packages, d):
822 if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps: 819 if rdep_data and 'PN' in rdep_data and rdep_data['PN'] in taskdeps:
823 continue 820 continue
824 error_msg = "%s rdepends on %s, but it isn't a build dependency?" % (pkg, rdepend) 821 error_msg = "%s rdepends on %s, but it isn't a build dependency?" % (pkg, rdepend)
825 sane = package_qa_handle_error("build-deps", error_msg, d) 822 package_qa_handle_error("build-deps", error_msg, d)
826 823
827 if "file-rdeps" not in skip: 824 if "file-rdeps" not in skip:
828 ignored_file_rdeps = set(['/bin/sh', '/usr/bin/env', 'rtld(GNU_HASH)']) 825 ignored_file_rdeps = set(['/bin/sh', '/usr/bin/env', 'rtld(GNU_HASH)'])
@@ -889,19 +886,15 @@ def package_qa_check_rdepends(pkg, pkgdest, skip, taskdeps, packages, d):
889 for key in filerdepends: 886 for key in filerdepends:
890 error_msg = "%s contained in package %s requires %s, but no providers found in its RDEPENDS" % \ 887 error_msg = "%s contained in package %s requires %s, but no providers found in its RDEPENDS" % \
891 (filerdepends[key],pkg, key) 888 (filerdepends[key],pkg, key)
892 sane = package_qa_handle_error("file-rdeps", error_msg, d) 889 package_qa_handle_error("file-rdeps", error_msg, d)
893
894 return sane
895 890
896def package_qa_check_deps(pkg, pkgdest, skip, d): 891def package_qa_check_deps(pkg, pkgdest, skip, d):
897 sane = True
898 892
899 localdata = bb.data.createCopy(d) 893 localdata = bb.data.createCopy(d)
900 localdata.setVar('OVERRIDES', pkg) 894 localdata.setVar('OVERRIDES', pkg)
901 bb.data.update_data(localdata) 895 bb.data.update_data(localdata)
902 896
903 def check_valid_deps(var): 897 def check_valid_deps(var):
904 sane = True
905 try: 898 try:
906 rvar = bb.utils.explode_dep_versions2(localdata.getVar(var, True) or "") 899 rvar = bb.utils.explode_dep_versions2(localdata.getVar(var, True) or "")
907 except ValueError as e: 900 except ValueError as e:
@@ -910,24 +903,14 @@ def package_qa_check_deps(pkg, pkgdest, skip, d):
910 for v in rvar[dep]: 903 for v in rvar[dep]:
911 if v and not v.startswith(('< ', '= ', '> ', '<= ', '>=')): 904 if v and not v.startswith(('< ', '= ', '> ', '<= ', '>=')):
912 error_msg = "%s_%s is invalid: %s (%s) only comparisons <, =, >, <=, and >= are allowed" % (var, pkg, dep, v) 905 error_msg = "%s_%s is invalid: %s (%s) only comparisons <, =, >, <=, and >= are allowed" % (var, pkg, dep, v)
913 sane = package_qa_handle_error("dep-cmp", error_msg, d) 906 package_qa_handle_error("dep-cmp", error_msg, d)
914 return sane
915
916 sane = True
917 if not check_valid_deps('RDEPENDS'):
918 sane = False
919 if not check_valid_deps('RRECOMMENDS'):
920 sane = False
921 if not check_valid_deps('RSUGGESTS'):
922 sane = False
923 if not check_valid_deps('RPROVIDES'):
924 sane = False
925 if not check_valid_deps('RREPLACES'):
926 sane = False
927 if not check_valid_deps('RCONFLICTS'):
928 sane = False
929 907
930 return sane 908 check_valid_deps('RDEPENDS')
909 check_valid_deps('RRECOMMENDS')
910 check_valid_deps('RSUGGESTS')
911 check_valid_deps('RPROVIDES')
912 check_valid_deps('RREPLACES')
913 check_valid_deps('RCONFLICTS')
931 914
932QAPATHTEST[expanded-d] = "package_qa_check_expanded_d" 915QAPATHTEST[expanded-d] = "package_qa_check_expanded_d"
933def package_qa_check_expanded_d(path,name,d,elf,messages): 916def package_qa_check_expanded_d(path,name,d,elf,messages):
@@ -1072,9 +1055,6 @@ python do_package_qa () {
1072 taskdeps.add(taskdepdata[dep][0]) 1055 taskdeps.add(taskdepdata[dep][0])
1073 1056
1074 g = globals() 1057 g = globals()
1075 walk_sane = True
1076 rdepends_sane = True
1077 deps_sane = True
1078 for package in packages: 1058 for package in packages:
1079 skip = (d.getVar('INSANE_SKIP_' + package, True) or "").split() 1059 skip = (d.getVar('INSANE_SKIP_' + package, True) or "").split()
1080 if skip: 1060 if skip:
@@ -1099,19 +1079,16 @@ python do_package_qa () {
1099 "%s doesn't match the [a-z0-9.+-]+ regex" % package, d) 1079 "%s doesn't match the [a-z0-9.+-]+ regex" % package, d)
1100 1080
1101 path = "%s/%s" % (pkgdest, package) 1081 path = "%s/%s" % (pkgdest, package)
1102 if not package_qa_walk(path, warnchecks, errorchecks, skip, package, d): 1082 package_qa_walk(path, warnchecks, errorchecks, skip, package, d)
1103 walk_sane = False
1104 if not package_qa_check_rdepends(package, pkgdest, skip, taskdeps, packages, d):
1105 rdepends_sane = False
1106 if not package_qa_check_deps(package, pkgdest, skip, d):
1107 deps_sane = False
1108 1083
1084 package_qa_check_rdepends(package, pkgdest, skip, taskdeps, packages, d)
1085 package_qa_check_deps(package, pkgdest, skip, d)
1109 1086
1110 if 'libdir' in d.getVar("ALL_QA", True).split(): 1087 if 'libdir' in d.getVar("ALL_QA", True).split():
1111 package_qa_check_libdir(d) 1088 package_qa_check_libdir(d)
1112 1089
1113 qa_sane = d.getVar("QA_SANE", True) 1090 qa_sane = d.getVar("QA_SANE", True)
1114 if not walk_sane or not rdepends_sane or not deps_sane or not qa_sane: 1091 if not qa_sane:
1115 bb.fatal("QA run found fatal errors. Please consider fixing them.") 1092 bb.fatal("QA run found fatal errors. Please consider fixing them.")
1116 bb.note("DONE with PACKAGE QA") 1093 bb.note("DONE with PACKAGE QA")
1117} 1094}