All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] alsa-utils: Fix error when removing unwanted udev rules
@ 2018-05-01 11:36 Mike Crowe
  2018-05-01 15:22 ` Tanu Kaskinen
  2018-05-02  8:39 ` Peter Kjellerstedt
  0 siblings, 2 replies; 6+ messages in thread
From: Mike Crowe @ 2018-05-01 11:36 UTC (permalink / raw)
  To: openembedded-core; +Cc: Mike Crowe, Peter Kjellerstedt

If alsa-utils configure is not passed a --with-udev-rules-dir option then
it defaults to using /lib/udev/rules.d. This meant that the hard-coded use
of ${D}/lib in do_install in 262e69c9c7acf0beb7bb6b96299e3c993c906434
worked correctly to remove the unwanted rules.

Subsequently, 0a4372705a030ca54ed420cdfec33d46ab93499c changed do_install
to use ${nonarch_base_libdir}, claiming to fix this in the usrmerge case.

This means that if udev is not present in PACKAGECONFIG and usrmerge is
present in DISTRO_FEATURES then the alsa-utils build system will install
the rules in ${D}/lib/udev/rules.d but do_install will attempt to remove
${D}/usr/lib, resulting in something like:

 rmdir: failed to remove '.../tmp-glibc/work/i586-oe-linux/alsa-utils/1.1.5-r0/image/usr/lib': No such file or directory

To fix this, let's just tell configure to install the rules in a specific
known location when udev is disabled. This location can then easily be
cleaned up in do_install.

Tested both with and without usrmerge in DISTRO_FEATURES.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Cc: Phil Blundell <pb@pbcl.net>
Cc: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb b/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb
index f2231f34f0..5561b4de3f 100644
--- a/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb
+++ b/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb
@@ -16,7 +16,7 @@ PACKAGECONFIG ??= "udev"
 # or no alsabat at all.
 PACKAGECONFIG[bat] = "--enable-bat,--disable-bat,fftwf"
 
-PACKAGECONFIG[udev] = "--with-udev-rules-dir=`pkg-config --variable=udevdir udev`/rules.d,,udev"
+PACKAGECONFIG[udev] = "--with-udev-rules-dir=`pkg-config --variable=udevdir udev`/rules.d,--with-udev-rules-dir=/unwanted/rules.d,udev"
 PACKAGECONFIG[manpages] = "--enable-xmlto, --disable-xmlto, xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
 
 SRC_URI = "ftp://ftp.alsa-project.org/pub/utils/alsa-utils-${PV}.tar.bz2 \
@@ -102,8 +102,8 @@ do_install() {
 	rm -f ${D}${sbindir}/alsabat-test.sh
 
 	if ${@bb.utils.contains('PACKAGECONFIG', 'udev', 'false', 'true', d)}; then
-		# This is where alsa-utils will install its rules if we don't tell it anything else.
-		rm -rf ${D}${nonarch_base_libdir}/udev
-		rmdir --ignore-fail-on-non-empty ${D}${nonarch_base_libdir}
+        	# If udev is disabled, we told configure to install the rules in /unwanted, so
+        	# we can get rid of them now.
+        	rm -rf ${D}/unwanted
 	fi
 }
-- 
2.11.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] alsa-utils: Fix error when removing unwanted udev rules
  2018-05-01 11:36 [PATCH] alsa-utils: Fix error when removing unwanted udev rules Mike Crowe
@ 2018-05-01 15:22 ` Tanu Kaskinen
  2018-05-02  8:39 ` Peter Kjellerstedt
  1 sibling, 0 replies; 6+ messages in thread
From: Tanu Kaskinen @ 2018-05-01 15:22 UTC (permalink / raw)
  To: openembedded-core

On Tue, 2018-05-01 at 12:36 +0100, Mike Crowe wrote:
> If alsa-utils configure is not passed a --with-udev-rules-dir option then
> it defaults to using /lib/udev/rules.d. This meant that the hard-coded use
> of ${D}/lib in do_install in 262e69c9c7acf0beb7bb6b96299e3c993c906434
> worked correctly to remove the unwanted rules.
> 
> Subsequently, 0a4372705a030ca54ed420cdfec33d46ab93499c changed do_install
> to use ${nonarch_base_libdir}, claiming to fix this in the usrmerge case.
> 
> This means that if udev is not present in PACKAGECONFIG and usrmerge is
> present in DISTRO_FEATURES then the alsa-utils build system will install
> the rules in ${D}/lib/udev/rules.d but do_install will attempt to remove
> ${D}/usr/lib, resulting in something like:
> 
>  rmdir: failed to remove '.../tmp-glibc/work/i586-oe-linux/alsa-utils/1.1.5-r0/image/usr/lib': No such file or directory
> 
> To fix this, let's just tell configure to install the rules in a specific
> known location when udev is disabled. This location can then easily be
> cleaned up in do_install.
> 
> Tested both with and without usrmerge in DISTRO_FEATURES.
> 
> Signed-off-by: Mike Crowe <mac@mcrowe.com>
> Cc: Phil Blundell <pb@pbcl.net>
> Cc: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---
>  meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Looks good to me.

