Patchwork [1/8] udev: fix dependency and location of udevadm

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date Nov. 9, 2013, 5:28 a.m.
Message ID <5bcdd19de289a55e7cc28a1d0d4f09ea6ec4be41.1383974819.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/61355/
State New
Headers show

Comments

Qi.Chen@windriver.com - Nov. 9, 2013, 5:28 a.m.
From: Chen Qi <qi.chen@windriver.com>

As udev's init script needs udevadm, we should make udev RDEPEND on
udev-utils instead of just recommends it.

Also, move udevadm from /usr/bin to /bin. The purpose is to make udev
start correctly even if /usr is missing.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-core/udev/udev.inc |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Phil Blundell - Nov. 9, 2013, 10:54 p.m.
On Sat, 2013-11-09 at 13:28 +0800, Qi.Chen@windriver.com wrote:
> +	install -d ${D}${base_bindir}
> +	mv ${D}${bindir}/udevadm ${D}${base_bindir}/udevadm
> +	rmdir ${D}${bindir}

This will fail if ${bindir} and ${base_bindir} are the same.

p.
Qi.Chen@windriver.com - Nov. 11, 2013, 2:18 a.m.
On 11/10/2013 06:54 AM, Phil Blundell wrote:
> On Sat, 2013-11-09 at 13:28 +0800, Qi.Chen@windriver.com wrote:
>> +	install -d ${D}${base_bindir}
>> +	mv ${D}${bindir}/udevadm ${D}${base_bindir}/udevadm
>> +	rmdir ${D}${bindir}
> This will fail if ${bindir} and ${base_bindir} are the same.
>
> p.
>
>
>
>

In udev recipe, they are not defined as the same one.
And moving something from bindir to base_bindir doesn't seem uncommon in 
OE, you can grep the project using the following command.

