summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorAndres Beltran <abeltran@linux.microsoft.com>2021-08-30 22:53:03 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-01 13:06:18 (GMT)
commit157462fc2a5b086ec154a65f91512d340c1e83d5 (patch)
treea6748476d1476dde0e551c9db331526988dcd776 /meta/lib
parent39b4f7efa9c635a7809dfab79a299d510f425aaf (diff)
downloadpoky-157462fc2a5b086ec154a65f91512d340c1e83d5.tar.gz
buildhistory: Label packages providing per-file dependencies in depends.dot
Currently, depends.dot includes per-file dependencies but not the packages providing those files. This makes it hard to obtain all package dependencies by just looking at depends.dot. Parse the RPROVIDES and FILERPROVIDES fields from pkgdata to map each of their values to the package providing the component. Include runtime packages as dependencies in depends.dot, together with the component provided by the package as a label. (From OE-Core rev: 2ba33093017574bbe29eeba699eb90628614d03a) Signed-off-by: Andres Beltran <abeltran@linux.microsoft.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/utils.py32
1 files changed, 30 insertions, 2 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index a84039f..238af31 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -344,7 +344,29 @@ def squashspaces(string):
344 import re 344 import re
345 return re.sub(r"\s+", " ", string).strip() 345 return re.sub(r"\s+", " ", string).strip()
346 346
347def format_pkg_list(pkg_dict, ret_format=None): 347def rprovides_map(pkgdata_dir, pkg_dict):
348 # Map file -> pkg provider
349 rprov_map = {}
350
351 for pkg in pkg_dict:
352 path_to_pkgfile = os.path.join(pkgdata_dir, 'runtime-reverse', pkg)
353 if not os.path.isfile(path_to_pkgfile):
354 continue
355 with open(path_to_pkgfile) as f:
356 for line in f:
357 if line.startswith('RPROVIDES') or line.startswith('FILERPROVIDES'):
358 # List all components provided by pkg.
359 # Exclude version strings, i.e. those starting with (
360 provides = [x for x in line.split()[1:] if not x.startswith('(')]
361 for prov in provides:
362 if prov in rprov_map:
363 rprov_map[prov].append(pkg)
364 else:
365 rprov_map[prov] = [pkg]
366
367 return rprov_map
368
369def format_pkg_list(pkg_dict, ret_format=None, pkgdata_dir=None):
348 output = [] 370 output = []
349 371
350 if ret_format == "arch": 372 if ret_format == "arch":
@@ -357,9 +379,15 @@ def format_pkg_list(pkg_dict, ret_format=None):
357 for pkg in sorted(pkg_dict): 379 for pkg in sorted(pkg_dict):
358 output.append("%s %s %s" % (pkg, pkg_dict[pkg]["arch"], pkg_dict[pkg]["ver"])) 380 output.append("%s %s %s" % (pkg, pkg_dict[pkg]["arch"], pkg_dict[pkg]["ver"]))
359 elif ret_format == "deps": 381 elif ret_format == "deps":
382 rprov_map = rprovides_map(pkgdata_dir, pkg_dict)
360 for pkg in sorted(pkg_dict): 383 for pkg in sorted(pkg_dict):
361 for dep in pkg_dict[pkg]["deps"]: 384 for dep in pkg_dict[pkg]["deps"]:
362 output.append("%s|%s" % (pkg, dep)) 385 if dep in rprov_map:
386 # There could be multiple providers within the image
387 for pkg_provider in rprov_map[dep]:
388 output.append("%s|%s * %s [RPROVIDES]" % (pkg, pkg_provider, dep))
389 else:
390 output.append("%s|%s" % (pkg, dep))
363 else: 391 else:
364 for pkg in sorted(pkg_dict): 392 for pkg in sorted(pkg_dict):
365 output.append(pkg) 393 output.append(pkg)