From db9cf430e54ae68da80fbc3fba80ce88d8df164d Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Wed, 1 Sep 2021 08:44:40 -0500 Subject: classes/package: Add extended packaged data Adds extended package data which is encoded as JSON which allows it to encode more structure than the "flat" package data files. The extended data might be much larger than the standard package data, so it is not read by default and instead requires oe.packagedata.read_subpkgdata_extended() to be called Currently, the file sizes and ELF debug sources are saved off into the extended package data Signed-off-by: Joshua Watt Reviewed-by: Saul Wold Signed-off-by: Joshua Watt Signed-off-by: Richard Purdie --- meta/lib/oe/packagedata.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'meta/lib') diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py index 0b17897e40..02c81e5a52 100644 --- a/meta/lib/oe/packagedata.py +++ b/meta/lib/oe/packagedata.py @@ -57,6 +57,18 @@ def read_subpkgdata_dict(pkg, d): ret[newvar] = subd[var] return ret +def read_subpkgdata_extended(pkg, d): + import json + import bb.compress.zstd + + fn = d.expand("${PKGDATA_DIR}/extended/%s.json.zstd" % pkg) + try: + num_threads = int(d.getVar("BB_NUMBER_THREADS")) + with bb.compress.zstd.open(fn, "rt", encoding="utf-8", num_threads=num_threads) as f: + return json.load(f) + except FileNotFoundError: + return None + def _pkgmap(d): """Return a dictionary mapping package to recipe name.""" -- cgit 1.2.3-korg