Skip to contentSkip to conversation

Add alternatives for lastb

PATCH New Bryan Evenson 1 participant 2 messages Apr 24, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 Add alternatives for lastb

I received help from Matthieu Crapet to find and fix a few problems with v3.

Changes in v4:
* Adds last to PACKAGECONFIG_class-native and PACKAGECONFIG_class-nativesdk to mimic current behavior
* Add "--disable-last" to configuration options if last is not in PACKAGECONFIG
* Fix errors in the documentation alternative link generation

Changes in v3:
* Uses PACKAGECONFIG to optionally build last
* Only provides binary and man page alternatives if last is built

Changes in v2:
* Rebase on master so patch applies cleanly

Bryan Evenson (1):
util-linux: Add lastb to alternatives

 meta/recipes-core/util-linux/util-linux.inc | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH v4 1/1 util-linux: Add lastb to alternatives

util-linux creates lastb as a symlink to last during the build. Just as other applications may provide last, other applications may provide lastb. Add alternatives designations for lastb to avoid installation conflicts with other applications.

Both last and lastb are can be exist in other packages. Add lastb to the list of alternatives for util-linux.

Add last as a PACKAGECONFIG option and optionally build last if requested. Only generate the last and lastb alternative links if last is enabled in the configuration.

---
 meta/recipes-core/util-linux/util-linux.inc | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
meta/recipes-core/util-linux/util-linux.inc +19 -6
index 80065e3..724969f 100644
@@ -39,7 +39,7 @@ PACKAGES_DYNAMIC = "^util-linux-lib.*"
 
 SHARED_EXTRA_OECONF = "--disable-use-tty-group \
                        --disable-makeinstall-chown \
-                       --enable-kill --enable-last --enable-mesg --enable-partx \
+                       --enable-kill --enable-mesg --enable-partx \
                        --enable-raw --enable-reset --disable-login \
                        --disable-vipw --disable-newgrp --disable-chfn-chsh \
                        --enable-write --enable-mount \
@@ -49,7 +49,11 @@ SHARED_EXTRA_OECONF = "--disable-use-tty-group \
 
 EXTRA_OECONF = "${SHARED_EXTRA_OECONF} --libdir=${base_libdir}"
 
-PACKAGECONFIG_class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
+PACKAGECONFIG_class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
+                               last"
+PACKAGECONFIG_class-native ?= "last"
+PACKAGECONFIG_class-nativesdk ?= "last"
+
 PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
 
 # Respect the systemd feature for uuidd
@@ -61,6 +65,8 @@ PACKAGECONFIG[libcap-ng] = "--enable-setpriv,--disable-setpriv,libcap-ng,"
 # Build python bindings for libmount
 PACKAGECONFIG[pylibmount] = "--with-python --enable-pylibmount,--without-python --disable-pylibmount,python"
 
+PACKAGECONFIG[last] = "--enable-last,--disable-last"
+
 FILES_${PN}-bash-completion += "${datadir}/bash-completion"
 FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*"
 
@@ -174,7 +180,7 @@ do_install_append_class-native () {
 ALTERNATIVE_PRIORITY = "100"
 
 ALTERNATIVE_${PN}  = "dmesg kill more mkswap blockdev pivot_root switch_root"
-ALTERNATIVE_${PN} += "mkfs.minix hexdump last logger mesg renice wall"
+ALTERNATIVE_${PN} += "mkfs.minix hexdump logger mesg renice wall"
 ALTERNATIVE_${PN} += "setsid chrt flock utmpdump eject"
 
 ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
@@ -187,10 +193,8 @@ ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root"
 ALTERNATIVE_LINK_NAME[mkfs.minix] = "${base_sbindir}/mkfs.minix"
 ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
 
-ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 lastb.1 mesg.1 wall.1 nologin.8 sulogin.8 utmpdump.1 reset.1"
+ALTERNATIVE_${PN}-doc = "mountpoint.1 mesg.1 wall.1 nologin.8 sulogin.8 utmpdump.1 reset.1"
 
-ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
-ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
 ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
 ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
 ALTERNATIVE_LINK_NAME[nologin.8] = "${mandir}/man8/nologin.8"
@@ -252,6 +256,15 @@ python do_package_prepend () {
         alt_name = "su"
         d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, '%s/%s' % (d.getVar('base_bindir', True), alt_name))
         d.appendVar('ALTERNATIVE_%s' % (d.getVar('PN', True)), ' ' + alt_name)
+    if '--enable-last' in d.getVar('EXTRA_OECONF', True).split():
+        alt_name_last = "last"
+        alt_name_lastb = "lastb"
+        d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name_last, '%s/%s' % (d.getVar('bindir', True), alt_name_last))
+        d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name_lastb, '%s/%s' % (d.getVar('bindir', True), alt_name_lastb))
+        d.setVarFlag('ALTERNATIVE_LINK_NAME', '%s.1' % alt_name_last, '%s/man1/%s.1' % (d.getVar('mandir', True), alt_name_last))
+        d.setVarFlag('ALTERNATIVE_LINK_NAME', '%s.1' % alt_name_lastb, '%s/man1/%s.1' % (d.getVar('mandir', True), alt_name_lastb))
+        d.appendVar('ALTERNATIVE_%s' % (d.getVar('PN', True)), ' ' + alt_name_last + ' ' + alt_name_lastb)
+        d.appendVar('ALTERNATIVE_%s-doc' % (d.getVar('PN', True)), ' ' + alt_name_last + '.1 ' + alt_name_lastb + '.1')
 }
 
 python populate_packages_prepend() {
Signature · 1 line
2.1.0