path: root/meta/classes/package.bbclass
diff options
authorBruce Ashfield <>2019-07-05 16:14:05 (GMT)
committerRichard Purdie <>2019-07-11 08:32:50 (GMT)
commit236e36a38e7d222ffdc3608644500b1db6129a1f (patch)
tree2620d52c09df0090ec7323d0a00b0168e7a98341 /meta/classes/package.bbclass
parent82d3721e42d37b3f788d44946a97eabe3c9cff33 (diff)
package: check PKG_ variables before executing ontarget postinst
If a package uses PKG_ variables to map package names to version specific variants, on target postinstall functionality will be broken. i.e. something like the following casuses rootfs assembly errors: d.setVar('pkg_postinst_ontarget_linux-source', 'cd /usr/src/; ln -sf %s linux-source' % source_pkg) This breakage is due to the fact that the original package name (as specified by the PACKAGES variable) is logged by the intercept scripts, but the mapped / specific version is actually installed to the rootfs (and hence logged by the package manager). When the runtime listing of on-target scripts is performed, we get a package manager error due to a missing package, since it checks the generic version logged by the intercept scripts. We can fix this by ensuring that the PKG_ variable mapped package name is logged by the intercept phase, and hence the package manager can locate and execute the on target postinst script. This variable check is consistent with other places in the code, and has no impact if PKG_ variables are not used. (From OE-Core rev: a6af0886d1be584974086c0ddb4a5bc566eb7984) Signed-off-by: Bruce Ashfield <> Signed-off-by: Richard Purdie <>
Diffstat (limited to 'meta/classes/package.bbclass')
1 files changed, 5 insertions, 1 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index b447153..8b89fb1 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1358,12 +1358,16 @@ python emit_pkgdata() {
1358 import json 1358 import json
1359 1359
1360 def process_postinst_on_target(pkg, mlprefix): 1360 def process_postinst_on_target(pkg, mlprefix):
1361 pkgval = d.getVar('PKG_%s' % pkg)
1362 if pkgval is None:
1363 pkgval = pkg
1361 defer_fragment = """ 1365 defer_fragment = """
1362if [ -n "$D" ]; then 1366if [ -n "$D" ]; then
1363 $INTERCEPT_DIR/postinst_intercept delay_to_first_boot %s mlprefix=%s 1367 $INTERCEPT_DIR/postinst_intercept delay_to_first_boot %s mlprefix=%s
1364 exit 0 1368 exit 0
1365fi 1369fi
1366""" % (pkg, mlprefix) 1370""" % (pkgval, mlprefix)
1367 1371
1368 postinst = d.getVar('pkg_postinst_%s' % pkg) 1372 postinst = d.getVar('pkg_postinst_%s' % pkg)
1369 postinst_ontarget = d.getVar('pkg_postinst_ontarget_%s' % pkg) 1373 postinst_ontarget = d.getVar('pkg_postinst_ontarget_%s' % pkg)