[OE-core] [PATCH] Modify buildstats to be merged inside buildhistory

Corneliu Stoicescu corneliux.stoicescu at intel.com
Fri Nov 1 18:03:48 UTC 2013


- added buildstats inheritance inside buildhistory
- reworked the buildstats directory structure not to contain the build name(read: the build start date).
Now it only contains the target name and machine. This is usefull in order to reduce git noise.
- because builds are no longer separated by build name(read: date) it is necessary to remake(remove and create from scratch)
the buildstats folder for each build in order keep buildstats compatible with tools like pybootchartgui.py

Some changes to make the new functionality compatible with Yocto:
- remove buildstats from default usage because it now needs buildhistory (remove it from USER_CLASSES in local.conf)
- add 'buildhistory' to USER_CLASSES or add INHERIT += "buildhistory" in local.conf
OPTIONAL: - I tested this patch with buildhistory under git enabled (BUILDHISTORY_COMMIT = "1" in local.conf). I believe this
should be made default.

I made some tests with the buildhistory-diff tool and it is compatible with the changes. We can add further functionality
to it in order to make it interpret buildstats data.

Signed-off-by: Corneliu Stoicescu <corneliux.stoicescu at intel.com>
---
 meta/classes/buildhistory.bbclass |    1 +
 meta/classes/buildstats.bbclass   |    8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 3da03c8..a78bd4b 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -19,6 +19,7 @@ BUILDHISTORY_PUSH_REPO ?= ""
 
 # Must inherit package first before changing PACKAGEFUNCS
 inherit package
+inherit buildstats
 PACKAGEFUNCS += "buildhistory_emit_pkghistory"
 
 # We don't want to force a rerun of do_package for everything
diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index 72fff11..476ae94 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -1,4 +1,4 @@
-BUILDSTATS_BASE = "${TMPDIR}/buildstats/"
+BUILDSTATS_BASE = "${BUILDHISTORY_DIR}/buildstats"
 BNFILE = "${BUILDSTATS_BASE}/.buildname"
 DEVFILE = "${BUILDSTATS_BASE}/.device"
 
@@ -33,7 +33,7 @@ def set_bn(e):
 
 def get_bn(e):
     with open(e.data.getVar('BNFILE', True)) as f:
-        bn = f.readline()
+        bn = str(f.readline()).split("/")[0]
     return bn
 
 def set_device(e):
@@ -175,6 +175,10 @@ python run_buildstats () {
         # set the buildname
         ########################################################################
         try:
+            bb.utils.remove(e.data.getVar('BUILDSTATS_BASE', True), recurse=True)
+        except:
+            pass
+        try:
             bb.utils.mkdirhier(e.data.getVar('BUILDSTATS_BASE', True))
         except:
             pass
-- 
1.7.9.5




More information about the Openembedded-core mailing list