summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/buildstats.bbclass6
-rw-r--r--meta/classes/spdx.bbclass11
2 files changed, 10 insertions, 7 deletions
diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index 34ecb03861..8c2b7b3944 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -163,7 +163,11 @@ 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 rootfs_size = subprocess.Popen(["du", "-sh", rootfs], stdout=subprocess.PIPE).stdout.read() 166 try:
167 rootfs_size = subprocess.check_output(["du", "-sh", rootfs],
168 stderr=subprocess.STDOUT).decode('utf-8')
169 except subprocess.CalledProcessError as e:
170 bb.error("Failed to get rootfs size: %s" % e.output)
167 f.write("Uncompressed Rootfs size: %s" % rootfs_size) 171 f.write("Uncompressed Rootfs size: %s" % rootfs_size)
168 172
169 elif isinstance(e, bb.build.TaskFailed): 173 elif isinstance(e, bb.build.TaskFailed):
diff --git a/meta/classes/spdx.bbclass b/meta/classes/spdx.bbclass
index 0c9276584c..89394d3a96 100644
--- a/meta/classes/spdx.bbclass
+++ b/meta/classes/spdx.bbclass
@@ -219,14 +219,13 @@ def hash_string(data):
219def run_fossology(foss_command, full_spdx): 219def run_fossology(foss_command, full_spdx):
220 import string, re 220 import string, re
221 import subprocess 221 import subprocess
222 222
223 p = subprocess.Popen(foss_command.split(), 223 try:
224 stdout=subprocess.PIPE, stderr=subprocess.PIPE) 224 foss_output = subprocess.check_output(foss_command.split(),
225 foss_output, foss_error = p.communicate() 225 stderr=subprocess.STDOUT).decode('utf-8')
226 if p.returncode != 0: 226 except subprocess.CalledProcessError as e:
227 return None 227 return None
228 228
229 foss_output = unicode(foss_output, "utf-8")
230 foss_output = string.replace(foss_output, '\r', '') 229 foss_output = string.replace(foss_output, '\r', '')
231 230
232 # Package info 231 # Package info