aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorMikko Ylinen <mikko.ylinen@intel.com>2016-10-19 09:34:00 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-10-25 17:47:15 +0100
commitb4929542ff01a24bea5edd1c40e3174f55e213ff (patch)
tree93cd09d9c500524d9b036778174b125964c70ff5 /meta/classes
parent7561514454c20a86e9e126af80dcf114ccd23535 (diff)
downloadopenembedded-core-contrib-b4929542ff01a24bea5edd1c40e3174f55e213ff.tar.gz
buildstats: check IMAGE_ROOTFS exists before checking its size
After 0d6b7276003f1afabc6de683f663540327d52bdc, the exceptions are correctly checked if the rootfs size check fails. In case of a failure a build error is triggered. However, there are cases where this is known to fail (e.g., with meta-swupd the rootfs for swupd images is other than IMAGE_ROOTFS). Because of that, check IMAGE_ROOTFS exists before trying to get the size of it. Also, in case of any error catched as err, simply print out a warning. Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/buildstats.bbclass13
1 files changed, 7 insertions, 6 deletions
diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index 8c2b7b3944..599a219984 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -163,12 +163,13 @@ python run_buildstats () {
bs = os.path.join(bsdir, "build_stats")
with open(bs, "a") as f:
rootfs = d.getVar('IMAGE_ROOTFS', True)
- try:
- rootfs_size = subprocess.check_output(["du", "-sh", rootfs],
- stderr=subprocess.STDOUT).decode('utf-8')
- except subprocess.CalledProcessError as e:
- bb.error("Failed to get rootfs size: %s" % e.output)
- f.write("Uncompressed Rootfs size: %s" % rootfs_size)
+ if os.path.isdir(rootfs):
+ try:
+ rootfs_size = subprocess.check_output(["du", "-sh", rootfs],
+ stderr=subprocess.STDOUT).decode('utf-8')
+ f.write("Uncompressed Rootfs size: %s" % rootfs_size)
+ except subprocess.CalledProcessError as err:
+ bb.warn("Failed to get rootfs size: %s" % err.output.decode('utf-8'))
elif isinstance(e, bb.build.TaskFailed):
# Can have a failure before TaskStarted so need to mkdir here too