diff options
author | Ross Burton <ross.burton@intel.com> | 2021-03-23 16:37:22 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-03-28 22:28:26 +0100 |
commit | f7ed81182c7797fd6b0069fa5c90535b13848657 (patch) | |
tree | 1966387838566126fbaa9747e022964c2cd25304 /meta/classes | |
parent | 3743234dab23e4068e1d1fde9e1fa0bc09fdb182 (diff) | |
download | poky-f7ed81182c7797fd6b0069fa5c90535b13848657.tar.gz |
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.
(From OE-Core rev: d8f1f3a6b024a2ae6631d1ce25421e8d94b69a12)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/image.bbclass | 6 |
1 files 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 () { | |||
507 | # Compute the rootfs size | 507 | # Compute the rootfs size |
508 | # | 508 | # |
509 | def get_rootfs_size(d): | 509 | def get_rootfs_size(d): |
510 | import subprocess | 510 | import subprocess, oe.utils |
511 | 511 | ||
512 | rootfs_alignment = int(d.getVar('IMAGE_ROOTFS_ALIGNMENT')) | 512 | rootfs_alignment = int(d.getVar('IMAGE_ROOTFS_ALIGNMENT')) |
513 | overhead_factor = float(d.getVar('IMAGE_OVERHEAD_FACTOR')) | 513 | overhead_factor = float(d.getVar('IMAGE_OVERHEAD_FACTOR')) |
@@ -518,9 +518,7 @@ def get_rootfs_size(d): | |||
518 | initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES') or '' | 518 | initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES') or '' |
519 | initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE') | 519 | initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE') |
520 | 520 | ||
521 | output = subprocess.check_output(['du', '-ks', | 521 | size_kb = oe.utils.directory_size(d.getVar("IMAGE_ROOTFS")) / 1024 |
522 | d.getVar('IMAGE_ROOTFS')]) | ||
523 | size_kb = int(output.split()[0]) | ||
524 | 522 | ||
525 | base_size = size_kb * overhead_factor | 523 | base_size = size_kb * overhead_factor |
526 | bb.debug(1, '%f = %d * %f' % (base_size, size_kb, overhead_factor)) | 524 | bb.debug(1, '%f = %d * %f' % (base_size, size_kb, overhead_factor)) |