* [PATCH 0/2] Stop using update-alternatives to manage syslog init script
@ 2016-11-21 15:07 Markus Lehtonen
2016-11-21 15:07 ` [PATCH 1/2] busybox: don't manage sysv init script with update-alternatives Markus Lehtonen
2016-11-21 15:07 ` [PATCH 2/2] sysklogd: don't use update-alternatives Markus Lehtonen
0 siblings, 2 replies; 3+ messages in thread
From: Markus Lehtonen @ 2016-11-21 15:07 UTC (permalink / raw)
To: openembedded-core
Managing (SysV) init scripts with update-alternatives seems to be a bad idea.
Package scriptlets (i.e. preinst/postinst/prerm/postrm) in oe-core are
constructed from multiple fragments originating from separate bbclasses. Thus,
the exact final scriptlet(s) depend on the inheritance order of the classes and
is thus delicate by design. Especially in the case of init scripts we always
seem to break some use cases, whatever inheritance order we use. E.g.
update-rc.d fails because init script (link) is not yet present or daemon
start/stop fails because init script (link) is not yet/anymore present. Also,
for reference, no other packages than the syslog packages seem to use
update-alternatives for managing init scripts.
This patchset fixes the problem by removing the update-alternatives mechanism
from syslog packages and making them conflict with each other so that they
cannot be installed on the system at the same time.
[YOCTO #10433]
The following changes since commit a675b2c89e477af088faee9b3be96eae19a85f0b:
sanity.bbclass: fix logging of an error (2016-11-15 15:18:50 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib marquiz/fixes-10433
http://git.openembedded.org/openembedded-core-contrib/log/?h=marquiz/fixes-10433
Markus Lehtonen (2):
busybox: don't manage sysv init script with update-alternatives
sysklogd: don't use update-alternatives
meta/conf/distro/include/default-providers.inc | 1 +
meta/recipes-core/busybox/busybox.inc | 26 +++++++-------------------
meta/recipes-extended/sysklogd/sysklogd.inc | 15 +++------------
3 files changed, 11 insertions(+), 31 deletions(-)
--
2.6.6
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] busybox: don't manage sysv init script with update-alternatives
2016-11-21 15:07 [PATCH 0/2] Stop using update-alternatives to manage syslog init script Markus Lehtonen
@ 2016-11-21 15:07 ` Markus Lehtonen
2016-11-21 15:07 ` [PATCH 2/2] sysklogd: don't use update-alternatives Markus Lehtonen
1 sibling, 0 replies; 3+ messages in thread
From: Markus Lehtonen @ 2016-11-21 15:07 UTC (permalink / raw)
To: openembedded-core
This has proved to be a bad idea. Some package srciptlet
(preinst/postinst/prerm/postrm) seems to break whatever we try to do.
Basically the failures happend because the expeceted init script is not
present when the scriptlet tries to run update-rc.d or start or stop the
service. Another indication that it is a bad idea is that no other
system service package seems to manage init scripts with
update-alternatives.
The patch also adds a new virtual package, i.e. VIRTUAL-RUNTIME_syslog.
[YOCTO #10433]
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
meta/conf/distro/include/default-providers.inc | 1 +
meta/recipes-core/busybox/busybox.inc | 26 +++++++-------------------
2 files changed, 8 insertions(+), 19 deletions(-)
diff --git a/meta/conf/distro/include/default-providers.inc b/meta/conf/distro/include/default-providers.inc
index ece4d8b..b1d245f 100644
--- a/meta/conf/distro/include/default-providers.inc
+++ b/meta/conf/distro/include/default-providers.inc
@@ -28,6 +28,7 @@ VIRTUAL-RUNTIME_getopt ?= "util-linux-getopt"
VIRTUAL-RUNTIME_wireless-tools ?= "iw wireless-tools"
VIRTUAL-RUNTIME_base-utils ?= "busybox"
VIRTUAL-RUNTIME_base-utils-hwclock ?= "busybox-hwclock"
+VIRTUAL-RUNTIME_syslog ?= "busybox-syslog"
#
# Default recipe providers
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index b2f1960..cbcff9e 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -23,6 +23,8 @@ EXTRA_OEMAKE = "CC='${CC}' LD='${CCLD}' V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${
PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog ${PN}-mdev ${PN}-hwclock"
+RCONFLICTS_${PN}-syslog = "sysklogd"
+
FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog* ${sysconfdir}/syslog-startup.conf* ${sysconfdir}/syslog.conf* ${systemd_unitdir}/system/syslog.service ${sysconfdir}/default/busybox-syslog"
FILES_${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/mdev/*"
@@ -45,7 +47,7 @@ SYSTEMD_SERVICE_${PN}-syslog = "busybox-syslog.service"
CONFFILES_${PN}-syslog = "${sysconfdir}/syslog-startup.conf.${BPN}"
CONFFILES_${PN}-mdev = "${sysconfdir}/mdev.conf"
-RRECOMMENDS_${PN} = "${PN}-syslog ${PN}-udhcpc"
+RRECOMMENDS_${PN} = "${VIRTUAL-RUNTIME_syslog} ${PN}-udhcpc"
inherit cml1 systemd update-rc.d ptest
@@ -238,9 +240,9 @@ do_install () {
fi
if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then
- install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/syslog.${BPN}
- install -m 644 ${WORKDIR}/syslog-startup.conf ${D}${sysconfdir}/syslog-startup.conf.${BPN}
- install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/syslog.conf.${BPN}
+ install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/syslog
+ install -m 644 ${WORKDIR}/syslog-startup.conf ${D}${sysconfdir}/syslog-startup.conf
+ install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/syslog.conf
fi
if grep "CONFIG_CROND=y" ${B}/.config; then
install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
@@ -312,7 +314,7 @@ do_install () {
# Remove the sysvinit specific configuration file for systemd systems to avoid confusion
if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then
- rm -f ${D}${sysconfdir}/syslog-startup.conf.${BPN}
+ rm -f ${D}${sysconfdir}/syslog-startup.conf
fi
}
@@ -326,20 +328,6 @@ inherit update-alternatives
ALTERNATIVE_PRIORITY = "50"
-ALTERNATIVE_${PN}-syslog += "syslog-conf"
-ALTERNATIVE_LINK_NAME[syslog-conf] = "${sysconfdir}/syslog.conf"
-
-python () {
- if bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
- pn = d.getVar('PN', True)
- d.appendVar('ALTERNATIVE_%s-syslog' % (pn), ' syslog-init')
- d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-init', '%s/init.d/syslog' % (d.getVar('sysconfdir', True)))
- d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-init', '%s/init.d/syslog.%s' % (d.getVar('sysconfdir', True), d.getVar('BPN', True)))
- d.appendVar('ALTERNATIVE_%s-syslog' % (pn), ' syslog-startup-conf')
- d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-startup-conf', '%s/syslog-startup.conf' % (d.getVar('sysconfdir', True)))
- d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-startup-conf', '%s/syslog-startup.conf.%s' % (d.getVar('sysconfdir', True), d.getVar('BPN', True)))
-}
-
python do_package_prepend () {
# We need to load the full set of busybox provides from the /etc/busybox.links
# Use this to see the update-alternatives with the right information
--
2.6.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] sysklogd: don't use update-alternatives
2016-11-21 15:07 [PATCH 0/2] Stop using update-alternatives to manage syslog init script Markus Lehtonen
2016-11-21 15:07 ` [PATCH 1/2] busybox: don't manage sysv init script with update-alternatives Markus Lehtonen
@ 2016-11-21 15:07 ` Markus Lehtonen
1 sibling, 0 replies; 3+ messages in thread
From: Markus Lehtonen @ 2016-11-21 15:07 UTC (permalink / raw)
To: openembedded-core
Using update-alternatives for managing init scripts has proved to be
problematic. Thus, don't use this method and just conflict with
busybox-syslog, instead.
[YOCTO #10433]
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
meta/recipes-extended/sysklogd/sysklogd.inc | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/meta/recipes-extended/sysklogd/sysklogd.inc b/meta/recipes-extended/sysklogd/sysklogd.inc
index 5c15ffe..de47e08 100644
--- a/meta/recipes-extended/sysklogd/sysklogd.inc
+++ b/meta/recipes-extended/sysklogd/sysklogd.inc
@@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
file://klogd.c;beginline=2;endline=19;md5=7e87ed0ae6142de079bce738c10c899d \
"
-inherit update-rc.d update-alternatives
+inherit update-rc.d
SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \
file://no-strip-install.patch \
@@ -22,6 +22,8 @@ SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar
SRC_URI_append_e500v2 = " file://no-vectorization.patch"
+RCONFLICTS_${PN} = "busybox-syslog"
+
INITSCRIPT_NAME = "syslog"
CONFFILES_${PN} = "${sysconfdir}/syslog.conf.${BPN}"
@@ -41,17 +43,6 @@ do_install () {
install -m 755 ${WORKDIR}/sysklogd ${D}${sysconfdir}/init.d/syslog
}
-# sysklogd package has no internal systemd support, so we weigh busybox's
-# sysklogd utility over it in case of systemd
-ALTERNATIVE_PRIORITY = "${@bb.utils.contains('DISTRO_FEATURES','systemd','10','100',d)}"
-
-ALTERNATIVE_${PN} = "syslogd klogd syslog-init syslog-conf"
-
-ALTERNATIVE_LINK_NAME[syslogd] = "${base_sbindir}/syslogd"
-ALTERNATIVE_LINK_NAME[klogd] = "${base_sbindir}/klogd"
-ALTERNATIVE_LINK_NAME[syslog-init] = "${sysconfdir}/init.d/syslog"
-ALTERNATIVE_LINK_NAME[syslog-conf] = "${sysconfdir}/syslog.conf"
-
pkg_prerm_${PN} () {
if test "x$D" = "x"; then
if test "$1" = "upgrade" -o "$1" = "remove"; then
--
2.6.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-21 15:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-21 15:07 [PATCH 0/2] Stop using update-alternatives to manage syslog init script Markus Lehtonen
2016-11-21 15:07 ` [PATCH 1/2] busybox: don't manage sysv init script with update-alternatives Markus Lehtonen
2016-11-21 15:07 ` [PATCH 2/2] sysklogd: don't use update-alternatives Markus Lehtonen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox