[gnome-continuous-yocto/gnomeostree-3.28-rocko: 6262/8267] lib/oe/sdk: Adds get_extra_sdk_info to reuse code in buildhistory
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 6262/8267] lib/oe/sdk: Adds get_extra_sdk_info to reuse code in buildhistory
- Date: Sun, 17 Dec 2017 04:35:53 +0000 (UTC)
commit 08a4705af9cc677b32fd6489e67f86f7e9d6e92c
Author: Francisco Pedraza <francisco j pedraza gonzalez intel com>
Date: Fri Jun 9 12:01:25 2017 -0500
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>
meta/classes/buildhistory.bbclass | 18 ++++++------------
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 c26dffc..779a1a6 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 deb823b..1c5409e 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]