From: Ross Burton <ross.bur...@intel.com>

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 <ross.bur...@intel.com>
---
 meta/classes/image.bbclass | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

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))
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#149833): 
https://lists.openembedded.org/g/openembedded-core/message/149833
Mute This Topic: https://lists.openembedded.org/mt/81555348/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to