From d8f1f3a6b024a2ae6631d1ce25421e8d94b69a12 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Tue, 23 Mar 2021 16:37:22 +0000 Subject: classes/image: use oe.utils.directory_size() instead of du Instead of using du (which has issues as disussed in the previous commit), use the new oe.utils.directory_size() function. Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/classes/image.bbclass | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'meta/classes/image.bbclass') diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index b558653635..87a58dfae7 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -507,7 +507,7 @@ python () { # Compute the rootfs size # def get_rootfs_size(d): - import subprocess + import subprocess, oe.utils rootfs_alignment = int(d.getVar('IMAGE_ROOTFS_ALIGNMENT')) overhead_factor = float(d.getVar('IMAGE_OVERHEAD_FACTOR')) @@ -518,9 +518,7 @@ def get_rootfs_size(d): initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES') or '' initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE') - output = subprocess.check_output(['du', '-ks', - d.getVar('IMAGE_ROOTFS')]) - size_kb = int(output.split()[0]) + size_kb = oe.utils.directory_size(d.getVar("IMAGE_ROOTFS")) / 1024 base_size = size_kb * overhead_factor bb.debug(1, '%f = %d * %f' % (base_size, size_kb, overhead_factor)) -- cgit 1.2.3-korg