The current alternatives setting logic in busybox is not ideal. For example, the 'syslogd' alternative should be handled by busybox-syslog package, but it is now handled by the busybox package.
In other words, despite the fact that busybox recipe has multiple packages, the alternatives settings are all done for the main busybox package. This will cause problems. For example, if we have an image with sysklogd and busybox installed, there will be do_rootfs failure if busybox is installed after sysklogd. Note that in the above situation, the image does not have busybox-syslog. The 'syslogd' entry should really be handled by busybox-syslog instead of busybox. And the same logic applies to other packages in the busybox recipe. So change the alternatives handling codes in busybox to fix this problem. Signed-off-by: Chen Qi <qi.c...@windriver.com> --- meta/recipes-core/busybox/busybox.inc | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc index 8c6dbba..5ca1bab 100644 --- a/meta/recipes-core/busybox/busybox.inc +++ b/meta/recipes-core/busybox/busybox.inc @@ -29,6 +29,13 @@ FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd" FILES_${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc" FILES_${PN}-hwclock = "${sysconfdir}/init.d/hwclock.sh" +ALTERNATIVE_${PN}-httpd = "httpd" +ALTERNATIVE_${PN}-syslog = "syslogd klogd" +ALTERNATIVE_${PN}-mdev = "mdev" +ALTERNATIVE_${PN}-udhcpd = "udhcpd" +ALTERNATIVE_${PN}-udhcpc = "udhcpc" +ALTERNATIVE_${PN}-hwclock = "hwclock" + INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd ${PN}-mdev ${PN}-hwclock" INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd" @@ -357,21 +364,46 @@ python do_package_prepend () { dvar = d.getVar('D') pn = d.getVar('PN') + pkgs = d.getVar('PACKAGES').split() def set_alternative_vars(links, target): links = d.expand(links) target = d.expand(target) f = open('%s%s' % (dvar, links), 'r') + valid_names = [] for alt_link_name in f: alt_link_name = alt_link_name.strip() alt_name = os.path.basename(alt_link_name) # Match coreutils if alt_name == '[': alt_name = 'lbracket' - d.appendVar('ALTERNATIVE_%s' % (pn), ' ' + alt_name) + valid_names.append(alt_name) + # if not already specified by ALTERNATIVE_pkg, default to put it in ALTERNATIVE_${PN} + flag_default = True + for pkg in pkgs: + if pkg == pn: + continue + if alt_name in (d.getVar('ALTERNATIVE_%s' % pkg) or '').split(): + flag_default = False + break + if flag_default: + d.appendVar('ALTERNATIVE_%s' % (pn), ' ' + alt_name) d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name) if os.path.exists('%s%s' % (dvar, target)): d.setVarFlag('ALTERNATIVE_TARGET', alt_name, target) f.close() + # iterate over pkgs to remove invalid entries for ALTERNATIVE_pkg + for pkg in pkgs: + if pkg == pn: + continue + final_names = [] + names = (d.getVar('ALTERNATIVE_%s' % pkg) or '').split() + for name in names: + if name in valid_names: + final_names.append(name) + if final_names: + d.setVar('ALTERNATIVE_%s' % pkg, ' '.join(final_names)) + else: + d.delVar('ALTERNATIVE_%s' % pkg) return if os.path.exists('%s/etc/busybox.links' % (dvar)): -- 1.9.1 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core