diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-04 13:18:03 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-05 11:52:50 +0000 |
commit | a099ed2125fbd822342b7fc124e3c659b26d29c9 (patch) | |
tree | d62cbc302f02f2e692acfc61cc7f0fad0d7bab81 /meta/classes-global/package.bbclass | |
parent | 93be2cdf492e1ec3d3c13f9c2ce82346be323da6 (diff) | |
download | poky-a099ed2125fbd822342b7fc124e3c659b26d29c9.tar.gz |
package: Move pkgdata handling functions to oe.packagedata
To avoid reparsing the bbclass code all the time, move the functions
to the packagedata python function library code which is more efficient.
(From OE-Core rev: f520a3039540b1183b1b2bdaaf8b9195995c0187)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-global/package.bbclass')
-rw-r--r-- | meta/classes-global/package.bbclass | 61 |
1 files changed, 3 insertions, 58 deletions
diff --git a/meta/classes-global/package.bbclass b/meta/classes-global/package.bbclass index a31224f243..72e39f6914 100644 --- a/meta/classes-global/package.bbclass +++ b/meta/classes-global/package.bbclass | |||
@@ -567,61 +567,6 @@ def copydebugsources(debugsrcdir, sources, d): | |||
567 | os.rmdir(p) | 567 | os.rmdir(p) |
568 | 568 | ||
569 | # | 569 | # |
570 | # Package data handling routines | ||
571 | # | ||
572 | |||
573 | def get_package_mapping (pkg, basepkg, d, depversions=None): | ||
574 | import oe.packagedata | ||
575 | |||
576 | data = oe.packagedata.read_subpkgdata(pkg, d) | ||
577 | key = "PKG:%s" % pkg | ||
578 | |||
579 | if key in data: | ||
580 | if bb.data.inherits_class('allarch', d) and bb.data.inherits_class('packagegroup', d) and pkg != data[key]: | ||
581 | bb.error("An allarch packagegroup shouldn't depend on packages which are dynamically renamed (%s to %s)" % (pkg, data[key])) | ||
582 | # Have to avoid undoing the write_extra_pkgs(global_variants...) | ||
583 | if bb.data.inherits_class('allarch', d) and not d.getVar('MULTILIB_VARIANTS') \ | ||
584 | and data[key] == basepkg: | ||
585 | return pkg | ||
586 | if depversions == []: | ||
587 | # Avoid returning a mapping if the renamed package rprovides its original name | ||
588 | rprovkey = "RPROVIDES:%s" % pkg | ||
589 | if rprovkey in data: | ||
590 | if pkg in bb.utils.explode_dep_versions2(data[rprovkey]): | ||
591 | bb.note("%s rprovides %s, not replacing the latter" % (data[key], pkg)) | ||
592 | return pkg | ||
593 | # Do map to rewritten package name | ||
594 | return data[key] | ||
595 | |||
596 | return pkg | ||
597 | |||
598 | def get_package_additional_metadata (pkg_type, d): | ||
599 | base_key = "PACKAGE_ADD_METADATA" | ||
600 | for key in ("%s_%s" % (base_key, pkg_type.upper()), base_key): | ||
601 | if d.getVar(key, False) is None: | ||
602 | continue | ||
603 | d.setVarFlag(key, "type", "list") | ||
604 | if d.getVarFlag(key, "separator") is None: | ||
605 | d.setVarFlag(key, "separator", "\\n") | ||
606 | metadata_fields = [field.strip() for field in oe.data.typed_value(key, d)] | ||
607 | return "\n".join(metadata_fields).strip() | ||
608 | |||
609 | def runtime_mapping_rename (varname, pkg, d): | ||
610 | #bb.note("%s before: %s" % (varname, d.getVar(varname))) | ||
611 | |||
612 | new_depends = {} | ||
613 | deps = bb.utils.explode_dep_versions2(d.getVar(varname) or "") | ||
614 | for depend, depversions in deps.items(): | ||
615 | new_depend = get_package_mapping(depend, pkg, d, depversions) | ||
616 | if depend != new_depend: | ||
617 | bb.note("package name mapping done: %s -> %s" % (depend, new_depend)) | ||
618 | new_depends[new_depend] = deps[depend] | ||
619 | |||
620 | d.setVar(varname, bb.utils.join_deps(new_depends, commasep=False)) | ||
621 | |||
622 | #bb.note("%s after: %s" % (varname, d.getVar(varname))) | ||
623 | |||
624 | # | ||
625 | # Used by do_packagedata (and possibly other routines post do_package) | 570 | # Used by do_packagedata (and possibly other routines post do_package) |
626 | # | 571 | # |
627 | 572 | ||
@@ -2244,6 +2189,6 @@ def mapping_rename_hook(d): | |||
2244 | like debian.bbclass or manual PKG variable name changes | 2189 | like debian.bbclass or manual PKG variable name changes |
2245 | """ | 2190 | """ |
2246 | pkg = d.getVar("PKG") | 2191 | pkg = d.getVar("PKG") |
2247 | runtime_mapping_rename("RDEPENDS", pkg, d) | 2192 | oe.packagedata.runtime_mapping_rename("RDEPENDS", pkg, d) |
2248 | runtime_mapping_rename("RRECOMMENDS", pkg, d) | 2193 | oe.packagedata.runtime_mapping_rename("RRECOMMENDS", pkg, d) |
2249 | runtime_mapping_rename("RSUGGESTS", pkg, d) | 2194 | oe.packagedata.runtime_mapping_rename("RSUGGESTS", pkg, d) |