diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2013-05-12 06:46:10 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-06-07 16:48:27 +0100 |
commit | 829d6bf005882137aeea397fa1896285a17bee72 (patch) | |
tree | 21a66fac08c175b2f86110b231195ee73bb0f6eb /meta/classes/insane.bbclass | |
parent | b4371dd0e41713979b59875fff8d8724761b69d1 (diff) | |
download | poky-829d6bf005882137aeea397fa1896285a17bee72.tar.gz |
insane/package: refactor packaging sanity tests
Refactor packaging sanity tests from package.bbclass to insane.bbclass
so that the message can respect WARN_QA (print the warning message and
go on the task) and ERROR_QA (print the error message and fail the
task).
- For the bb.warn(), give it a message name and add it to WARN_QA, then
use package_qa_handle_error() to handle it.
- For the bb.error(), give it a message name and add it to ERROR_QA,
then use package_qa_handle_error() to handle it.
- All the bb.warn() and bb.error() have been replaced in
package.bbclass.
- A few bb.warn() and bb.error() in insane.bbclass have been kept since
they can not be replaced or doesn't have to, for example the
bb.error() in package_qa_check_license(), it will print the error
message and then invoke bb.fatal() to fail the task, I think that we
don't have to replace it with package_qa_handle_error().
- Put all the WARN_QA and ERROR_QA in one line, so that they can be
redefined by the user easily.
[YOCTO #3190]
[YOCTO #4396]
(From OE-Core rev: 2f117ee615b703db07d3274ac592e2bd653743dd)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/insane.bbclass')
-rw-r--r-- | meta/classes/insane.bbclass | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index ee57721634..c0910057f7 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
@@ -27,6 +27,20 @@ QADEPENDS_class-native = "" | |||
27 | QADEPENDS_class-nativesdk = "" | 27 | QADEPENDS_class-nativesdk = "" |
28 | QA_SANE = "True" | 28 | QA_SANE = "True" |
29 | 29 | ||
30 | # Elect whether a given type of error is a warning or error, they may | ||
31 | # have been set by other files. | ||
32 | WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \ | ||
33 | textrel already-stripped incompatible-license files-invalid \ | ||
34 | installed-vs-shipped compile-host-path install-host-path \ | ||
35 | pn-overrides \ | ||
36 | " | ||
37 | ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la \ | ||
38 | perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ | ||
39 | split-strip packages-list pkgv-undefined var-undefined \ | ||
40 | " | ||
41 | |||
42 | ALL_QA = "${WARN_QA} ${ERROR_QA}" | ||
43 | |||
30 | # | 44 | # |
31 | # dictionary for elf headers | 45 | # dictionary for elf headers |
32 | # | 46 | # |
@@ -111,12 +125,6 @@ def package_qa_get_machine_dict(): | |||
111 | } | 125 | } |
112 | 126 | ||
113 | 127 | ||
114 | # Currently not being used by default "desktop" | ||
115 | WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi textrel" | ||
116 | ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms dep-cmp pkgvarcheck" | ||
117 | |||
118 | ALL_QA = "${WARN_QA} ${ERROR_QA}" | ||
119 | |||
120 | def package_qa_clean_path(path,d): | 128 | def package_qa_clean_path(path,d): |
121 | """ Remove the common prefix from the path. In this case it is the TMPDIR""" | 129 | """ Remove the common prefix from the path. In this case it is the TMPDIR""" |
122 | return path.replace(d.getVar('TMPDIR',True),"") | 130 | return path.replace(d.getVar('TMPDIR',True),"") |
@@ -757,8 +765,9 @@ python do_package_qa () { | |||
757 | if os.path.exists(compilelog): | 765 | if os.path.exists(compilelog): |
758 | statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % compilelog | 766 | statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % compilelog |
759 | if subprocess.call(statement, shell=True) == 0: | 767 | if subprocess.call(statement, shell=True) == 0: |
760 | bb.warn("%s: The compile log indicates that host include and/or library paths were used.\n \ | 768 | msg = "%s: The compile log indicates that host include and/or library paths were used.\n \ |
761 | Please check the log '%s' for more information." % (pkg, compilelog)) | 769 | Please check the log '%s' for more information." % (pkg, compilelog) |
770 | package_qa_handle_error("compile-host-path", msg, d) | ||
762 | 771 | ||
763 | # Check the install log for host contamination | 772 | # Check the install log for host contamination |
764 | installlog = os.path.join(logdir,"log.do_install") | 773 | installlog = os.path.join(logdir,"log.do_install") |
@@ -766,8 +775,9 @@ python do_package_qa () { | |||
766 | if os.path.exists(installlog): | 775 | if os.path.exists(installlog): |
767 | statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % installlog | 776 | statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % installlog |
768 | if subprocess.call(statement, shell=True) == 0: | 777 | if subprocess.call(statement, shell=True) == 0: |
769 | bb.warn("%s: The install log indicates that host include and/or library paths were used.\n \ | 778 | msg = "%s: The install log indicates that host include and/or library paths were used.\n \ |
770 | Please check the log '%s' for more information." % (pkg, installlog)) | 779 | Please check the log '%s' for more information." % (pkg, installlog) |
780 | package_qa_handle_error("install-host-path", msg, d) | ||
771 | 781 | ||
772 | # Scan the packages... | 782 | # Scan the packages... |
773 | pkgdest = d.getVar('PKGDEST', True) | 783 | pkgdest = d.getVar('PKGDEST', True) |
@@ -911,7 +921,8 @@ python () { | |||
911 | overrides = d.getVar('OVERRIDES', True).split(':') | 921 | overrides = d.getVar('OVERRIDES', True).split(':') |
912 | pn = d.getVar('PN', True) | 922 | pn = d.getVar('PN', True) |
913 | if pn in overrides: | 923 | if pn in overrides: |
914 | bb.warn('Recipe %s has PN of "%s" which is in OVERRIDES, this can result in unexpected behaviour.' % (d.getVar("FILE", True), pn)) | 924 | msg = 'Recipe %s has PN of "%s" which is in OVERRIDES, this can result in unexpected behaviour.' % (d.getVar("FILE", True), pn) |
925 | package_qa_handle_error("pn-overrides", msg, d) | ||
915 | 926 | ||
916 | issues = [] | 927 | issues = [] |
917 | if (d.getVar('PACKAGES', True) or "").split(): | 928 | if (d.getVar('PACKAGES', True) or "").split(): |