diff options
author | Shane Wang <shane.wang@intel.com> | 2012-02-23 21:48:06 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-02-24 00:39:09 +0000 |
commit | 9531161d40cd50c69e1ae390f073fba61aaa26f9 (patch) | |
tree | b8f032f5d40b73b209bdc86ceedada616cdff362 /meta/classes/package.bbclass | |
parent | f378918c796bf09105f76ceeaa0cb55f7adad66f (diff) | |
download | poky-9531161d40cd50c69e1ae390f073fba61aaa26f9.tar.gz |
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>
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r-- | meta/classes/package.bbclass | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index b579e50a32..266173cdf2 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -1065,6 +1065,13 @@ python emit_pkgdata() { | |||
1065 | f.write('%s: %s\n' % (var, encode(val))) | 1065 | f.write('%s: %s\n' % (var, encode(val))) |
1066 | return | 1066 | return |
1067 | 1067 | ||
1068 | def get_directory_size(dir): | ||
1069 | if os.listdir(dir): | ||
1070 | size = int(os.popen('du -sk %s' % dir).readlines()[0].split('\t')[0]) | ||
1071 | else: | ||
1072 | size = 0 | ||
1073 | return size | ||
1074 | |||
1068 | packages = d.getVar('PACKAGES', True) | 1075 | packages = d.getVar('PACKAGES', True) |
1069 | pkgdest = d.getVar('PKGDEST', 1) | 1076 | pkgdest = d.getVar('PKGDEST', 1) |
1070 | pkgdatadir = d.getVar('PKGDESTWORK', True) | 1077 | pkgdatadir = d.getVar('PKGDESTWORK', True) |
@@ -1113,6 +1120,7 @@ python emit_pkgdata() { | |||
1113 | for dfile in (d.getVar('FILERDEPENDSFLIST_' + pkg, True) or "").split(): | 1120 | for dfile in (d.getVar('FILERDEPENDSFLIST_' + pkg, True) or "").split(): |
1114 | write_if_exists(sf, pkg, 'FILERDEPENDS_' + dfile) | 1121 | write_if_exists(sf, pkg, 'FILERDEPENDS_' + dfile) |
1115 | 1122 | ||
1123 | sf.write('%s_%s: %s\n' % ('PKGSIZE', pkg, get_directory_size(pkgdest + "/%s" % pkg))) | ||
1116 | sf.close() | 1124 | sf.close() |
1117 | 1125 | ||
1118 | 1126 | ||