summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorYann Dirson <yann@blade-group.com>2020-09-01 12:35:12 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-09-10 18:07:40 (GMT)
commit87c9d296357638082f5a7131a87365285fc813c4 (patch)
tree07d0fb5ad09db4354348958ba525ec13e24c675b /meta/classes
parent7666bf96cd5853d8d8b3ff402300e2e5879605ce (diff)
downloadpoky-87c9d296357638082f5a7131a87365285fc813c4.tar.gz
package: get_package_mapping: avoid dependency mapping if renamed package provides original name
Packages with a runtime dependency on a target package whose name is changed by the PKG_* mechanism must rebuild when that mapping changes, but we have no way of tracking this today, so eg. packagegroup-machine-base ends up with a relationship on a versioned kernel-image, and does not get rebuilt when that version changes, leading to unsatisfiable dependency and reproducibility issue. OTOH there is no reason for the dependency to get rewritten if the renamed package already has a RPROVIDES on the non-rewritten package name, and if the dependency relationship is an unversionned one. This is what this patch prevents. Note that this may not cover all cases of rewritten package names. Notably I had to let the rewrite be done in the case of versionned dependencies, as package managers usually can follow "Provides" in such case; this includes many dependencies against shared-lib packages renamed to their soname, and those at least are OK, since the dependent recipe should explicitly depend on the target recipe. (From OE-Core rev: 920beaaeef62b558e046f32c8ef0332250969ef1) (From OE-Core rev: 210ebed1e9c2285d6e457bf03d1f1a1f3ddc7fda) Signed-off-by: Yann Dirson <yann@blade-group.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/package.bbclass16
1 files changed, 13 insertions, 3 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 23ff477..cc64ddf 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -535,7 +535,7 @@ def copydebugsources(debugsrcdir, sources, d):
535# Package data handling routines 535# Package data handling routines
536# 536#
537 537
538def get_package_mapping (pkg, basepkg, d): 538def get_package_mapping (pkg, basepkg, d, depversions=None):
539 import oe.packagedata 539 import oe.packagedata
540 540
541 data = oe.packagedata.read_subpkgdata(pkg, d) 541 data = oe.packagedata.read_subpkgdata(pkg, d)
@@ -546,6 +546,14 @@ def get_package_mapping (pkg, basepkg, d):
546 if bb.data.inherits_class('allarch', d) and not d.getVar('MULTILIB_VARIANTS') \ 546 if bb.data.inherits_class('allarch', d) and not d.getVar('MULTILIB_VARIANTS') \
547 and data[key] == basepkg: 547 and data[key] == basepkg:
548 return pkg 548 return pkg
549 if depversions == []:
550 # Avoid returning a mapping if the renamed package rprovides its original name
551 rprovkey = "RPROVIDES_%s" % pkg
552 if rprovkey in data:
553 if pkg in bb.utils.explode_dep_versions2(data[rprovkey]):
554 bb.note("%s rprovides %s, not replacing the latter" % (data[key], pkg))
555 return pkg
556 # Do map to rewritten package name
549 return data[key] 557 return data[key]
550 558
551 return pkg 559 return pkg
@@ -566,8 +574,10 @@ def runtime_mapping_rename (varname, pkg, d):
566 574
567 new_depends = {} 575 new_depends = {}
568 deps = bb.utils.explode_dep_versions2(d.getVar(varname) or "") 576 deps = bb.utils.explode_dep_versions2(d.getVar(varname) or "")
569 for depend in deps: 577 for depend, depversions in deps.items():
570 new_depend = get_package_mapping(depend, pkg, d) 578 new_depend = get_package_mapping(depend, pkg, d, depversions)
579 if depend != new_depend:
580 bb.note("package name mapping done: %s -> %s" % (depend, new_depend))
571 new_depends[new_depend] = deps[depend] 581 new_depends[new_depend] = deps[depend]
572 582
573 d.setVar(varname, bb.utils.join_deps(new_depends, commasep=False)) 583 d.setVar(varname, bb.utils.join_deps(new_depends, commasep=False))