Openembedded Devel Discussions
 help / color / mirror / Atom feed
* [meta-networking][PATCH] recipes-connectivity/samba: Only rmdir directories that exist
@ 2016-01-11 17:53 Mike Looijmans
  2016-01-11 18:00 ` Khem Raj
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Looijmans @ 2016-01-11 17:53 UTC (permalink / raw)
  To: openembedded-devel

Depending on PACKAGECONFIG selection, the /run/samba directory may not
have been created. Make the do_install_append handle both situations
by checking whether these directories exist before attempting to remove
them.

This fixes do_install failing with an error like this:
 rmdir: failed to remove '/.../samba/4.1.12-r0/image/run/samba': No such file or directory

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
 meta-networking/recipes-connectivity/samba/samba_4.1.12.bb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb b/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
index a51d31f..8e89e49 100644
--- a/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
+++ b/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
@@ -104,8 +104,12 @@ EXTRA_OECONF += "--enable-fhs \
 LDFLAGS += "-Wl,-z,relro,-z,now"
 
 do_install_append() {
-    rmdir --ignore-fail-on-non-empty "${D}/run/samba"
-    rmdir --ignore-fail-on-non-empty "${D}/run"
+    if [ -d "${D}/run" ]; then
+        if [ -d "${D}/run/samba" ]; then
+            rmdir --ignore-fail-on-non-empty "${D}/run/samba"
+        fi
+        rmdir --ignore-fail-on-non-empty "${D}/run"
+    fi
 
     if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true', 'false', d)}; then
         install -d ${D}${systemd_unitdir}/system
-- 
2.1.4



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

* Re: [meta-networking][PATCH] recipes-connectivity/samba: Only rmdir directories that exist
  2016-01-11 17:53 [meta-networking][PATCH] recipes-connectivity/samba: Only rmdir directories that exist Mike Looijmans
@ 2016-01-11 18:00 ` Khem Raj
  2016-01-11 18:06   ` Mike Looijmans
  2016-01-13 17:17   ` [meta-networking][PATCH v2] recipes-connectivity/samba: Remove /run directory tree Mike Looijmans
  0 siblings, 2 replies; 6+ messages in thread
From: Khem Raj @ 2016-01-11 18:00 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 1905 bytes --]


