diff options
author | Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com> | 2017-06-09 12:01:25 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-12 15:21:32 +0100 |
commit | f696b3bbe01969ce7ecb8174d63d3e1e172b473e (patch) | |
tree | 99f93c9072f40bc0a48e751a839aa4e88305f880 /meta | |
parent | 7e0964e506506d20a25aac570104938759f9f70e (diff) | |
download | openembedded-core-contrib-f696b3bbe01969ce7ecb8174d63d3e1e172b473e.tar.gz |
lib/oe/sdk: Adds get_extra_sdk_info to reuse code in buildhistory
This function is going to be used for generating the target and host
manifest files packages for eSDK. Added some fixes for buildhistory.bblclass,
and docstring for get_extra_sdkinfo at oe.sdk
[YOCTO #9038]
Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com>
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/buildhistory.bbclass | 18 | ||||
-rw-r--r-- | meta/lib/oe/sdk.py | 19 |
2 files changed, 25 insertions, 12 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index c26dffc0585..779a1a67e04 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass @@ -590,25 +590,19 @@ END python buildhistory_get_extra_sdkinfo() { import operator import math + from oe.sdk import get_extra_sdkinfo + + sstate_dir = d.expand('${SDK_OUTPUT}/${SDKPATH}/sstate-cache') + extra_info = get_extra_sdkinfo(sstate_dir) if d.getVar('BB_CURRENTTASK') == 'populate_sdk_ext' and \ "sdk" in (d.getVar('BUILDHISTORY_FEATURES') or "").split(): - tasksizes = {} - filesizes = {} - for root, _, files in os.walk(d.expand('${SDK_OUTPUT}/${SDKPATH}/sstate-cache')): - for fn in files: - if fn.endswith('.tgz'): - fsize = int(math.ceil(float(os.path.getsize(os.path.join(root, fn))) / 1024)) - task = fn.rsplit(':', 1)[1].split('_', 1)[1].split('.')[0] - origtotal = tasksizes.get(task, 0) - tasksizes[task] = origtotal + fsize - filesizes[fn] = fsize with open(d.expand('${BUILDHISTORY_DIR_SDK}/sstate-package-sizes.txt'), 'w') as f: - filesizes_sorted = sorted(filesizes.items(), key=operator.itemgetter(1, 0), reverse=True) + filesizes_sorted = sorted(extra_info['filesizes'].items(), key=operator.itemgetter(1, 0), reverse=True) for fn, size in filesizes_sorted: f.write('%10d KiB %s\n' % (size, fn)) with open(d.expand('${BUILDHISTORY_DIR_SDK}/sstate-task-sizes.txt'), 'w') as f: - tasksizes_sorted = sorted(tasksizes.items(), key=operator.itemgetter(1, 0), reverse=True) + tasksizes_sorted = sorted(extra_info['tasksizes'].items(), key=operator.itemgetter(1, 0), reverse=True) for task, size in tasksizes_sorted: f.write('%10d KiB %s\n' % (size, task)) } diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py index deb823b6ec1..1c5409e7e11 100644 --- a/meta/lib/oe/sdk.py +++ b/meta/lib/oe/sdk.py @@ -372,5 +372,24 @@ def populate_sdk(d, manifest_dir=None): os.environ.clear() os.environ.update(env_bkp) +def get_extra_sdkinfo(sstate_dir): + """ + This function is going to be used for generating the target and host manifest files packages of eSDK. + """ + import math + + extra_info = {} + extra_info['tasksizes'] = {} + extra_info['filesizes'] = {} + for root, _, files in os.walk(sstate_dir): + for fn in files: + if fn.endswith('.tgz'): + fsize = int(math.ceil(float(os.path.getsize(os.path.join(root, fn))) / 1024)) + task = fn.rsplit(':',1)[1].split('_',1)[1].split(',')[0] + origtotal = extra_info['tasksizes'].get(task, 0) + extra_info['tasksizes'][task] = origtotal + fsize + extra_info['filesizes'][fn] = fsize + return extra_info + if __name__ == "__main__": pass |