-- 
Tanu

https://liberapay.com/tanuk
https://www.patreon.com/tanuk


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] alsa-utils: Fix error when removing unwanted udev rules
  2018-05-01 11:36 [PATCH] alsa-utils: Fix error when removing unwanted udev rules Mike Crowe
  2018-05-01 15:22 ` Tanu Kaskinen
@ 2018-05-02  8:39 ` Peter Kjellerstedt
  2018-05-02 13:38   ` [PATCHv2] " Mike Crowe
  2018-05-02 13:40   ` [PATCH] " Mike Crowe
  1 sibling, 2 replies; 6+ messages in thread
From: Peter Kjellerstedt @ 2018-05-02  8:39 UTC (permalink / raw)
  To: Mike Crowe, openembedded-core

> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org
> [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of
> Mike Crowe
> Sent: den 1 maj 2018 13:37
> To: openembedded-core@lists.openembedded.org
> Cc: Mike Crowe <mac@mcrowe.com>; Peter Kjellerstedt
> <peter.kjellerstedt@axis.com>
> Subject: [OE-core] [PATCH] alsa-utils: Fix error when removing unwanted
> udev rules
> 
> If alsa-utils configure is not passed a --with-udev-rules-dir option then
> it defaults to using /lib/udev/rules.d. This meant that the hard-coded use
> of ${D}/lib in do_install in 262e69c9c7acf0beb7bb6b96299e3c993c906434
> worked correctly to remove the unwanted rules.
> 
> Subsequently, 0a4372705a030ca54ed420cdfec33d46ab93499c changed do_install
> to use ${nonarch_base_libdir}, claiming to fix this in the usrmerge case.
> 
> This means that if udev is not present in PACKAGECONFIG and usrmerge is
> present in DISTRO_FEATURES then the alsa-utils build system will install
> the rules in ${D}/lib/udev/rules.d but do_install will attempt to remove
> ${D}/usr/lib, resulting in something like:
> 
>  rmdir: failed to remove '.../tmp-glibc/work/i586-oe-linux/alsa-utils/1.1.5-r0/image/usr/lib': No such file or directory
> 
> To fix this, let's just tell configure to install the rules in a specific
> known location when udev is disabled. This location can then easily be
> cleaned up in do_install.
> 
> Tested both with and without usrmerge in DISTRO_FEATURES.
> 
> Signed-off-by: Mike Crowe <mac@mcrowe.com>
> Cc: Phil Blundell <pb@pbcl.net>
> Cc: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---
>  meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb b/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb
> index f2231f34f0..5561b4de3f 100644
> --- a/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb
> +++ b/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb
> @@ -16,7 +16,7 @@ PACKAGECONFIG ??= "udev"
>  # or no alsabat at all.
>  PACKAGECONFIG[bat] = "--enable-bat,--disable-bat,fftwf"
> 
> -PACKAGECONFIG[udev] = "--with-udev-rules-dir=`pkg-config --variable=udevdir udev`/rules.d,,udev"
> +PACKAGECONFIG[udev] = "--with-udev-rules-dir=`pkg-config --variable=udevdir udev`/rules.d,--with-udev-rules-dir=/unwanted/rules.d,udev"
>  PACKAGECONFIG[manpages] = "--enable-xmlto, --disable-xmlto, xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
> 
>  SRC_URI = "ftp://ftp.alsa-project.org/pub/utils/alsa-utils-${PV}.tar.bz2 \
> @@ -102,8 +102,8 @@ do_install() {
>  	rm -f ${D}${sbindir}/alsabat-test.sh
> 
>  	if ${@bb.utils.contains('PACKAGECONFIG', 'udev', 'false', 'true', d)}; then

I suggest that you remove the if-statement since the /unwanted directory 
shall always be removed if it exists so there is no need to test for it.

> -		# This is where alsa-utils will install its rules if we don't tell it anything else.
> -		rm -rf ${D}${nonarch_base_libdir}/udev
> -		rmdir --ignore-fail-on-non-empty ${D}${nonarch_base_libdir}
> +        	# If udev is disabled, we told configure to install the rules in /unwanted, so
> +        	# we can get rid of them now.
> +        	rm -rf ${D}/unwanted

Correct the indentation (the rest of the function is indented using tabs).

>  	fi
>  }
> --
> 2.11.0