> On Jan 11, 2016, at 9:53 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
> 
> Depending on PACKAGECONFIG selection, the /run/samba directory may not
> have been created. Make the do_install_append handle both situations
> by checking whether these directories exist before attempting to remove
> them.
> 
> This fixes do_install failing with an error like this:
> rmdir: failed to remove '/.../samba/4.1.12-r0/image/run/samba': No such file or directory
> 
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
> ---
> meta-networking/recipes-connectivity/samba/samba_4.1.12.bb | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb b/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
> index a51d31f..8e89e49 100644
> --- a/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
> +++ b/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
> @@ -104,8 +104,12 @@ EXTRA_OECONF += "--enable-fhs \
> LDFLAGS += "-Wl,-z,relro,-z,now"
> 
> do_install_append() {
> -    rmdir --ignore-fail-on-non-empty "${D}/run/samba"
> -    rmdir --ignore-fail-on-non-empty "${D}/run"
> +    if [ -d "${D}/run" ]; then
> +        if [ -d "${D}/run/samba" ]; then
> +            rmdir --ignore-fail-on-non-empty "${D}/run/samba"
> +        fi
> +        rmdir --ignore-fail-on-non-empty "${D}/run"
> +    fi

why don’t we delete /run completely ? it won’t work if package contents are in there anyway

> 
>     if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true', 'false', d)}; then
>         install -d ${D}${systemd_unitdir}/system
> --
> 2.1.4
> 
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

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

* Re: [meta-networking][PATCH] recipes-connectivity/samba: Only rmdir directories that exist
  2016-01-11 18:00 ` Khem Raj
@ 2016-01-11 18:06   ` Mike Looijmans
  2016-01-11 18:11     ` Khem Raj
  2016-01-13 17:17   ` [meta-networking][PATCH v2] recipes-connectivity/samba: Remove /run directory tree Mike Looijmans
  1 sibling, 1 reply; 6+ messages in thread
From: Mike Looijmans @ 2016-01-11 18:06 UTC (permalink / raw)
  To: openembedded-devel

On 11-01-16 19:00, Khem Raj wrote:
>
>> On Jan 11, 2016, at 9:53 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
>>
>> Depending on PACKAGECONFIG selection, the /run/samba directory may not
>> have been created. Make the do_install_append handle both situations
>> by checking whether these directories exist before attempting to remove
>> them.
>>
>> This fixes do_install failing with an error like this:
>> rmdir: failed to remove '/.../samba/4.1.12-r0/image/run/samba': No such file or directory
>>
>> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
>> ---
>> meta-networking/recipes-connectivity/samba/samba_4.1.12.bb | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb b/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
>> index a51d31f..8e89e49 100644
>> --- a/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
>> +++ b/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
>> @@ -104,8 +104,12 @@ EXTRA_OECONF += "--enable-fhs \
>> LDFLAGS += "-Wl,-z,relro,-z,now"
>>
>> do_install_append() {
>> -    rmdir --ignore-fail-on-non-empty "${D}/run/samba"
>> -    rmdir --ignore-fail-on-non-empty "${D}/run"
>> +    if [ -d "${D}/run" ]; then
>> +        if [ -d "${D}/run/samba" ]; then
>> +            rmdir --ignore-fail-on-non-empty "${D}/run/samba"
>> +        fi
>> +        rmdir --ignore-fail-on-non-empty "${D}/run"
>> +    fi
>
> why don’t we delete /run completely ? it won’t work if package contents are in there anyway
>

That's what I do in a bbappend, just "rm -rf ${D}/run" (and also replace 
the non-functional startup script, but that's distro specific), but I 
thought that it might serve some purpose for the one who wrote the recipe.

/run is usually volatile, so putting files in there is pointless, right?


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

* Re: [meta-networking][PATCH] recipes-connectivity/samba: Only rmdir directories that exist
  2016-01-11 18:06   ` Mike Looijmans
@ 2016-01-11 18:11     ` Khem Raj
  2016-01-12 15:17       ` Mike Looijmans
  0 siblings, 1 reply; 6+ messages in thread
From: Khem Raj @ 2016-01-11 18:11 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 2324 bytes --]


> On Jan 11, 2016, at 10:06 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
> 
> On 11-01-16 19:00, Khem Raj wrote:
>> 
>>> On Jan 11, 2016, at 9:53 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
>>> 
>>> Depending on PACKAGECONFIG selection, the /run/samba directory may not
>>> have been created. Make the do_install_append handle both situations
>>> by checking whether these directories exist before attempting to remove
>>> them.
>>> 
>>> This fixes do_install failing with an error like this:
>>> rmdir: failed to remove '/.../samba/4.1.12-r0/image/run/samba': No such file or directory
>>> 
>>> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
>>> ---
>>> meta-networking/recipes-connectivity/samba/samba_4.1.12.bb | 8 ++++++--
>>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>> 
>>> diff --git a/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb b/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
>>> index a51d31f..8e89e49 100644
>>> --- a/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
>>> +++ b/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
>>> @@ -104,8 +104,12 @@ EXTRA_OECONF += "--enable-fhs \
>>> LDFLAGS += "-Wl,-z,relro,-z,now"
>>> 
>>> do_install_append() {
>>> -    rmdir --ignore-fail-on-non-empty "${D}/run/samba"
>>> -    rmdir --ignore-fail-on-non-empty "${D}/run"
>>> +    if [ -d "${D}/run" ]; then
>>> +        if [ -d "${D}/run/samba" ]; then
>>> +            rmdir --ignore-fail-on-non-empty "${D}/run/samba"
>>> +        fi
>>> +        rmdir --ignore-fail-on-non-empty "${D}/run"
>>> +    fi
>> 
>> why don’t we delete /run completely ? it won’t work if package contents are in there anyway
>> 
> 
> That's what I do in a bbappend, just "rm -rf ${D}/run" (and also replace the non-functional startup script, but that's distro specific), but I thought that it might serve some purpose for the one who wrote the recipe.
> 
> /run is usually volatile, so putting files in there is pointless, right?

yes although, you should add code to generate those files during post_inst

> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

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

* Re: [meta-networking][PATCH] recipes-connectivity/samba: Only rmdir directories that exist
  2016-01-11 18:11     ` Khem Raj
@ 2016-01-12 15:17       ` Mike Looijmans
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Looijmans @ 2016-01-12 15:17 UTC (permalink / raw)
  To: openembedded-devel

On 11-01-16 19:11, Khem Raj wrote:
>
>> On Jan 11, 2016, at 10:06 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
>>
>> On 11-01-16 19:00, Khem Raj wrote:
>>>
>>>> On Jan 11, 2016, at 9:53 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
>>>>
>>>> Depending on PACKAGECONFIG selection, the /run/samba directory may not
>>>> have been created. Make the do_install_append handle both situations
>>>> by checking whether these directories exist before attempting to remove
>>>> them.
>>>>
>>>> This fixes do_install failing with an error like this:
>>>> rmdir: failed to remove '/.../samba/4.1.12-r0/image/run/samba': No such file or directory
>>>>
>>>> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
>>>> ---
>>>> meta-networking/recipes-connectivity/samba/samba_4.1.12.bb | 8 ++++++--
>>>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb b/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
>>>> index a51d31f..8e89e49 100644
>>>> --- a/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
>>>> +++ b/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
>>>> @@ -104,8 +104,12 @@ EXTRA_OECONF += "--enable-fhs \
>>>> LDFLAGS += "-Wl,-z,relro,-z,now"
>>>>
>>>> do_install_append() {
>>>> -    rmdir --ignore-fail-on-non-empty "${D}/run/samba"
>>>> -    rmdir --ignore-fail-on-non-empty "${D}/run"
>>>> +    if [ -d "${D}/run" ]; then
>>>> +        if [ -d "${D}/run/samba" ]; then
>>>> +            rmdir --ignore-fail-on-non-empty "${D}/run/samba"
>>>> +        fi
>>>> +        rmdir --ignore-fail-on-non-empty "${D}/run"
>>>> +    fi
>>>
>>> why don’t we delete /run completely ? it won’t work if package contents are in there anyway
>>>
>>
>> That's what I do in a bbappend, just "rm -rf ${D}/run" (and also replace the non-functional startup script, but that's distro specific), but I thought that it might serve some purpose for the one who wrote the recipe.
>>
>> /run is usually volatile, so putting files in there is pointless, right?
>
> yes although, you should add code to generate those files during post_inst

That wouldn't work, they'll be gone when the system boots. Only way to 
create files there would be to use the 'volatiles' system.

Just removing /run with "rm -rf ${D}/run" will work just fine. The code 
above will generate a QA warning if something gets installed into /run.

Just let me know which you prefer, I'll send a v2 patch.


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

* [meta-networking][PATCH v2] recipes-connectivity/samba: Remove /run directory tree
  2016-01-11 18:00 ` Khem Raj
  2016-01-11 18:06   ` Mike Looijmans
@ 2016-01-13 17:17   ` Mike Looijmans
  1 sibling, 0 replies; 6+ messages in thread
From: Mike Looijmans @ 2016-01-13 17:17 UTC (permalink / raw)
  To: openembedded-devel

Depending on PACKAGECONFIG selection, the /run/samba directory may not
have been created, causing build errors.

Since the /run directory is volatile on target, anything installed
there will vanish anyway, so just remove the /run tree if it exists.

This fixes do_install failing with an error like this:
 rmdir: failed to remove '/.../samba/4.1.12-r0/image/run/samba': No such file or directory
Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
Alternative patch that just removes /run unconditionally.

 meta-networking/recipes-connectivity/samba/samba_4.1.12.bb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb b/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
index e51f518..49df0f4 100644
--- a/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
+++ b/meta-networking/recipes-connectivity/samba/samba_4.1.12.bb
@@ -104,8 +104,7 @@ EXTRA_OECONF += "--enable-fhs \
 LDFLAGS += "-Wl,-z,relro,-z,now"
 
 do_install_append() {
-    rmdir --ignore-fail-on-non-empty "${D}/run/samba"
-    rmdir --ignore-fail-on-non-empty "${D}/run"
+    rm -rf "${D}/run"
 
     if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true', 'false', d)}; then
         install -d ${D}${systemd_unitdir}/system
-- 
2.1.4



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

end of thread, other threads:[~2016-01-13 17:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-11 17:53 [meta-networking][PATCH] recipes-connectivity/samba: Only rmdir directories that exist Mike Looijmans
2016-01-11 18:00 ` Khem Raj
2016-01-11 18:06   ` Mike Looijmans
2016-01-11 18:11     ` Khem Raj
2016-01-12 15:17       ` Mike Looijmans
2016-01-13 17:17   ` [meta-networking][PATCH v2] recipes-connectivity/samba: Remove /run directory tree Mike Looijmans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox