Add the ability to use chkconfig's update-alternatives
cover Add the ability to use chkconfig's update-alternatives
From: Christopher Larson <[email protected]>
This short patch series fixes a few issues with the chkconfig recipe to prepare for packaging of its C implementation of update-alternatives, enables this packaging, adds a recipe with minimal deps for the -native case, and fixes a couple issues in opkg-native and update-alternatives.bbclass.
With this applied, you can use this implementation of update-alternatives rather than cworth's by defining:
VIRTUAL-RUNTIME_update-alternatives = "chkconfig-alternatives" PREFERRED_PROVIDER_virtual/update-alternatives = "chkconfig-alternatives" PREFERRED_PROVIDER_virtual/update-alternatives-native = "chkconfig-alternatives-native"
I've sanity checked both package and image buildhistory, and the only changes are due to the particular layout of the alternatives directories, which is reasonable. I've also confirmed that image do_rootfs run times have dropped by 7 seconds on average, so it at least doesn't regress that. Of course, the main benefit to being able to use this implementation is the removal of the sh dependency, and that the maintainer of its code is someone other than us and the opkg maintainer.
Comments welcome. Thanks.
The following changes since commit 69bbce0176183b0dc14eda21e4f6b601443060f0:
libpng: fix packaging (2012-12-25 14:00:22 -0800)
are available in the git repository at:
https://github.com/kergoth/oe-core chkconfig-alternatives
for you to fetch changes up to a755aa630c6d2095d5950ee00d396f3249e4a912:
chkconfig-alternatives-native-1.3.59: add recipe (2012-12-28 14:19:56 -0700)
----------------------------------------------------------------
Christopher Larson (6):
update-alternatives.bbclass: use absolute paths for link targets
opkg-native: obey virtual/update-alternatives-native
chkconfig: don't inherit autotools
chkconfig: obey sysconfdir, base_libdir
chkconfig: package the update-alternatives implementation chkconfig-alternatives-native-1.3.59: add recipe
meta/classes/update-alternatives.bbclass | 2 +- meta/recipes-devtools/opkg/opkg.inc | 10 ++++- .../chkconfig-alternatives-native_1.3.59.bb | 43 +++++++++++++++++++ .../recipes-extended/chkconfig/chkconfig_1.3.58.bb | 48 ++++++++++++++++++---- 4 files changed, 91 insertions(+), 12 deletions(-) create mode 100644 meta/recipes-extended/chkconfig/chkconfig-alternatives-native_1.3.59.bb
Signature · 1 line
1.8.0
PATCH 1/6 update-alternatives.bbclass: use absolute paths for link targets
From: Christopher Larson <[email protected]>
This improves compatibility, as both the debian update-alternatives and the chkconfig alternatives require absolute paths.
--- meta/classes/update-alternatives.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/update-alternatives.bbclass +1 -1
@@ -298,7 +298,7 @@ python populate_packages_prepend () { continue # Default to generate shell script.. eventually we may want to change this... - alt_target = os.path.relpath(alt_target, os.path.dirname(alt_link)) + alt_target = os.path.normpath(alt_target) alt_setup_links += '\tupdate-alternatives --install %s %s %s %s\n' % (alt_link, alt_name, alt_target, alt_priority) alt_remove_links += '\tupdate-alternatives --remove %s %s\n' % (alt_name, alt_target)
Signature · 1 line
1.8.0
PATCH 2/6 opkg-native: obey virtual/update-alternatives-native
In reply to Christopher LarsonFrom: Christopher Larson <[email protected]>
--- meta/recipes-devtools/opkg/opkg.inc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
meta/recipes-devtools/opkg/opkg.inc +8 -2
@@ -9,7 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ file://src/opkg-cl.c;beginline=1;endline=20;md5=321f658c3f6b6c832e25c8850b5dffba" PE = "1" -INC_PR = "r11" +INC_PR = "r12" # Werror gives all kinds bounds issuses with gcc 4.3.3 do_configure_prepend() {
@@ -43,11 +43,17 @@ FILES_libopkg-dev = "${libdir}/*.la ${libdir}/*.so" FILES_libopkg-staticdev = "${libdir}/*.a" FILES_libopkg = "${libdir}/*.so.* ${localstatedir}/lib/opkg/" -# We need to create the lock directory do_install_append() { + # We need to create the lock directory install -d ${D}${localstatedir}/lib/opkg } +do_install_append_class-native() { + if [ "${PREFERRED_PROVIDER_virtual/update-alternatives-native}" != "${PN}" ]; then + rm ${D}${bindir}/update-alternatives + fi +} + pkg_postinst_${PN} () { #!/bin/sh if [ "x$D" != "x" ]; then
Signature · 1 line
1.8.0
PATCH 3/6 chkconfig: don't inherit autotools
In reply to Christopher LarsonFrom: Christopher Larson <[email protected]>
This buildsystem is not autoconf/automake, but make.
While we're at it, also make the install not hardcode the path to /usr/share/locale.
--- .../recipes-extended/chkconfig/chkconfig_1.3.58.bb | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-)
meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb +15 -9
@@ -12,23 +12,29 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=5574c6965ae5f583e55880e397fbb018" DEPENDS = "libnewt popt" -PR = "r4" +PR = "r5" SRC_URI = "http://fedorahosted.org/releases/c/h/chkconfig/${BPN}-${PV}.tar.bz2" SRC_URI[md5sum] = "c2039ca67f2749fe0c06ef7c6f8ee246" SRC_URI[sha256sum] = "18b497d25b2cada955c72810e45fcad8280d105f17cf45e2970f18271211de68" -inherit autotools gettext +inherit gettext -# Makefile uses RPM_OPT_fLAGS to construct CFLAGS +# Makefile uses RPM_OPT_FLAGS to construct CFLAGS # -EXTRA_OEMAKE += 'RPM_OPT_FLAGS="${CFLAGS}" MANDIR="${mandir}" \ - BINDIR="${base_sbindir}" SBINDIR="${sbindir}"' - -do_install_append() { - mkdir -p ${D}${sysconfdir}/chkconfig.d - rm -f ${D}${sbindir}/update-alternatives +EXTRA_OEMAKE = "\ + 'RPM_OPT_FLAGS=${CFLAGS}' \ + 'LDFLAGS=${LDFLAGS}' \ + 'BINDIR=${base_sbindir}' \ + 'SBINDIR=${sbindir}' \ + 'MANDIR=${mandir}' \ +" + +do_install() { + oe_runmake 'DESTDIR=${D}' 'INSTALLNLSDIR=${D}${datadir}/locale' install + mkdir -p ${D}${sysconfdir}/chkconfig.d + rm -f ${D}${sbindir}/update-alternatives } do_install_append_linuxstdbase() {
Signature · 1 line
1.8.0
PATCH 4/6 chkconfig: obey sysconfdir, base_libdir
In reply to Christopher LarsonFrom: Christopher Larson <[email protected]>
--- meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb +7 -1
@@ -12,7 +12,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=5574c6965ae5f583e55880e397fbb018" DEPENDS = "libnewt popt" -PR = "r5" +PR = "r6" SRC_URI = "http://fedorahosted.org/releases/c/h/chkconfig/${BPN}-${PV}.tar.bz2"
@@ -31,6 +31,12 @@ EXTRA_OEMAKE = "\ 'MANDIR=${mandir}' \ " +do_unpack[postfuncs] += "obey_variables" +do_unpack[vardeps] += "obey_variables" +obey_variables () { + sed -i -e 's,/etc,${sysconfdir},; s,/lib/systemd,${base_libdir}/systemd,' leveldb.h +} + do_install() { oe_runmake 'DESTDIR=${D}' 'INSTALLNLSDIR=${D}${datadir}/locale' install mkdir -p ${D}${sysconfdir}/chkconfig.d
Signature · 1 line
1.8.0
PATCH 5/6 chkconfig: package the update-alternatives implementation
In reply to Christopher LarsonFrom: Christopher Larson <[email protected]>
--- .../recipes-extended/chkconfig/chkconfig_1.3.58.bb | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb +22 -4
@@ -1,5 +1,4 @@ SUMMARY = "A system tool for maintaining the /etc/rc*.d hierarchy" - DESCRIPTION = "Chkconfig is a basic system utility. It updates and queries runlevel \ information for system services. Chkconfig manipulates the numerous \ symbolic links in /etc/rc.d, to relieve system administrators of some \
@@ -11,8 +10,9 @@ LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=5574c6965ae5f583e55880e397fbb018" DEPENDS = "libnewt popt" +PROVIDES += "virtual/update-alternatives" -PR = "r6" +PR = "r7" SRC_URI = "http://fedorahosted.org/releases/c/h/chkconfig/${BPN}-${PV}.tar.bz2"
@@ -29,18 +29,22 @@ EXTRA_OEMAKE = "\ 'BINDIR=${base_sbindir}' \ 'SBINDIR=${sbindir}' \ 'MANDIR=${mandir}' \ + 'ALTDIR=${localstatedir}/lib/alternatives' \ + 'ALTDATADIR=${sysconfdir}/alternatives' \ " do_unpack[postfuncs] += "obey_variables" do_unpack[vardeps] += "obey_variables" obey_variables () { sed -i -e 's,/etc,${sysconfdir},; s,/lib/systemd,${base_libdir}/systemd,' leveldb.h + sed -i -e 's,/etc/alternatives,${sysconfdir}/alternatives,' \ + -e 's,/var/lib/alternatives,${localstatedir}/lib/alternatives,' \ + -e 's,/usr/share/locale,${datadir}/locale,' alternatives.c } do_install() { oe_runmake 'DESTDIR=${D}' 'INSTALLNLSDIR=${D}${datadir}/locale' install - mkdir -p ${D}${sysconfdir}/chkconfig.d - rm -f ${D}${sbindir}/update-alternatives + install -d ${D}${sysconfdir}/chkconfig.d } do_install_append_linuxstdbase() {
@@ -49,4 +53,18 @@ do_install_append_linuxstdbase() { ln -sf ${base_sbindir}/chkconfig ${D}/${libdir}/lsb/remove_initd } +PACKAGES =+ "${PN}-alternatives ${PN}-alternatives-doc" +SUMMARY_${PN}-alternatives = "Maintain symbolic links determining default commands" +DESCRIPTION_${PN}-alternatives = "alternatives creates, removes, maintains and displays \ +information about the symbolic links comprising the alternatives system." +SUMMARY_${PN}-alternatives-doc = "${SUMMARY_${PN}-alternatives} - Documentation files" +DESCRIPTION_${PN}-alternatives-doc = "${DESCRIPTION_${PN}-alternatives} \ +This package contains documentation." +RPROVIDES_${PN}-alternatives += "update-alternatives" +RCONFLICTS_${PN}-alternatives = "update-alternatives-cworth update-alternatives-dpkg" +FILES_${PN}-alternatives = "${sbindir}/alternatives ${sbindir}/update-alternatives \ + ${sysconfdir}/alternatives ${localstatedir}/lib/alternatives" +FILES_${PN}-alternatives-doc = "${mandir}/man8/alternatives.8 \ + ${mandir}/man8/update-alternatives.8" + FILES_${PN}_append_linuxstdbase += "${libdir}/lsb"
Signature · 1 line
1.8.0
PATCH 6/6 chkconfig-alternatives-native-1.3.59: add recipe
In reply to Christopher LarsonFrom: Christopher Larson <[email protected]>
This only builds alternatives, so avoids the libnewt and libpopt dependencies.
This uses 1.3.59 sources from git, with a couple commits of mine to add --sysroot (and OPKG_OFFLINE_ROOT) support.
LIC_FILES_CHKSUM changed from 1.3.58 to 1.3.59, but only due to minor formatting differences, not content/terms.
--- .../chkconfig-alternatives-native_1.3.59.bb | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 meta/recipes-extended/chkconfig/chkconfig-alternatives-native_1.3.59.bb
meta/recipes-extended/chkconfig/chkconfig-alternatives-native_1.3.59.bb new file +43 -0
@@ -0,0 +1,43 @@ +require recipes-extended/chkconfig/chkconfig_1.3.58.bb + +SUMMARY = "${SUMMARY_chkconfig-alternatives}" +DESCRIPTION = "${DESCRIPTION_chkconfig-alternatives}" +DEPENDS = "" +PROVIDES = "${PN} virtual/update-alternatives-native" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +# The sysroot branch is 1.3.59 + some git commits from master + --sysroot +# support for alternatives. +SRC_URI = "git://github.com/kergoth/chkconfig;branch=sysroot" +S = "${WORKDIR}/git" + +SRCREV = "cd437ecbd8986c894442f8fce1e0061e20f04dee" +PV = "1.3.59+${SRCPV}" + +inherit native + +# We want our native recipes to build using the target paths rather than paths +# into the sysroot, as we may use them to construct the rootfs. As such, we +# only adjust the paths to match the metadata for the target, not native. +obey_variables () { + sed -i 's,ALTERNATIVES_ROOT,OPKG_OFFLINE_ROOT,' alternatives.c +} + +do_compile () { + oe_runmake alternatives +} + +do_install () { + install -d ${D}${sysconfdir}/alternatives \ + ${D}${localstatedir}/lib/alternatives + + install -D -m 0755 alternatives ${D}${bindir}/alternatives + install -D -m 0644 alternatives.8 ${D}${mandir}/man8/alternatives.8 + + ln -s alternatives ${D}${bindir}/update-alternatives + ln -s alternatives.8 ${D}${mandir}/man8/update-alternatives.8 +} + +do_install_append_linuxstdbase() { + rm -rf ${D}${libdir}/lsb +}
Signature · 1 line
1.8.0