[oe-commits] [openembedded-core] 39/51: busybox: fix the alternatives logic
git at git.openembedded.org
git at git.openembedded.org
Thu Aug 30 15:21:18 UTC 2018
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit 8157c87bef90f893676ee2e8975014aa7bfe8639
Author: Chen Qi <Qi.Chen at windriver.com>
AuthorDate: Thu Aug 30 17:45:13 2018 +0800
busybox: fix the alternatives logic
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.Chen at windriver.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
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)):
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list