summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2012-05-15 18:34:17 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-30 12:04:41 +0100
commit92482cb4962fd79a07078f0fea372fdc200ed76c (patch)
tree73886becf07c304ef18ca83d58bfd208bc6c1111
parent6b20156b0c6f5f47388ce5f5fd130fa15bf4e0c2 (diff)
downloadpoky-92482cb4962fd79a07078f0fea372fdc200ed76c.tar.gz
busybox: use new update-alternatives
(From OE-Core rev: fbbc96aed5086f853a1179f1478ccd252af24094) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/busybox/busybox.inc66
-rw-r--r--meta/recipes-core/busybox/busybox_1.19.4.bb2
2 files changed, 23 insertions, 45 deletions
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index 1613878c3f..5b83d32fc1 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -201,36 +201,36 @@ do_install () {
201 install -m 0644 ${S}/busybox.links ${D}${sysconfdir} 201 install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
202} 202}
203 203
204python package_do_filedeps_append () { 204inherit update-alternatives
205 # We need to load the full set of busybox provides from the /etc/busybox.links 205
206 # The pkg_postinst_ is what creates the actual links 206ALTERNATIVE_PRIORITY = "50"
207 207
208 pkg = d.getVar('PN', True) 208ALTERNATIVE_${PN}-syslog = "syslog-init syslog-startup-conf"
209 f_busybox = "/bin/busybox"
210 f_busybox_links = "/etc/busybox.links"
211 209
212 requires_files = [] 210ALTERNATIVE_LINK_NAME[syslog-init] = "${sysconfdir}/init.d/syslog"
213 provides_files = []
214 211
215 # Load/backup original set 212ALTERNATIVE_LINK_NAME[syslog-startup-conf] = "${sysconfdir}/syslog-startup.conf"
216 filerprovides = d.getVar('FILERPROVIDES_%s_%s' % (f_busybox, pkg), True) or ""
217 213
218 dep_pipe = os.popen('sed -e "s,^,%s/%s%s Provides: ," %s/%s%s' % (pkgdest, pkg, f_busybox, pkgdest, pkg, f_busybox_links)) 214ALTERNATIVE_TARGET = "/bin/busybox"
215
216python do_package_prepend () {
217 # We need to load the full set of busybox provides from the /etc/busybox.links
218 # Use this to see the update-alternatives with the right information
219 219
220 process_deps(dep_pipe, pkg, provides_files, requires_files) 220 dvar = d.getVar('D', True)
221 pn = d.getVar('PN', True)
222 f = open('%s/etc/busybox.links' % (dvar), 'r')
221 223
222 # Add the new set 224 for alt_link_name in f:
223 filerprovides += d.getVar('FILERPROVIDES_%s_%s' % (f_busybox, pkg), True) or "" 225 alt_link_name = alt_link_name.strip()
226 alt_name = os.path.basename(alt_link_name)
224 227
225 # Make sure there is an entry for this item in the FILERPROVIDESFLIST... 228 # Match coreutils
226 filerprovidesflist = (d.getVar('FILERPROVIDESFLIST_%s' % pkg, True) or "").split() 229 if alt_name == '[':
227 for file in provides_files: 230 alt_name = 'lbracket'
228 if file not in filerprovidesflist:
229 filerprovidesflist.append(file)
230 d.setVar('FILERPROVIDESFLIST_%s' % pkg, " ".join(filerprovidesflist))
231 231
232 # Store the new provides 232 d.appendVar('ALTERNATIVE_%s' % (pn), ' ' + alt_name)
233 d.setVar('FILERPROVIDES_%s_%s' % (f_busybox, pkg), filerprovides) 233 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name)
234} 234}
235 235
236pkg_postinst_${PN} () { 236pkg_postinst_${PN} () {
@@ -239,14 +239,6 @@ pkg_postinst_${PN} () {
239 # (update-alternatives have no problem replacing links later anyway) 239 # (update-alternatives have no problem replacing links later anyway)
240 test -n 2> /dev/null || alias test='busybox test' 240 test -n 2> /dev/null || alias test='busybox test'
241 if test "x$D" = "x"; then while read link; do if test ! -h "$link"; then case "$link" in /*/*/*) to="../../bin/busybox";; /bin/*) to="busybox";; /*/*) to="../bin/busybox";; esac; busybox ln -s $to $link; fi; done </etc/busybox.links; fi 241 if test "x$D" = "x"; then while read link; do if test ! -h "$link"; then case "$link" in /*/*/*) to="../../bin/busybox";; /bin/*) to="busybox";; /*/*) to="../bin/busybox";; esac; busybox ln -s $to $link; fi; done </etc/busybox.links; fi
242
243 # This adds the links, remember that this has to work when building an image too, hence the $D
244 while read link; do case "$link" in /*/*/*) to="../../bin/busybox";; /bin/*) to="busybox";; /*/*) to="../bin/busybox";; esac; bn=`basename $link`; update-alternatives --install $link $bn $to 50; done <$D/etc/busybox.links
245}
246
247pkg_postinst_${PN}-syslog () {
248 update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${BPN} 50
249 update-alternatives --install ${sysconfdir}/syslog-startup.conf syslog-startup-conf syslog-startup.conf.${BPN} 50
250} 242}
251 243
252pkg_prerm_${PN} () { 244pkg_prerm_${PN} () {
@@ -268,17 +260,6 @@ pkg_prerm_${PN} () {
268 ln -s /bin/busybox $tmpdir/sort 260 ln -s /bin/busybox $tmpdir/sort
269 ln -s /bin/busybox $tmpdir/grep 261 ln -s /bin/busybox $tmpdir/grep
270 export PATH=$PATH:$tmpdir 262 export PATH=$PATH:$tmpdir
271
272 while read link
273 do
274 case "$link" in
275 /*/*/*) to="../../bin/busybox";;
276 /bin/*) to="busybox";;
277 /*/*) to="../bin/busybox";;
278 esac
279 bn=`basename $link`
280 sh /usr/bin/update-alternatives --remove $bn $to
281 done </etc/busybox.links
282} 263}
283 264
284pkg_prerm_${PN}-syslog () { 265pkg_prerm_${PN}-syslog () {
@@ -288,7 +269,4 @@ pkg_prerm_${PN}-syslog () {
288 /etc/init.d/syslog stop 269 /etc/init.d/syslog stop
289 fi 270 fi
290 fi 271 fi
291
292 update-alternatives --remove syslog-init syslog.${BPN}
293 update-alternatives --remove syslog-startup-conf syslog-startup.conf.${BPN}
294} 272}
diff --git a/meta/recipes-core/busybox/busybox_1.19.4.bb b/meta/recipes-core/busybox/busybox_1.19.4.bb
index a797ac9392..0717075bbc 100644
--- a/meta/recipes-core/busybox/busybox_1.19.4.bb
+++ b/meta/recipes-core/busybox/busybox_1.19.4.bb
@@ -1,5 +1,5 @@
1require busybox.inc 1require busybox.inc
2PR = "r5" 2PR = "r6"
3 3
4SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ 4SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
5 file://B921600.patch \ 5 file://B921600.patch \