[yocto] [PATCH 3/7] Added error message when buildhistory not active

Marius Avram marius.avram at intel.com
Wed Aug 13 06:32:04 PDT 2014


A graceful close of the script happens when it tries to do
a buildhistory-diff but the bbclass is not inherited. Also
a helping message is presented to the user to avoid the
error at a next run.

Signed-off-by: Marius Avram <marius.avram at intel.com>
---
 bitbake.py |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/bitbake.py b/bitbake.py
index 2207634..3631896 100644
--- a/bitbake.py
+++ b/bitbake.py
@@ -27,6 +27,7 @@ import logging as log
 from logging import info as I
 from logging import debug as D
 from logging import error as E
+from logging import critical as C
 import sys
 from errors import *
 
@@ -115,13 +116,20 @@ class BuildHistory(object):
         try:
             stdout, stderr = bb.process.run(cmd)
             # Write diff output to log file if there is any
+
             if stdout and os.path.exists(self.work_dir):
                 with open(os.path.join(self.work_dir, "buildhistory.txt"), "w+") as log:
                     log.write(stdout)
                 return True
         except bb.process.ExecutionError as e:
-            D("%s returned:\n%s" % (cmd, e.__str__()))
-            raise Error("\'" + cmd + "\' failed", e.stdout, e.stderr)
+            for line in e.stdout.split('\n'):
+                if line.find("Buildhistory directory \"buildhistory/\" does not exist") == 0:
+                    C(" \"buildhistory.bbclass\" not inherited. Consider adding "
+                      "the following to your local.conf:\n\n"
+                      "INHERIT =+ \"buildhistory\"\n"
+                      "BUILDHISTORY_COMMIT = \"1\"\n\n"
+                      "Do not remove any other inherited class in the process (e.g. distrodata)\n")
+                    exit(1)
 
         return False
 
-- 
1.7.9.5




More information about the yocto mailing list