package.bbclass: set package size into pkgdata for hob2's use
Write the size of a package into its pkgdata for hob2 to get the size and show on the UI for image making. (From OE-Core rev: 9c446d007957dab36ee2c012f0a5b22494a7a84f) Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
f378918c79
commit
9531161d40
|
@ -1065,6 +1065,13 @@ python emit_pkgdata() {
|
|||
f.write('%s: %s\n' % (var, encode(val)))
|
||||
return
|
||||
|
||||
def get_directory_size(dir):
|
||||
if os.listdir(dir):
|
||||
size = int(os.popen('du -sk %s' % dir).readlines()[0].split('\t')[0])
|
||||
else:
|
||||
size = 0
|
||||
return size
|
||||
|
||||
packages = d.getVar('PACKAGES', True)
|
||||
pkgdest = d.getVar('PKGDEST', 1)
|
||||
pkgdatadir = d.getVar('PKGDESTWORK', True)
|
||||
|
@ -1113,6 +1120,7 @@ python emit_pkgdata() {
|
|||
for dfile in (d.getVar('FILERDEPENDSFLIST_' + pkg, True) or "").split():
|
||||
write_if_exists(sf, pkg, 'FILERDEPENDS_' + dfile)
|
||||
|
||||
sf.write('%s_%s: %s\n' % ('PKGSIZE', pkg, get_directory_size(pkgdest + "/%s" % pkg)))
|
||||
sf.close()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue