Bug 5334

Summary: PKGSIZE is reported relative to host disk space
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Alexandru Damian <alexandru.damian>
Component: coreAssignee: Paul Eggleton <bluelightning>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: bluelightning, dvhart, meta.mr.watcher, meta.watcher
Version: unspecified   
Target Milestone: 1.6   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Alexandru Damian 2013-10-10 11:13:50 UTC
== Situation ==
Getting the package size from package.bbclass yields an incorrect value.

== Current behaviour ==
PKGSIZE is a variable holding the size of a package build by package.bbclass.
Currently, the size is computed by counting the disk space taken by files on the host system, using a 'du' command. This size comes back as Kilobytes, and is a multiple of the host fs block allocation size.

== Expected output == 
When computing the size of a package, I would expect to see the size equal to sum of the files that are packaged in the said package, possibly plus space taken by metadata. The size should be in Bytes as to accurately reflect minimum space taken on target.
Comment 1 Saul Wold 2013-10-24 20:49:59 UTC
I think you are refering to IMAGESIZE which uses du -k, This could also invalid 
existing data contained in the history. PGKSIZE is using pyhton's os.lstat(), 
which is already bytes.
Comment 2 Alexandru Damian 2013-10-25 10:08:10 UTC
This is about PKGSIZE in package.bbclass, which uses 
def get_directory_size()

which executes `du -sk `.

Maybe this should be a more general bug for usage of `du` in host context ?
Comment 3 Paul Eggleton 2013-12-03 17:55:51 UTC
Fix merged to master:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=f4e91404f8722b4fb1700e4c9fe13f0dfd7ebda3
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=f4e91404f8722b4fb1700e4c9fe13f0dfd7ebda3

The fix was to drop use of "du" and instead use the sum of lstat() on each file.