diff options
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oe/packagedata.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py index b2ed8b5a3d..ff260f405c 100644 --- a/meta/lib/oe/packagedata.py +++ b/meta/lib/oe/packagedata.py | |||
| @@ -110,3 +110,56 @@ def recipename(pkg, d): | |||
| 110 | """Return the recipe name for the given binary package name.""" | 110 | """Return the recipe name for the given binary package name.""" |
| 111 | 111 | ||
| 112 | return pkgmap(d).get(pkg) | 112 | return pkgmap(d).get(pkg) |
| 113 | |||
| 114 | def get_package_mapping(pkg, basepkg, d, depversions=None): | ||
| 115 | import oe.packagedata | ||
| 116 | |||
| 117 | data = oe.packagedata.read_subpkgdata(pkg, d) | ||
| 118 | key = "PKG:%s" % pkg | ||
| 119 | |||
| 120 | if key in data: | ||
| 121 | if bb.data.inherits_class('allarch', d) and bb.data.inherits_class('packagegroup', d) and pkg != data[key]: | ||
| 122 | bb.error("An allarch packagegroup shouldn't depend on packages which are dynamically renamed (%s to %s)" % (pkg, data[key])) | ||
| 123 | # Have to avoid undoing the write_extra_pkgs(global_variants...) | ||
| 124 | if bb.data.inherits_class('allarch', d) and not d.getVar('MULTILIB_VARIANTS') \ | ||
| 125 | and data[key] == basepkg: | ||
| 126 | return pkg | ||
| 127 | if depversions == []: | ||
| 128 | # Avoid returning a mapping if the renamed package rprovides its original name | ||
| 129 | rprovkey = "RPROVIDES:%s" % pkg | ||
| 130 | if rprovkey in data: | ||
| 131 | if pkg in bb.utils.explode_dep_versions2(data[rprovkey]): | ||
| 132 | bb.note("%s rprovides %s, not replacing the latter" % (data[key], pkg)) | ||
| 133 | return pkg | ||
| 134 | # Do map to rewritten package name | ||
| 135 | return data[key] | ||
| 136 | |||
| 137 | return pkg | ||
| 138 | |||
| 139 | def get_package_additional_metadata(pkg_type, d): | ||
| 140 | base_key = "PACKAGE_ADD_METADATA" | ||
| 141 | for key in ("%s_%s" % (base_key, pkg_type.upper()), base_key): | ||
| 142 | if d.getVar(key, False) is None: | ||
| 143 | continue | ||
| 144 | d.setVarFlag(key, "type", "list") | ||
| 145 | if d.getVarFlag(key, "separator") is None: | ||
| 146 | d.setVarFlag(key, "separator", "\\n") | ||
| 147 | metadata_fields = [field.strip() for field in oe.data.typed_value(key, d)] | ||
| 148 | return "\n".join(metadata_fields).strip() | ||
| 149 | |||
| 150 | def runtime_mapping_rename(varname, pkg, d): | ||
| 151 | #bb.note("%s before: %s" % (varname, d.getVar(varname))) | ||
| 152 | |||
| 153 | new_depends = {} | ||
| 154 | deps = bb.utils.explode_dep_versions2(d.getVar(varname) or "") | ||
| 155 | for depend, depversions in deps.items(): | ||
| 156 | new_depend = get_package_mapping(depend, pkg, d, depversions) | ||
| 157 | if depend != new_depend: | ||
| 158 | bb.note("package name mapping done: %s -> %s" % (depend, new_depend)) | ||
| 159 | new_depends[new_depend] = deps[depend] | ||
| 160 | |||
| 161 | d.setVar(varname, bb.utils.join_deps(new_depends, commasep=False)) | ||
| 162 | |||
| 163 | #bb.note("%s after: %s" % (varname, d.getVar(varname))) | ||
| 164 | |||
| 165 | |||
