summaryrefslogtreecommitdiffstats
path: root/meta/classes/buildstats.bbclass
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:51:19 +0100
commit952a47b42cb3696db2896ac53b5246802bba0f59 (patch)
tree6bfb93be110ba70b8dc6f88a1947c15496b707b4 /meta/classes/buildstats.bbclass
parent74f30e91bca1f6af3bef0ff9e652c0591013b412 (diff)
downloadpoky-952a47b42cb3696db2896ac53b5246802bba0f59.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. (From OE-Core rev: b4929542ff01a24bea5edd1c40e3174f55e213ff) Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/buildstats.bbclass')
-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 () {
163 bs = os.path.join(bsdir, "build_stats") 163 bs = os.path.join(bsdir, "build_stats")
164 with open(bs, "a") as f: 164 with open(bs, "a") as f:
165 rootfs = d.getVar('IMAGE_ROOTFS', True) 165 rootfs = d.getVar('IMAGE_ROOTFS', True)
166 try: 166 if os.path.isdir(rootfs):
167 rootfs_size = subprocess.check_output(["du", "-sh", rootfs], 167 try:
168 stderr=subprocess.STDOUT).decode('utf-8') 168 rootfs_size = subprocess.check_output(["du", "-sh", rootfs],
169 except subprocess.CalledProcessError as e: 169 stderr=subprocess.STDOUT).decode('utf-8')
170 bb.error("Failed to get rootfs size: %s" % e.output) 170 f.write("Uncompressed Rootfs size: %s" % rootfs_size)
171 f.write("Uncompressed Rootfs size: %s" % rootfs_size) 171 except subprocess.CalledProcessError as err:
172 bb.warn("Failed to get rootfs size: %s" % err.output.decode('utf-8'))
172 173
173 elif isinstance(e, bb.build.TaskFailed): 174 elif isinstance(e, bb.build.TaskFailed):
174 # Can have a failure before TaskStarted so need to mkdir here too 175 # Can have a failure before TaskStarted so need to mkdir here too