diff options
-rw-r--r-- | meta/classes-global/package.bbclass | 61 | ||||
-rw-r--r-- | meta/classes-global/package_deb.bbclass | 2 | ||||
-rw-r--r-- | meta/classes-global/package_ipk.bbclass | 2 | ||||
-rw-r--r-- | meta/classes-global/package_rpm.bbclass | 4 | ||||
-rw-r--r-- | meta/classes-recipe/image.bbclass | 7 | ||||
-rw-r--r-- | meta/classes-recipe/populate_sdk_base.bbclass | 9 | ||||
-rw-r--r-- | meta/lib/oe/packagedata.py | 53 |
7 files changed, 69 insertions, 69 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) |
diff --git a/meta/classes-global/package_deb.bbclass b/meta/classes-global/package_deb.bbclass index c3ae7d574d..99e377b455 100644 --- a/meta/classes-global/package_deb.bbclass +++ b/meta/classes-global/package_deb.bbclass | |||
@@ -169,7 +169,7 @@ def deb_write_pkg(pkg, d): | |||
169 | 169 | ||
170 | # more fields | 170 | # more fields |
171 | 171 | ||
172 | custom_fields_chunk = get_package_additional_metadata("deb", localdata) | 172 | custom_fields_chunk = oe.packagedata.get_package_additional_metadata("deb", localdata) |
173 | if custom_fields_chunk: | 173 | if custom_fields_chunk: |
174 | ctrlfile.write(custom_fields_chunk) | 174 | ctrlfile.write(custom_fields_chunk) |
175 | ctrlfile.write("\n") | 175 | ctrlfile.write("\n") |
diff --git a/meta/classes-global/package_ipk.bbclass b/meta/classes-global/package_ipk.bbclass index 0207ea874b..9b75f5cf1c 100644 --- a/meta/classes-global/package_ipk.bbclass +++ b/meta/classes-global/package_ipk.bbclass | |||
@@ -162,7 +162,7 @@ def ipk_write_pkg(pkg, d): | |||
162 | else: | 162 | else: |
163 | ctrlfile.write(c % tuple(pullData(fs, localdata))) | 163 | ctrlfile.write(c % tuple(pullData(fs, localdata))) |
164 | 164 | ||
165 | custom_fields_chunk = get_package_additional_metadata("ipk", localdata) | 165 | custom_fields_chunk = oe.packagedata.get_package_additional_metadata("ipk", localdata) |
166 | if custom_fields_chunk is not None: | 166 | if custom_fields_chunk is not None: |
167 | ctrlfile.write(custom_fields_chunk) | 167 | ctrlfile.write(custom_fields_chunk) |
168 | ctrlfile.write("\n") | 168 | ctrlfile.write("\n") |
diff --git a/meta/classes-global/package_rpm.bbclass b/meta/classes-global/package_rpm.bbclass index 7ba73f48e7..16631688b1 100644 --- a/meta/classes-global/package_rpm.bbclass +++ b/meta/classes-global/package_rpm.bbclass | |||
@@ -299,7 +299,7 @@ python write_specfile () { | |||
299 | srcmaintainer = localdata.getVar('MAINTAINER') | 299 | srcmaintainer = localdata.getVar('MAINTAINER') |
300 | srchomepage = localdata.getVar('HOMEPAGE') | 300 | srchomepage = localdata.getVar('HOMEPAGE') |
301 | srcdescription = localdata.getVar('DESCRIPTION') or "." | 301 | srcdescription = localdata.getVar('DESCRIPTION') or "." |
302 | srccustomtagschunk = get_package_additional_metadata("rpm", localdata) | 302 | srccustomtagschunk = oe.packagedata.get_package_additional_metadata("rpm", localdata) |
303 | 303 | ||
304 | srcdepends = d.getVar('DEPENDS') | 304 | srcdepends = d.getVar('DEPENDS') |
305 | srcrdepends = "" | 305 | srcrdepends = "" |
@@ -355,7 +355,7 @@ python write_specfile () { | |||
355 | splitlicense = (localdata.getVar('LICENSE') or "") | 355 | splitlicense = (localdata.getVar('LICENSE') or "") |
356 | splitsection = (localdata.getVar('SECTION') or "") | 356 | splitsection = (localdata.getVar('SECTION') or "") |
357 | splitdescription = (localdata.getVar('DESCRIPTION') or ".") | 357 | splitdescription = (localdata.getVar('DESCRIPTION') or ".") |
358 | splitcustomtagschunk = get_package_additional_metadata("rpm", localdata) | 358 | splitcustomtagschunk = oe.packagedata.get_package_additional_metadata("rpm", localdata) |
359 | 359 | ||
360 | translate_vers('RDEPENDS', localdata) | 360 | translate_vers('RDEPENDS', localdata) |
361 | translate_vers('RRECOMMENDS', localdata) | 361 | translate_vers('RRECOMMENDS', localdata) |
diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass index e387645503..a06c9f544d 100644 --- a/meta/classes-recipe/image.bbclass +++ b/meta/classes-recipe/image.bbclass | |||
@@ -203,6 +203,7 @@ fakeroot python do_rootfs () { | |||
203 | from oe.rootfs import create_rootfs | 203 | from oe.rootfs import create_rootfs |
204 | from oe.manifest import create_manifest | 204 | from oe.manifest import create_manifest |
205 | import logging | 205 | import logging |
206 | import oe.packagedata | ||
206 | 207 | ||
207 | logger = d.getVar('BB_TASK_LOGGER', False) | 208 | logger = d.getVar('BB_TASK_LOGGER', False) |
208 | if logger: | 209 | if logger: |
@@ -247,9 +248,9 @@ fakeroot python do_rootfs () { | |||
247 | # otherwise, the multilib renaming could step in and squash any fixups that | 248 | # otherwise, the multilib renaming could step in and squash any fixups that |
248 | # may have occurred. | 249 | # may have occurred. |
249 | pn = d.getVar('PN') | 250 | pn = d.getVar('PN') |
250 | runtime_mapping_rename("PACKAGE_INSTALL", pn, d) | 251 | oe.packagedata.runtime_mapping_rename("PACKAGE_INSTALL", pn, d) |
251 | runtime_mapping_rename("PACKAGE_INSTALL_ATTEMPTONLY", pn, d) | 252 | oe.packagedata.runtime_mapping_rename("PACKAGE_INSTALL_ATTEMPTONLY", pn, d) |
252 | runtime_mapping_rename("BAD_RECOMMENDATIONS", pn, d) | 253 | oe.packagedata.runtime_mapping_rename("BAD_RECOMMENDATIONS", pn, d) |
253 | 254 | ||
254 | # Generate the initial manifest | 255 | # Generate the initial manifest |
255 | create_manifest(d) | 256 | create_manifest(d) |
diff --git a/meta/classes-recipe/populate_sdk_base.bbclass b/meta/classes-recipe/populate_sdk_base.bbclass index 917619962c..7cc9535356 100644 --- a/meta/classes-recipe/populate_sdk_base.bbclass +++ b/meta/classes-recipe/populate_sdk_base.bbclass | |||
@@ -162,6 +162,7 @@ SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; archive_sdk; $ | |||
162 | def populate_sdk_common(d): | 162 | def populate_sdk_common(d): |
163 | from oe.sdk import populate_sdk | 163 | from oe.sdk import populate_sdk |
164 | from oe.manifest import create_manifest, Manifest | 164 | from oe.manifest import create_manifest, Manifest |
165 | import oe.packagedata | ||
165 | 166 | ||
166 | # Handle package exclusions | 167 | # Handle package exclusions |
167 | excl_pkgs = (d.getVar("PACKAGE_EXCLUDE") or "").split() | 168 | excl_pkgs = (d.getVar("PACKAGE_EXCLUDE") or "").split() |
@@ -184,13 +185,13 @@ def populate_sdk_common(d): | |||
184 | d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs)) | 185 | d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs)) |
185 | 186 | ||
186 | pn = d.getVar('PN') | 187 | pn = d.getVar('PN') |
187 | runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", pn, d) | 188 | oe.packagedata.runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", pn, d) |
188 | runtime_mapping_rename("TOOLCHAIN_TARGET_TASK_ATTEMPTONLY", pn, d) | 189 | oe.packagedata.runtime_mapping_rename("TOOLCHAIN_TARGET_TASK_ATTEMPTONLY", pn, d) |
189 | 190 | ||
190 | ld = bb.data.createCopy(d) | 191 | ld = bb.data.createCopy(d) |
191 | ld.setVar("PKGDATA_DIR", "${STAGING_DIR}/${SDK_ARCH}-${SDKPKGSUFFIX}${SDK_VENDOR}-${SDK_OS}/pkgdata") | 192 | ld.setVar("PKGDATA_DIR", "${STAGING_DIR}/${SDK_ARCH}-${SDKPKGSUFFIX}${SDK_VENDOR}-${SDK_OS}/pkgdata") |
192 | runtime_mapping_rename("TOOLCHAIN_HOST_TASK", pn, ld) | 193 | oe.packagedata.runtime_mapping_rename("TOOLCHAIN_HOST_TASK", pn, ld) |
193 | runtime_mapping_rename("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", pn, ld) | 194 | oe.packagedata.runtime_mapping_rename("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", pn, ld) |
194 | d.setVar("TOOLCHAIN_HOST_TASK", ld.getVar("TOOLCHAIN_HOST_TASK")) | 195 | d.setVar("TOOLCHAIN_HOST_TASK", ld.getVar("TOOLCHAIN_HOST_TASK")) |
195 | d.setVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", ld.getVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY")) | 196 | d.setVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", ld.getVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY")) |
196 | 197 | ||
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 | |||