Skip to contentSkip to conversation

recipes-core: move hwclock.sh to util-linux

PATCH In review Alex Stewart 2 participants 2 messages Jan 19, 2018 – Jan 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 recipes-core: move hwclock.sh to util-linux

* Move the hwclock.sh initscript from the busybox recipe to util-linux. This script is generally useful for distros that get their hwclock implementation from sources other than busybox and we follow debian's example by providing it in util-linux.

:busybox/*
* Remove the busybox-hwclock package, as it no longer has a purpose.
* If busybox is configured to include hwclock, the busybox package will RDEPEND on util-linux-hwclock-init.

:util-linux/*
* Add util-linux-hwclock-init as its own recipe so that distros which exclusively use busybox do not have to build the entire util-linux recipe to get the hwclock.sh initscript.
* Provide the hwclock.sh script in util-linux-hwclock-init, which can be pulled by any packages that depend on its functionality.
* util-linux-hwclock RDEPENDS on util-linux-hwclock-init for its initscript.

---
 meta/recipes-core/busybox/busybox.inc              | 16 +++--
 meta/recipes-core/busybox/busybox_1.27.2.bb        |  1 -
 meta/recipes-core/busybox/files/hwclock.sh         | 83 ----------------------
 .../util-linux/util-linux-hwclock-init_1.0.bb      | 33 +++++++++
 meta/recipes-core/util-linux/util-linux.inc        |  1 +
 meta/recipes-core/util-linux/util-linux/hwclock.sh | 83 ++++++++++++++++++++++
 6 files changed, 126 insertions(+), 91 deletions(-)
 delete mode 100644 meta/recipes-core/busybox/files/hwclock.sh
 create mode 100644 meta/recipes-core/util-linux/util-linux-hwclock-init_1.0.bb
 create mode 100644 meta/recipes-core/util-linux/util-linux/hwclock.sh
meta/recipes-core/busybox/busybox.inc +9 -7
index 4012f921c6..d9c3c2793b 100644
@@ -20,19 +20,17 @@ export EXTRA_LDFLAGS = "${LDFLAGS}"
 
 EXTRA_OEMAKE = "CC='${CC}' LD='${CCLD}' V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y HOSTCC='${BUILD_CC}' HOSTCPP='${BUILD_CPP}'"
 
-PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog ${PN}-mdev ${PN}-hwclock"
+PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog ${PN}-mdev"
 
 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/*"
 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
 FILES_${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc"
-FILES_${PN}-hwclock = "${sysconfdir}/init.d/hwclock.sh"
 
-INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd ${PN}-mdev ${PN}-hwclock"
+INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd ${PN}-mdev"
 
 INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
-INITSCRIPT_NAME_${PN}-hwclock = "hwclock.sh"
 INITSCRIPT_NAME_${PN}-mdev = "mdev"
 INITSCRIPT_PARAMS_${PN}-mdev = "start 04 S ."
 INITSCRIPT_NAME_${PN}-syslog = "syslog"
@@ -276,9 +274,6 @@ do_install () {
 	if grep "CONFIG_UDHCPD=y" ${B}/.config; then
 		install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
 	fi
-	if grep "CONFIG_HWCLOCK=y" ${B}/.config; then
-		install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
-	fi
 	if grep "CONFIG_UDHCPC=y" ${B}/.config; then
 		install -d ${D}${sysconfdir}/udhcpc.d
 		install -d ${D}${datadir}/udhcpc
@@ -377,6 +372,13 @@ python do_package_prepend () {
     else:
         set_alternative_vars("${sysconfdir}/busybox.links.nosuid", "${base_bindir}/busybox.nosuid")
         set_alternative_vars("${sysconfdir}/busybox.links.suid", "${base_bindir}/busybox.suid")
+
+    # If busybox is configured to provide a hwclock implementation, add a
+    # package dependency on util-linux-hwclock-init for the
+    # /etc/init.d/hwclock.sh initscript.
+    with open(d.getVar('B', expand=True) + '/.config', 'r') as fp_conf:
+        if 'CONFIG_HWCLOCK=y' in fp_conf.read():
+            d.appendVar('RDEPENDS_busybox', ' util-linux-hwclock-init ')
 }
 
 pkg_postinst_${PN} () {
meta/recipes-core/busybox/busybox_1.27.2.bb +0 -1
index 6c1f4888cf..af2abadc5e 100644
@@ -8,7 +8,6 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://busybox-udhcpd \
            file://default.script \
            file://simple.script \
-           file://hwclock.sh \
            file://mount.busybox \
            file://syslog \
            file://syslog-startup.conf \
meta/recipes-core/busybox/files/hwclock.sh deleted +0 -83

83 lines not on this page · raw message

meta/recipes-core/util-linux/util-linux-hwclock-init_1.0.bb new file +33 -0
new file mode 100644
index 0000000000..f53d95db26
@@ -0,0 +1,33 @@
+SUMMARY = "Initscript for hwclock utility"
+DESCRIPTION = "\
+Installs an initscript that updates the system clock based on the available \
+hwclock implementation."
+
+SECTION = "base"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+FILESEXTRAPATHS_prepend = "${THISDIR}/util-linux:"
+
+SRC_URI = "file://hwclock.sh"
+
+S = "${WORKDIR}"
+
+inherit update-rc.d
+
+INITSCRIPT_PACKAGES = "${PN}"
+
+INITSCRIPT_NAME_${PN} = "hwclock.sh"
+INITSCRIPT_PARAMS_${PN} = "defaults"
+
+do_install () {
+	install -d ${D}${sysconfdir}/init.d
+	install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
+}
+
+PACKAGES = "${PN}"
+
+PACKAGE_ARCH = "all"
+
+FILES_${PN} = "${sysconfdir}/init.d/hwclock.sh"
meta/recipes-core/util-linux/util-linux.inc +1 -0
index 248e8bee95..9fc83e701c 100644
@@ -300,6 +300,7 @@ python populate_packages_prepend() {
 }
 
 RDEPENDS_${PN}-bash-completion += "util-linux-lsblk"
+RDEPENDS_${PN}-hwclock += "util-linux-hwclock-init"
 RDEPENDS_${PN}-ptest = "bash grep coreutils which util-linux-blkid util-linux-fsck btrfs-tools"
 
 do_compile_ptest() {
meta/recipes-core/util-linux/util-linux/hwclock.sh new file +83 -0

83 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw
Quoted 4 lines · Alex Stewart

* Move the hwclock.sh initscript from the busybox recipe to util-linux. This script is generally useful for distros that get their hwclock implementation from sources other than busybox and we follow debian's example by providing it in util-linux.

The script now is an independent unit and as such, it should be not using the busybox or util-linux on its name. Please move it to hwclock-init and adjust both to depend on it. It can be in meta/recipes-core/hwclock/hwclock-init.bb and I'd add a comment in the recipe explaining why it has been split out.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750