summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2012-05-15 18:34:39 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-30 12:04:41 +0100
commit3f810e24628764413a0672e668953667dc62794f (patch)
tree2f279d78c3d898099e40d02c86f35eccb7118559
parent92482cb4962fd79a07078f0fea372fdc200ed76c (diff)
downloadpoky-3f810e24628764413a0672e668953667dc62794f.tar.gz
coreutils: use new update-alternatives
(From OE-Core rev: 4bed7f31535f16dbe1f8bbab58921f12f1696f6f) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/coreutils/coreutils_6.9.bb46
-rw-r--r--meta/recipes-core/coreutils/coreutils_8.14.bb49
2 files changed, 38 insertions, 57 deletions
diff --git a/meta/recipes-core/coreutils/coreutils_6.9.bb b/meta/recipes-core/coreutils/coreutils_6.9.bb
index bbde63c697..6789b8c11d 100644
--- a/meta/recipes-core/coreutils/coreutils_6.9.bb
+++ b/meta/recipes-core/coreutils/coreutils_6.9.bb
@@ -38,59 +38,47 @@ bindir_progs = "base64 basename cksum comm csplit cut dir dircolors dirname du \
38 join link logname md5sum mkfifo nice nl nohup od paste pathchk \ 38 join link logname md5sum mkfifo nice nl nohup od paste pathchk \
39 pinky pr printenv printf ptx readlink seq sha1sum sha224sum sha256sum \ 39 pinky pr printenv printf ptx readlink seq sha1sum sha224sum sha256sum \
40 sha384sum sha512sum shred shuf sort split stat sum tac tail tee test \ 40 sha384sum sha512sum shred shuf sort split stat sum tac tail tee test \
41 tr tsort tty unexpand uniq unlink users vdir wc who whoami yes" 41 tr tsort tty unexpand uniq unlink users vdir wc who whoami yes uptime"
42 42
43# hostname gets a special treatment and is not included in this 43# hostname gets a special treatment and is not included in this
44base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \ 44base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \
45 mknod mv pwd rm rmdir sleep stty sync touch true uname" 45 mknod mv pwd rm rmdir sleep stty sync touch true uname hostname"
46 46
47sbindir_progs= "chroot" 47sbindir_progs= "chroot"
48 48
49do_install() { 49do_install() {
50 autotools_do_install 50 autotools_do_install
51 51
52 for i in ${bindir_progs}; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN}; done
53
54 install -d ${D}${base_bindir} 52 install -d ${D}${base_bindir}
55 for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${PN}; done 53 [ "${bindir}" != "${base_bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i; done
56 54
57 install -d ${D}${sbindir} 55 install -d ${D}${sbindir}
58 for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${PN}; done 56 [ "${bindir}" != "${sbindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i; done
59 57
60 # [ requires special handling because [.coreutils will cause the sed stuff 58 # [ requires special handling because [.coreutils will cause the sed stuff
61 # in update-alternatives to fail, therefore use lbracket - the name used 59 # in update-alternatives to fail, therefore use lbracket - the name used
62 # for the actual source file. 60 # for the actual source file.
63 mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${PN} 61 mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN}
64
65 # hostname and uptime separated. busybox's versions are preferred
66 mv ${D}${bindir}/hostname ${D}${base_bindir}/hostname.${PN}
67 mv ${D}${bindir}/uptime ${D}${bindir}/uptime.${PN}
68} 62}
69 63
70pkg_postinst_${PN} () { 64inherit update-alternatives
71 for i in ${bindir_progs}; do update-alternatives --install ${bindir}/$i $i $i.${PN} 100; done
72 65
73 for i in ${base_bindir_progs}; do update-alternatives --install ${base_bindir}/$i $i $i.${PN} 100; done 66ALTERNATIVE_PRIORITY = "100"
74 67
75 for i in ${sbindir_progs}; do update-alternatives --install ${sbindir}/$i $i $i.${PN} 100; done 68ALTERNATIVE_${PN} = "lbraket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs}"
76
77 # Special cases. uptime and hostname is broken, prefer busybox's version. [ needs to be treated separately.
78 update-alternatives --install ${bindir}/uptime uptime uptime.${PN} 10
79 update-alternatives --install ${base_bindir}/hostname hostname hostname.${PN} 10
80 update-alternatives --install '${bindir}/[' '[' 'lbracket.${PN}' 100
81}
82 69
83pkg_prerm_${PN} () { 70ALTERNATIVE_PRIORITY[uptime] = "10"
84 for i in ${bindir_progs}; do update-alternatives --remove $i $i.${PN}; done 71ALTERNATIVE_PRIORITY[hostname] = "10"
85 72
86 for i in ${base_bindir_progs}; do update-alternatives --remove $i $i.${PN}; done 73ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/["
74ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}"
87 75
88 for i in ${sbindir_progs}; do update-alternatives --remove $i $i.${PN}; done 76python __anonymous() {
77 for prog in d.getVar('base_bindir_progs', True).split():
78 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir', True), prog))
89 79
90 # The special cases 80 for prog in d.getVar('sbindir_progs', True).split():
91 update-alternatives --remove hostname hostname.${PN} 81 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir', True), prog))
92 update-alternatives --remove uptime uptime.${PN}
93 update-alternatives --remove '[' 'lbracket.${PN}'
94} 82}
95 83
96BBCLASSEXTEND = "native" 84BBCLASSEXTEND = "native"
diff --git a/meta/recipes-core/coreutils/coreutils_8.14.bb b/meta/recipes-core/coreutils/coreutils_8.14.bb
index 688cec9458..214bedb886 100644
--- a/meta/recipes-core/coreutils/coreutils_8.14.bb
+++ b/meta/recipes-core/coreutils/coreutils_8.14.bb
@@ -7,7 +7,7 @@ BUGTRACKER = "http://debbugs.gnu.org/coreutils"
7LICENSE = "GPLv3+" 7LICENSE = "GPLv3+"
8LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504\ 8LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504\
9 file://src/ls.c;startline=5;endline=16;md5=e1a509558876db58fb6667ba140137ad" 9 file://src/ls.c;startline=5;endline=16;md5=e1a509558876db58fb6667ba140137ad"
10PR = "r3" 10PR = "r4"
11DEPENDS = "gmp libcap" 11DEPENDS = "gmp libcap"
12DEPENDS_virtclass-native = "" 12DEPENDS_virtclass-native = ""
13 13
@@ -36,52 +36,45 @@ base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdi
36sbindir_progs= "chroot" 36sbindir_progs= "chroot"
37 37
38do_install_append() { 38do_install_append() {
39 for i in ${bindir_progs} df mktemp base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN}; done 39 for i in df mktemp base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done
40 40
41 install -d ${D}${base_bindir} 41 install -d ${D}${base_bindir}
42 for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${PN}; done 42 [ "${base_bindir}" != "${bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${BPN}; done
43 43
44 install -d ${D}${sbindir} 44 install -d ${D}${sbindir}
45 for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${PN}; done 45 [ "${sbindir}" != "${bindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${BPN}; done
46 46
47 # [ requires special handling because [.coreutils will cause the sed stuff 47 # [ requires special handling because [.coreutils will cause the sed stuff
48 # in update-alternatives to fail, therefore use lbracket - the name used 48 # in update-alternatives to fail, therefore use lbracket - the name used
49 # for the actual source file. 49 # for the actual source file.
50 mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${PN} 50 mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN}
51 install -d ${D}${libdir}/coreutils 51 install -d ${D}${libdir}/coreutils
52 mv ${D}${libexecdir}/coreutils/libstdbuf.so ${D}${libdir}/coreutils 52 mv ${D}${libexecdir}/coreutils/libstdbuf.so ${D}${libdir}/coreutils
53} 53}
54 54
55pkg_postinst_${PN} () { 55inherit update-alternatives
56 for i in ${bindir_progs}; do update-alternatives --install ${bindir}/$i $i $i.${PN} 100; done
57 56
58 for i in ${base_bindir_progs}; do update-alternatives --install ${base_bindir}/$i $i $i.${PN} 100; done 57ALTERNATIVE_PRIORITY = "100"
58ALTERNATIVE_${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base64 mktemp df"
59 59
60 for i in ${sbindir_progs}; do update-alternatives --install ${sbindir}/$i $i $i.${PN} 100; done 60ALTERNATIVE_LINK_NAME[base64] = "${base_bindir}/base64"
61ALTERNATIVE_TARGET[base64] = "${bindir}/base64.${BPN}"
61 62
62 # Special cases. [ needs to be treated separately. 63ALTERNATIVE_LINK_NAME[mktemp] = "${base_bindir}/mktemp"
63 update-alternatives --install '${bindir}/[' '[' 'lbracket.${PN}' 100 64ALTERNATIVE_TARGET[mktemp] = "${bindir}/mktemp.${BPN}"
64
65 # Special cases. base64, mktemp and df need to be treated separately, because busybox have them in base_binding not bindir
66 update-alternatives --install ${base_bindir}/base64 base64 ${bindir}/base64.${PN} 100;
67 update-alternatives --install ${base_bindir}/mktemp mktemp ${bindir}/mktemp.${PN} 100;
68 update-alternatives --install ${base_bindir}/df df ${bindir}/df.${PN} 100;
69}
70 65
71pkg_prerm_${PN} () { 66ALTERNATIVE_LINK_NAME[df] = "${base_bindir}/df"
72 for i in ${bindir_progs}; do update-alternatives --remove $i $i.${PN}; done 67ALTERNATIVE_TARGET[df] = "${bindir}/df.${BPN}"
73 68
74 for i in ${base_bindir_progs}; do update-alternatives --remove $i $i.${PN}; done 69ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/["
70ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}"
75 71
76 for i in ${sbindir_progs}; do update-alternatives --remove $i $i.${PN}; done 72python __anonymous() {
73 for prog in d.getVar('base_bindir_progs', True).split():
74 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir', True), prog))
77 75
78 # The special cases 76 for prog in d.getVar('sbindir_progs', True).split():
79 update-alternatives --remove hostname hostname.${PN} 77 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir', True), prog))
80 update-alternatives --remove uptime uptime.${PN}
81 update-alternatives --remove '[' 'lbracket.${PN}'
82 update-alternatives --remove base64 ${bindir}/base64.${PN}
83 update-alternatives --remove mktemp ${bindir}/mktemp.${PN}
84 update-alternatives --remove df ${bindir}.df.${PN}
85} 78}
86 79
87BBCLASSEXTEND = "native" 80BBCLASSEXTEND = "native"