//Peter



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCHv2] alsa-utils: Fix error when removing unwanted udev rules
  2018-05-02  8:39 ` Peter Kjellerstedt
@ 2018-05-02 13:38   ` Mike Crowe
  2018-05-02 15:18     ` Peter Kjellerstedt
  2018-05-02 13:40   ` [PATCH] " Mike Crowe
  1 sibling, 1 reply; 6+ messages in thread
From: Mike Crowe @ 2018-05-02 13:38 UTC (permalink / raw)
  To: openembedded-core; +Cc: Mike Crowe, Peter Kjellerstedt

If alsa-utils configure is not passed a --with-udev-rules-dir option then
it defaults to using /lib/udev/rules.d. This meant that the hard-coded use
of ${D}/lib in do_install in 262e69c9c7acf0beb7bb6b96299e3c993c906434
worked correctly to remove the unwanted rules.

Subsequently, 0a4372705a030ca54ed420cdfec33d46ab93499c changed do_install
to use ${nonarch_base_libdir}, claiming to fix this in the usrmerge case.

This means that if udev is not present in PACKAGECONFIG and usrmerge is
present in DISTRO_FEATURES then the alsa-utils build system will install
the rules in ${D}/lib/udev/rules.d but do_install will attempt to remove
${D}/usr/lib, resulting in something like:

 rmdir: failed to remove '.../tmp-glibc/work/i586-oe-linux/alsa-utils/1.1.5-r0/image/usr/lib': No such file or directory

To fix this, let's just tell configure to install the rules in a specific
known location when udev is disabled. This location can then easily be
cleaned up in do_install without doing any harm if udev is enabled.

Tested both with and without usrmerge in DISTRO_FEATURES and with and
without udev in PACKAGECONFIG.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Cc: Phil Blundell <pb@pbcl.net>
Cc: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb b/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb
index f2231f34f0..33215bf159 100644
--- a/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb
+++ b/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb
@@ -16,7 +16,7 @@ PACKAGECONFIG ??= "udev"
 # or no alsabat at all.
 PACKAGECONFIG[bat] = "--enable-bat,--disable-bat,fftwf"
 
-PACKAGECONFIG[udev] = "--with-udev-rules-dir=`pkg-config --variable=udevdir udev`/rules.d,,udev"
+PACKAGECONFIG[udev] = "--with-udev-rules-dir=`pkg-config --variable=udevdir udev`/rules.d,--with-udev-rules-dir=/unwanted/rules.d,udev"
 PACKAGECONFIG[manpages] = "--enable-xmlto, --disable-xmlto, xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
 
 SRC_URI = "ftp://ftp.alsa-project.org/pub/utils/alsa-utils-${PV}.tar.bz2 \
@@ -101,9 +101,8 @@ do_install() {
 	rm ${D}${sbindir}/alsa-info.sh
 	rm -f ${D}${sbindir}/alsabat-test.sh
 
-	if ${@bb.utils.contains('PACKAGECONFIG', 'udev', 'false', 'true', d)}; then
-		# This is where alsa-utils will install its rules if we don't tell it anything else.
-		rm -rf ${D}${nonarch_base_libdir}/udev
-		rmdir --ignore-fail-on-non-empty ${D}${nonarch_base_libdir}
-	fi
+	# If udev is disabled, we told configure to install the rules
+	# in /unwanted, so we can remove them now. If udev is enabled,
+	# then /unwanted won't exist and this will have no effect.
+	rm -rf ${D}/unwanted
 }
-- 
2.11.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] alsa-utils: Fix error when removing unwanted udev rules
  2018-05-02  8:39 ` Peter Kjellerstedt
  2018-05-02 13:38   ` [PATCHv2] " Mike Crowe
@ 2018-05-02 13:40   ` Mike Crowe
  1 sibling, 0 replies; 6+ messages in thread
From: Mike Crowe @ 2018-05-02 13:40 UTC (permalink / raw)
  To: Peter Kjellerstedt, openembedded-core

On Wednesday 02 May 2018 at 08:39:27 +0000, Peter Kjellerstedt wrote:
> >  	if ${@bb.utils.contains('PACKAGECONFIG', 'udev', 'false', 'true', d)}; then
> 
> I suggest that you remove the if-statement since the /unwanted directory 
> shall always be removed if it exists so there is no need to test for it.

I had wondered about doing that myself, but had decided to make as few
changes as possible.

> > -		# This is where alsa-utils will install its rules if we don't tell it anything else.
> > -		rm -rf ${D}${nonarch_base_libdir}/udev
> > -		rmdir --ignore-fail-on-non-empty ${D}${nonarch_base_libdir}
> > +        	# If udev is disabled, we told configure to install the rules in /unwanted, so
> > +        	# we can get rid of them now.
> > +        	rm -rf ${D}/unwanted
> 
> Correct the indentation (the rest of the function is indented using
> tabs).

I'd spotted that, and had thought that I'd sorted it out. It turns out that
I ended up making it even worse with a mixture of spaces and tabs. :(

Hopefully v2 is better.

Thanks.

Mike.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] alsa-utils: Fix error when removing unwanted udev rules
  2018-05-02 13:38   ` [PATCHv2] " Mike Crowe
