Patchwork [1/4] insane/package: let package.bbclass inherit insane.bbclass

login
register
mail settings
Submitter Robert Yang
Date June 5, 2013, 2:14 a.m.
Message ID <ccd485e83dd4a3334d655206c4de02b96f2c2d30.1370398286.git.liezhi.yang@windriver.com>
Download mbox | patch
Permalink /patch/51145/
State New
Headers show

Comments

Robert Yang - June 5, 2013, 2:14 a.m.
RP's comment:
"What we're trying to do is move everything to use a standard mechanism
for reporting issues of this type (do_package). With insane.bbclass, you
can elect whether a given type of error is a warning or error and fails
the task."

* The package.bbclass had used package_qa_handle_error() which is from
  insane.bbclass, and we will use it for handling other warnings and
  errors, so let package.bbclass inherit insane.bbclass, this change will
  make the insane as a requirement (always included).

* Change the "PACKAGEFUNCS ?=" to "+=", otherwise there would be an
  error like:
  Exception: variable SUMMARY references itself!

  This is because we let package.bbclass inherit insane.bbclass, and
  PACKAGEFUNCS has been set in insane.bbclass, so the "PACKAGEFUNCS ?="
  will set nothing, then the "emit_pkgdata" doesn't run which will
  cause this error.

* Add a QA_SANE variable in insane.bbclass, once the error type
  is ERROR_QA, it will fail the task and stop the build.

[YOCTO #3190]
[YOCTO #4396]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes/insane.bbclass  | 6 ++++--
 meta/classes/package.bbclass | 5 ++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

Patch

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 3ed5581..ee57721 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -17,7 +17,6 @@ 
 #   files under exec_prefix
 
 
-inherit package
 PACKAGE_DEPENDS += "${QADEPENDS}"
 PACKAGEFUNCS += " do_package_qa "
 
@@ -26,6 +25,7 @@  PACKAGEFUNCS += " do_package_qa "
 QADEPENDS = "prelink-native"
 QADEPENDS_class-native = ""
 QADEPENDS_class-nativesdk = ""
+QA_SANE = "True"
 
 #
 # dictionary for elf headers
@@ -133,6 +133,7 @@  def package_qa_handle_error(error_class, error_msg, d):
     package_qa_write_error(error_msg, d)
     if error_class in (d.getVar("ERROR_QA", True) or "").split():
         bb.error("QA Issue: %s" % error_msg)
+        d.setVar("QA_SANE", False)
         return False
     else:
         bb.warn("QA Issue: %s" % error_msg)
@@ -820,7 +821,8 @@  python do_package_qa () {
     if 'libdir' in d.getVar("ALL_QA", True).split():
         package_qa_check_libdir(d)
 
-    if not walk_sane or not rdepends_sane or not deps_sane:
+    qa_sane = d.getVar("QA_SANE", True)
+    if not walk_sane or not rdepends_sane or not deps_sane or not qa_sane:
         bb.fatal("QA run found fatal errors. Please consider fixing them.")
     bb.note("DONE with PACKAGE QA")
 }
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 02a1460..f72c0e2 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -42,6 +42,9 @@  inherit packagedata
 inherit prserv
 inherit chrpath
 
+# Need the package_qa_handle_error() in insane.bbclass
+inherit insane
+
 PKGD    = "${WORKDIR}/package"
 PKGDEST = "${WORKDIR}/packages-split"
 
@@ -1813,7 +1816,7 @@  PACKAGESPLITFUNCS ?= " \
                 package_do_split_locales \
                 populate_packages"
 # Functions which process metadata based on split packages
-PACKAGEFUNCS ?= " \
+PACKAGEFUNCS += " \
                 package_fixsymlinks \
                 package_name_hook \
                 package_do_filedeps \