diff options
-rw-r--r-- | meta/classes/package.bbclass | 40 | ||||
-rw-r--r-- | meta/lib/oe/packagedata.py | 12 |
2 files changed, 49 insertions, 3 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 702427fecc..84fdafa8fe 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -1140,6 +1140,14 @@ python split_and_strip_files () { | |||
1140 | # Modified the file so clear the cache | 1140 | # Modified the file so clear the cache |
1141 | cpath.updatecache(file) | 1141 | cpath.updatecache(file) |
1142 | 1142 | ||
1143 | def strip_pkgd_prefix(f): | ||
1144 | nonlocal dvar | ||
1145 | |||
1146 | if f.startswith(dvar): | ||
1147 | return f[len(dvar):] | ||
1148 | |||
1149 | return f | ||
1150 | |||
1143 | # | 1151 | # |
1144 | # First lets process debug splitting | 1152 | # First lets process debug splitting |
1145 | # | 1153 | # |
@@ -1153,6 +1161,8 @@ python split_and_strip_files () { | |||
1153 | for file in staticlibs: | 1161 | for file in staticlibs: |
1154 | results.append( (file,source_info(file, d)) ) | 1162 | results.append( (file,source_info(file, d)) ) |
1155 | 1163 | ||
1164 | d.setVar("PKGDEBUGSOURCES", {strip_pkgd_prefix(f): sorted(s) for f, s in results}) | ||
1165 | |||
1156 | sources = set() | 1166 | sources = set() |
1157 | for r in results: | 1167 | for r in results: |
1158 | sources.update(r[1]) | 1168 | sources.update(r[1]) |
@@ -1460,6 +1470,7 @@ PKGDATA_VARS = "PN PE PV PR PKGE PKGV PKGR LICENSE DESCRIPTION SUMMARY RDEPENDS | |||
1460 | python emit_pkgdata() { | 1470 | python emit_pkgdata() { |
1461 | from glob import glob | 1471 | from glob import glob |
1462 | import json | 1472 | import json |
1473 | import bb.compress.zstd | ||
1463 | 1474 | ||
1464 | def process_postinst_on_target(pkg, mlprefix): | 1475 | def process_postinst_on_target(pkg, mlprefix): |
1465 | pkgval = d.getVar('PKG_%s' % pkg) | 1476 | pkgval = d.getVar('PKG_%s' % pkg) |
@@ -1532,6 +1543,8 @@ fi | |||
1532 | with open(data_file, 'w') as fd: | 1543 | with open(data_file, 'w') as fd: |
1533 | fd.write("PACKAGES: %s\n" % packages) | 1544 | fd.write("PACKAGES: %s\n" % packages) |
1534 | 1545 | ||
1546 | pkgdebugsource = d.getVar("PKGDEBUGSOURCES") or [] | ||
1547 | |||
1535 | pn = d.getVar('PN') | 1548 | pn = d.getVar('PN') |
1536 | global_variants = (d.getVar('MULTILIB_GLOBAL_VARIANTS') or "").split() | 1549 | global_variants = (d.getVar('MULTILIB_GLOBAL_VARIANTS') or "").split() |
1537 | variants = (d.getVar('MULTILIB_VARIANTS') or "").split() | 1550 | variants = (d.getVar('MULTILIB_VARIANTS') or "").split() |
@@ -1551,17 +1564,32 @@ fi | |||
1551 | pkgval = pkg | 1564 | pkgval = pkg |
1552 | d.setVar('PKG_%s' % pkg, pkg) | 1565 | d.setVar('PKG_%s' % pkg, pkg) |
1553 | 1566 | ||
1567 | extended_data = { | ||
1568 | "files_info": {} | ||
1569 | } | ||
1570 | |||
1554 | pkgdestpkg = os.path.join(pkgdest, pkg) | 1571 | pkgdestpkg = os.path.join(pkgdest, pkg) |
1555 | files = {} | 1572 | files = {} |
1573 | files_extra = {} | ||
1556 | total_size = 0 | 1574 | total_size = 0 |
1557 | seen = set() | 1575 | seen = set() |
1558 | for f in pkgfiles[pkg]: | 1576 | for f in pkgfiles[pkg]: |
1559 | relpth = os.path.relpath(f, pkgdestpkg) | 1577 | fpath = os.sep + os.path.relpath(f, pkgdestpkg) |
1578 | |||
1560 | fstat = os.lstat(f) | 1579 | fstat = os.lstat(f) |
1561 | files[os.sep + relpth] = fstat.st_size | 1580 | files[fpath] = fstat.st_size |
1581 | |||
1582 | extended_data["files_info"].setdefault(fpath, {}) | ||
1583 | extended_data["files_info"][fpath]['size'] = fstat.st_size | ||
1584 | |||
1562 | if fstat.st_ino not in seen: | 1585 | if fstat.st_ino not in seen: |
1563 | seen.add(fstat.st_ino) | 1586 | seen.add(fstat.st_ino) |
1564 | total_size += fstat.st_size | 1587 | total_size += fstat.st_size |
1588 | |||
1589 | if fpath in pkgdebugsource: | ||
1590 | extended_data["files_info"][fpath]['debugsrc'] = pkgdebugsource[fpath] | ||
1591 | del pkgdebugsource[fpath] | ||
1592 | |||
1565 | d.setVar('FILES_INFO', json.dumps(files, sort_keys=True)) | 1593 | d.setVar('FILES_INFO', json.dumps(files, sort_keys=True)) |
1566 | 1594 | ||
1567 | process_postinst_on_target(pkg, d.getVar("MLPREFIX")) | 1595 | process_postinst_on_target(pkg, d.getVar("MLPREFIX")) |
@@ -1582,6 +1610,11 @@ fi | |||
1582 | 1610 | ||
1583 | sf.write('%s_%s: %d\n' % ('PKGSIZE', pkg, total_size)) | 1611 | sf.write('%s_%s: %d\n' % ('PKGSIZE', pkg, total_size)) |
1584 | 1612 | ||
1613 | subdata_extended_file = pkgdatadir + "/extended/%s.json.zstd" % pkg | ||
1614 | num_threads = int(d.getVar("BB_NUMBER_THREADS")) | ||
1615 | with bb.compress.zstd.open(subdata_extended_file, "wt", encoding="utf-8", num_threads=num_threads) as f: | ||
1616 | json.dump(extended_data, f, sort_keys=True, separators=(",", ":")) | ||
1617 | |||
1585 | # Symlinks needed for rprovides lookup | 1618 | # Symlinks needed for rprovides lookup |
1586 | rprov = d.getVar('RPROVIDES_%s' % pkg) or d.getVar('RPROVIDES') | 1619 | rprov = d.getVar('RPROVIDES_%s' % pkg) or d.getVar('RPROVIDES') |
1587 | if rprov: | 1620 | if rprov: |
@@ -1612,7 +1645,8 @@ fi | |||
1612 | write_extra_runtime_pkgs(global_variants, packages, pkgdatadir) | 1645 | write_extra_runtime_pkgs(global_variants, packages, pkgdatadir) |
1613 | 1646 | ||
1614 | } | 1647 | } |
1615 | emit_pkgdata[dirs] = "${PKGDESTWORK}/runtime ${PKGDESTWORK}/runtime-reverse ${PKGDESTWORK}/runtime-rprovides" | 1648 | emit_pkgdata[dirs] = "${PKGDESTWORK}/runtime ${PKGDESTWORK}/runtime-reverse ${PKGDESTWORK}/runtime-rprovides ${PKGDESTWORK}/extended" |
1649 | emit_pkgdata[vardepsexclude] = "BB_NUMBER_THREADS" | ||
1616 | 1650 | ||
1617 | ldconfig_postinst_fragment() { | 1651 | ldconfig_postinst_fragment() { |
1618 | if [ x"$D" = "x" ]; then | 1652 | if [ x"$D" = "x" ]; then |
diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py index a82085a792..00f7dc1f3d 100644 --- a/meta/lib/oe/packagedata.py +++ b/meta/lib/oe/packagedata.py | |||
@@ -57,6 +57,18 @@ def read_subpkgdata_dict(pkg, d): | |||
57 | ret[newvar] = subd[var] | 57 | ret[newvar] = subd[var] |
58 | return ret | 58 | return ret |
59 | 59 | ||
60 | def read_subpkgdata_extended(pkg, d): | ||
61 | import json | ||
62 | import bb.compress.zstd | ||
63 | |||
64 | fn = d.expand("${PKGDATA_DIR}/extended/%s.json.zstd" % pkg) | ||
65 | try: | ||
66 | num_threads = int(d.getVar("BB_NUMBER_THREADS")) | ||
67 | with bb.compress.zstd.open(fn, "rt", encoding="utf-8", num_threads=num_threads) as f: | ||
68 | return json.load(f) | ||
69 | except FileNotFoundError: | ||
70 | return None | ||
71 | |||
60 | def _pkgmap(d): | 72 | def _pkgmap(d): |
61 | """Return a dictionary mapping package to recipe name.""" | 73 | """Return a dictionary mapping package to recipe name.""" |
62 | 74 | ||