@ 2018-05-02 15:18     ` Peter Kjellerstedt
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Kjellerstedt @ 2018-05-02 15:18 UTC (permalink / raw)
  To: Mike Crowe, openembedded-core

> -----Original Message-----
> From: Mike Crowe [mailto:mac@mcrowe.com]
> Sent: den 2 maj 2018 15:38
> To: openembedded-core@lists.openembedded.org
> Cc: Mike Crowe <mac@mcrowe.com>; Phil Blundell <pb@pbcl.net>; Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> Subject: [PATCHv2] alsa-utils: Fix error when removing unwanted udev rules
> 
> If alsa-utils configure is not passed a --with-udev-rules-dir option then
> it defaults to using /lib/udev/rules.d. This meant that the hard-coded use
> of ${D}/lib in do_install in 262e69c9c7acf0beb7bb6b96299e3c993c906434
> worked correctly to remove the unwanted rules.
> 
> Subsequently, 0a4372705a030ca54ed420cdfec33d46ab93499c changed do_install
> to use ${nonarch_base_libdir}, claiming to fix this in the usrmerge case.
> 
> This means that if udev is not present in PACKAGECONFIG and usrmerge is
> present in DISTRO_FEATURES then the alsa-utils build system will install
> the rules in ${D}/lib/udev/rules.d but do_install will attempt to remove
> ${D}/usr/lib, resulting in something like:
> 
>  rmdir: failed to remove '.../tmp-glibc/work/i586-oe-linux/alsa-utils/1.1.5-r0/image/usr/lib': No such file or directory
> 
> To fix this, let's just tell configure to install the rules in a specific
> known location when udev is disabled. This location can then easily be
> cleaned up in do_install without doing any harm if udev is enabled.
> 
> Tested both with and without usrmerge in DISTRO_FEATURES and with and
> without udev in PACKAGECONFIG.
> 
> Signed-off-by: Mike Crowe <mac@mcrowe.com>
> Cc: Phil Blundell <pb@pbcl.net>
> Cc: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---
>  meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb b/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb
> index f2231f34f0..33215bf159 100644
> --- a/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb
> +++ b/meta/recipes-multimedia/alsa/alsa-utils_1.1.5.bb
> @@ -16,7 +16,7 @@ PACKAGECONFIG ??= "udev"
>  # or no alsabat at all.
>  PACKAGECONFIG[bat] = "--enable-bat,--disable-bat,fftwf"
> 
> -PACKAGECONFIG[udev] = "--with-udev-rules-dir=`pkg-config --variable=udevdir udev`/rules.d,,udev"
> +PACKAGECONFIG[udev] = "--with-udev-rules-dir=`pkg-config --variable=udevdir udev`/rules.d,--with-udev-rules-dir=/unwanted/rules.d,udev"
>  PACKAGECONFIG[manpages] = "--enable-xmlto, --disable-xmlto, xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
> 
>  SRC_URI = "ftp://ftp.alsa-project.org/pub/utils/alsa-utils-
> ${PV}.tar.bz2 \
> @@ -101,9 +101,8 @@ do_install() {
>  	rm ${D}${sbindir}/alsa-info.sh
>  	rm -f ${D}${sbindir}/alsabat-test.sh
> 
> -	if ${@bb.utils.contains('PACKAGECONFIG', 'udev', 'false', 'true', d)}; then
> -		# This is where alsa-utils will install its rules if we don't tell it anything else.
> -		rm -rf ${D}${nonarch_base_libdir}/udev
> -		rmdir --ignore-fail-on-non-empty ${D}${nonarch_base_libdir}
> -	fi
> +	# If udev is disabled, we told configure to install the rules
> +	# in /unwanted, so we can remove them now. If udev is enabled,
> +	# then /unwanted won't exist and this will have no effect.
> +	rm -rf ${D}/unwanted
>  }
> --
> 2.11.0

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>

//Peter



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-02 15:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-01 11:36 [PATCH] alsa-utils: Fix error when removing unwanted udev rules Mike Crowe
2018-05-01 15:22 ` Tanu Kaskinen
2018-05-02  8:39 ` Peter Kjellerstedt
2018-05-02 13:38   ` [PATCHv2] " Mike Crowe
2018-05-02 15:18     ` Peter Kjellerstedt
2018-05-02 13:40   ` [PATCH] " Mike Crowe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.