mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
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] (From OE-Core rev: f696b3bbe01969ce7ecb8174d63d3e1e172b473e) 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>
This commit is contained in:
parent
246b73ad55
commit
08a4705af9
|
@ -590,25 +590,19 @@ END
|
||||||
python buildhistory_get_extra_sdkinfo() {
|
python buildhistory_get_extra_sdkinfo() {
|
||||||
import operator
|
import operator
|
||||||
import math
|
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 \
|
if d.getVar('BB_CURRENTTASK') == 'populate_sdk_ext' and \
|
||||||
"sdk" in (d.getVar('BUILDHISTORY_FEATURES') or "").split():
|
"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:
|
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:
|
for fn, size in filesizes_sorted:
|
||||||
f.write('%10d KiB %s\n' % (size, fn))
|
f.write('%10d KiB %s\n' % (size, fn))
|
||||||
with open(d.expand('${BUILDHISTORY_DIR_SDK}/sstate-task-sizes.txt'), 'w') as f:
|
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:
|
for task, size in tasksizes_sorted:
|
||||||
f.write('%10d KiB %s\n' % (size, task))
|
f.write('%10d KiB %s\n' % (size, task))
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,5 +372,24 @@ def populate_sdk(d, manifest_dir=None):
|
||||||
os.environ.clear()
|
os.environ.clear()
|
||||||
os.environ.update(env_bkp)
|
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__":
|
if __name__ == "__main__":
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user