grep -Ri 'mv.*bindir.*base_bindir' meta/*

Best Regards,
Chen Qi
Phil Blundell - Nov. 11, 2013, 10:53 a.m.
On Mon, 2013-11-11 at 10:18 +0800, ChenQi wrote:
> On 11/10/2013 06:54 AM, Phil Blundell wrote:
> > On Sat, 2013-11-09 at 13:28 +0800, Qi.Chen@windriver.com wrote:
> >> +	install -d ${D}${base_bindir}
> >> +	mv ${D}${bindir}/udevadm ${D}${base_bindir}/udevadm
> >> +	rmdir ${D}${bindir}
> > This will fail if ${bindir} and ${base_bindir} are the same.
> >
> > p.
> >
> >
> >
> >
> 
> In udev recipe, they are not defined as the same one.

Those variables are part of the distro configuration.  Individual
recipes don't, in general, set them.

> And moving something from bindir to base_bindir doesn't seem uncommon in 
> OE, you can grep the project using the following command.
> 
> grep -Ri 'mv.*bindir.*base_bindir' meta/*

A better command to use would be:

grep -C 4 -Ri 'mv.*bindir.*base_bindir' meta/*

which reveals that most of these "mv" commands are enclosed in a
conditional that checks whether the two directories are indeed different
before trying to move them.

It's true that a few of the things in recipes-extended do appear to be
broken.  cpio, for example, was broken by
6dee3050a4a0c4f3cc9fec23a0bc02155d680863; gzip was broken by
e0626a0270fb0f4ff128e761c13d44162723434c; mktemp was broken by
4807d938023ce06f2924c8a0503c32d083be23b5.  All of these three patches
seem to be well-intentioned attempts to improve the handling of
update-alternatives and I guess those recipes are obscure enough that
nobody has noticed before now that there is anything wrong with them.

p.
Qi.Chen@windriver.com - Nov. 11, 2013, 11:28 a.m.
On 11/11/2013 06:53 PM, Phil Blundell wrote:
> On Mon, 2013-11-11 at 10:18 +0800, ChenQi wrote:
>> On 11/10/2013 06:54 AM, Phil Blundell wrote:
>>> On Sat, 2013-11-09 at 13:28 +0800, Qi.Chen@windriver.com wrote:
>>>> +	install -d ${D}${base_bindir}
>>>> +	mv ${D}${bindir}/udevadm ${D}${base_bindir}/udevadm
>>>> +	rmdir ${D}${bindir}
>>> This will fail if ${bindir} and ${base_bindir} are the same.
>>>
>>> p.
>>>
>>>
>>>
>>>
>> In udev recipe, they are not defined as the same one.
> Those variables are part of the distro configuration.  Individual
> recipes don't, in general, set them.
>
>> And moving something from bindir to base_bindir doesn't seem uncommon in
>> OE, you can grep the project using the following command.
>>
>> grep -Ri 'mv.*bindir.*base_bindir' meta/*
> A better command to use would be:
>
> grep -C 4 -Ri 'mv.*bindir.*base_bindir' meta/*

Thanks for pointing it out :)

Currently I'm not sure whether we support configuring ${bindir} to equal 
to ${base_bindir}, but maybe we will support this such configuration in 
the future.
So I'll send out V2 of this patch.

Thanks,
Chen Qi

> which reveals that most of these "mv" commands are enclosed in a
> conditional that checks whether the two directories are indeed different
> before trying to move them.
>
> It's true that a few of the things in recipes-extended do appear to be
> broken.  cpio, for example, was broken by
> 6dee3050a4a0c4f3cc9fec23a0bc02155d680863; gzip was broken by
> e0626a0270fb0f4ff128e761c13d44162723434c; mktemp was broken by
> 4807d938023ce06f2924c8a0503c32d083be23b5.  All of these three patches
> seem to be well-intentioned attempts to improve the handling of
> update-alternatives and I guess those recipes are obscure enough that
> nobody has noticed before now that there is anything wrong with them.
>
> p.
>
>
>
>

Patch

diff --git a/meta/recipes-core/udev/udev.inc b/meta/recipes-core/udev/udev.inc
index 02cab3b..69ce123 100644
--- a/meta/recipes-core/udev/udev.inc
+++ b/meta/recipes-core/udev/udev.inc
@@ -55,7 +55,8 @@  INITSCRIPT_NAME_udev-cache = "udev-cache"
 INITSCRIPT_PARAMS_udev-cache = "start 36 S ."
 
 FILES_${PN} += "${libexecdir} ${libdir}/ConsoleKit ${nonarch_base_libdir}/udev"
-RRECOMMENDS_${PN} += "udev-utils udev-cache"
+RRECOMMENDS_${PN} += "udev-cache"
+RDEPENDS_${PN} += "udev-utils"
 
 FILES_${PN}-dbg += "${libexecdir}/.debug"
 FILES_${PN}-dbg += "${base_libdir}/udev/.debug/"
@@ -72,7 +73,7 @@  FILES_libgudev-dev = "${includedir}/gudev* ${libdir}/libgudev*.so ${libdir}/libg
                      ${libdir}/libgudev*.a ${libdir}/pkgconfig/gudev*.pc"
 FILES_udev-cache = "${sysconfdir}/init.d/udev-cache ${sysconfdir}/default/udev-cache"
 
-FILES_udev-utils = "${bindir}/udevadm"
+FILES_udev-utils = "${base_bindir}/udevadm"
 
 do_install_append () {
 	install -d ${D}${sysconfdir}/init.d
@@ -87,9 +88,12 @@  do_install_append () {
 	touch ${D}${sysconfdir}/udev/cache.data
 
 	install -d ${D}${sysconfdir}/udev/rules.d/
-
 	install -m 0644 ${WORKDIR}/local.rules         ${D}${sysconfdir}/udev/rules.d/local.rules
 
+	install -d ${D}${base_bindir}
+	mv ${D}${bindir}/udevadm ${D}${base_bindir}/udevadm
+	rmdir ${D}${bindir}
+
 	# hid2hci has moved to bluez4. removed in udev as of version 169
 	rm -f ${D}${base_libdir}/udev/hid2hci