diff mbox series

kernel.bbclass: Add file exist checks around removes

Message ID 20230831133803.30556-1-reatmon@ti.com
State New
Headers show
Series kernel.bbclass: Add file exist checks around removes | expand

Commit Message

Ryan Eatmon Aug. 31, 2023, 1:38 p.m. UTC
The latest 6.5 kernels do not appear to create the source file in
${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source so the
recipe errors out when trying to remove it.  Simple fix is to add an
exists check around the call.

Signed-off-by: Ryan Eatmon <reatmon@ti.com>
---
 meta/classes-recipe/kernel.bbclass | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Frédéric Martinsons Aug. 31, 2023, 1:47 p.m. UTC | #1
Hello,

On Thu, 31 Aug 2023 at 15:38, Ryan Eatmon via lists.openembedded.org
<reatmon=ti.com@lists.openembedded.org> wrote:

> The latest 6.5 kernels do not appear to create the source file in
> ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source so the
> recipe errors out when trying to remove it.  Simple fix is to add an
> exists check around the call.
>
> Signed-off-by: Ryan Eatmon <reatmon@ti.com>
> ---
>  meta/classes-recipe/kernel.bbclass | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes-recipe/kernel.bbclass
> b/meta/classes-recipe/kernel.bbclass
> index acb43bd4d5..4df052061b 100644
> --- a/meta/classes-recipe/kernel.bbclass
> +++ b/meta/classes-recipe/kernel.bbclass
> @@ -454,8 +454,12 @@ kernel_do_install() {
>         unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
>         if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
>                 oe_runmake DEPMOD=echo
> MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}
> INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
> -               rm
> "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
> -               rm
> "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
> +               if [ -e
> "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" ]; then
> +                       rm
> "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
> +               fi
> +               if [ -e
> "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source" ]; then
> +                       rm
> "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
> +               fi
>                 # Remove empty module directories to prevent QA issues
>                 find
> "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d
> -empty -delete
>         else
> --
> 2.17.1
>
>
My 2 cents: the "-f" switch makes rm ignore nonexistent files , and it will
make a shorter patch ;)

>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#186974):
> https://lists.openembedded.org/g/openembedded-core/message/186974
> Mute This Topic: https://lists.openembedded.org/mt/101073782/6213388
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> frederic.martinsons@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Ryan Eatmon Aug. 31, 2023, 1:49 p.m. UTC | #2
On 8/31/2023 8:47 AM, Frédéric Martinsons wrote:
> Hello,
> 
> On Thu, 31 Aug 2023 at 15:38, Ryan Eatmon via lists.openembedded.org 
> <http://lists.openembedded.org> <reatmon=ti.com@lists.openembedded.org 
> <mailto:ti.com@lists.openembedded.org>> wrote:
> 
>     The latest 6.5 kernels do not appear to create the source file in
>     ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source so the
>     recipe errors out when trying to remove it.  Simple fix is to add an
>     exists check around the call.
> 
>     Signed-off-by: Ryan Eatmon <reatmon@ti.com <mailto:reatmon@ti.com>>
>     ---
>       meta/classes-recipe/kernel.bbclass | 8 ++++++--
>       1 file changed, 6 insertions(+), 2 deletions(-)
> 
>     diff --git a/meta/classes-recipe/kernel.bbclass
>     b/meta/classes-recipe/kernel.bbclass
>     index acb43bd4d5..4df052061b 100644
>     --- a/meta/classes-recipe/kernel.bbclass
>     +++ b/meta/classes-recipe/kernel.bbclass
>     @@ -454,8 +454,12 @@ kernel_do_install() {
>              unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
>              if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
>                      oe_runmake DEPMOD=echo
>     MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}
>     INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
>     -               rm
>     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
>     -               rm
>     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
>     +               if [ -e
>     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" ]; then
>     +                       rm
>     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
>     +               fi
>     +               if [ -e
>     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source" ]; then
>     +                       rm
>     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
>     +               fi
>                      # Remove empty module directories to prevent QA issues
>                      find
>     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type
>     d -empty -delete
>              else
>     -- 
>     2.17.1
> 
> 
> My 2 cents: the "-f" switch makes rm ignore nonexistent files , and it 
> will make a shorter patch ;)

If that is the group consensus I can submit a v2.  Anyone else feel that 
way?


> 
>     -=-=-=-=-=-=-=-=-=-=-=-
>     Links: You receive all messages sent to this group.
>     View/Reply Online (#186974):
>     https://lists.openembedded.org/g/openembedded-core/message/186974
>     <https://lists.openembedded.org/g/openembedded-core/message/186974>
>     Mute This Topic: https://lists.openembedded.org/mt/101073782/6213388
>     <https://lists.openembedded.org/mt/101073782/6213388>
>     Group Owner: openembedded-core+owner@lists.openembedded.org
>     <mailto:openembedded-core%2Bowner@lists.openembedded.org>
>     Unsubscribe:
>     https://lists.openembedded.org/g/openembedded-core/unsub
>     <https://lists.openembedded.org/g/openembedded-core/unsub>
>     [frederic.martinsons@gmail.com <mailto:frederic.martinsons@gmail.com>]
>     -=-=-=-=-=-=-=-=-=-=-=-
>
Frédéric Martinsons Aug. 31, 2023, 4:56 p.m. UTC | #3
On Thu, 31 Aug 2023 at 15:49, Ryan Eatmon <reatmon@ti.com> wrote:

>
>
> On 8/31/2023 8:47 AM, Frédéric Martinsons wrote:
> > Hello,
> >
> > On Thu, 31 Aug 2023 at 15:38, Ryan Eatmon via lists.openembedded.org
> > <http://lists.openembedded.org> <reatmon=ti.com@lists.openembedded.org
> > <mailto:ti.com@lists.openembedded.org>> wrote:
> >
> >     The latest 6.5 kernels do not appear to create the source file in
> >     ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source so the
> >     recipe errors out when trying to remove it.  Simple fix is to add an
> >     exists check around the call.
> >
> >     Signed-off-by: Ryan Eatmon <reatmon@ti.com <mailto:reatmon@ti.com>>
> >     ---
> >       meta/classes-recipe/kernel.bbclass | 8 ++++++--
> >       1 file changed, 6 insertions(+), 2 deletions(-)
> >
> >     diff --git a/meta/classes-recipe/kernel.bbclass
> >     b/meta/classes-recipe/kernel.bbclass
> >     index acb43bd4d5..4df052061b 100644
> >     --- a/meta/classes-recipe/kernel.bbclass
> >     +++ b/meta/classes-recipe/kernel.bbclass
> >     @@ -454,8 +454,12 @@ kernel_do_install() {
> >              unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
> >              if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
> >                      oe_runmake DEPMOD=echo
> >     MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}
> >     INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
> >     -               rm
> >     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
> >     -               rm
> >     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
> >     +               if [ -e
> >     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" ]; then
> >     +                       rm
> >     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
> >     +               fi
> >     +               if [ -e
> >     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source" ]; then
> >     +                       rm
> >     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
> >     +               fi
> >                      # Remove empty module directories to prevent QA
> issues
> >                      find
> >     "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type
> >     d -empty -delete
> >              else
> >     --
> >     2.17.1
> >
> >
> > My 2 cents: the "-f" switch makes rm ignore nonexistent files , and it
> > will make a shorter patch ;)
>
> If that is the group consensus I can submit a v2.  Anyone else feel that
> way?
>
> Don't know if a "group consensus" can exist here. (it is a public list
where anyone can raise remarks) and there is no "vote".

Mine was not a "cons" for you patch, what you did is completely valid,
I just wanted to say that there was a more concise way of doing it.

Feel free to send a v2 if you think my remark is relevant.


> >
> >     -=-=-=-=-=-=-=-=-=-=-=-
> >     Links: You receive all messages sent to this group.
> >     View/Reply Online (#186974):
> >     https://lists.openembedded.org/g/openembedded-core/message/186974
> >     <https://lists.openembedded.org/g/openembedded-core/message/186974>
> >     Mute This Topic: https://lists.openembedded.org/mt/101073782/6213388
> >     <https://lists.openembedded.org/mt/101073782/6213388>
> >     Group Owner: openembedded-core+owner@lists.openembedded.org
> >     <mailto:openembedded-core%2Bowner@lists.openembedded.org>
> >     Unsubscribe:
> >     https://lists.openembedded.org/g/openembedded-core/unsub
> >     <https://lists.openembedded.org/g/openembedded-core/unsub>
> >     [frederic.martinsons@gmail.com <mailto:frederic.martinsons@gmail.com
> >]
> >     -=-=-=-=-=-=-=-=-=-=-=-
> >
>
> --
> Ryan Eatmon                reatmon@ti.com
> -----------------------------------------
> Texas Instruments, Inc.  -  LCPD  -  MGTS
>
Peter Kjellerstedt Aug. 31, 2023, 5:58 p.m. UTC | #4
For what it’s worth, I would also go with rm -f.

Also, have you checked so that the files have not just been moved/renamed? I.e., are they produced in some other location where they should now also be removed from?

//Peter

From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Frederic Martinsons
Sent: den 31 augusti 2023 18:57
To: Ryan Eatmon <reatmon@ti.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core][PATCH] kernel.bbclass: Add file exist checks around removes



On Thu, 31 Aug 2023 at 15:49, Ryan Eatmon <reatmon@ti.com<mailto:reatmon@ti.com>> wrote:


On 8/31/2023 8:47 AM, Frédéric Martinsons wrote:
> Hello,
>
> On Thu, 31 Aug 2023 at 15:38, Ryan Eatmon via lists.openembedded.org<http://lists.openembedded.org>
> <http://lists.openembedded.org> <reatmon=ti.com@lists.openembedded.org<mailto:ti.com@lists.openembedded.org>
> <mailto:ti.com@lists.openembedded.org<mailto:ti.com@lists.openembedded.org>>> wrote:
>
>     The latest 6.5 kernels do not appear to create the source file in
>     ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source so the
>     recipe errors out when trying to remove it.  Simple fix is to add an
>     exists check around the call.
>
>     Signed-off-by: Ryan Eatmon <reatmon@ti.com<mailto:reatmon@ti.com> <mailto:reatmon@ti.com<mailto:reatmon@ti.com>>>
>     ---
>       meta/classes-recipe/kernel.bbclass | 8 ++++++--
>       1 file changed, 6 insertions(+), 2 deletions(-)
>
>     diff --git a/meta/classes-recipe/kernel.bbclass
>     b/meta/classes-recipe/kernel.bbclass
>     index acb43bd4d5..4df052061b 100644
>     --- a/meta/classes-recipe/kernel.bbclass
>     +++ b/meta/classes-recipe/kernel.bbclass
>     @@ -454,8 +454,12 @@ kernel_do_install() {
>              unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
>              if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
>                      oe_runmake DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
>     -               rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
>     -               rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
>     +               if [ -e "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" ]; then
>     +                       rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
>     +               fi
>     +               if [ -e "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source" ]; then
>     +                       rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
>     +               fi
>                      # Remove empty module directories to prevent QA issues
>                      find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete
>              else
>     --
>     2.17.1
>
>
> My 2 cents: the "-f" switch makes rm ignore nonexistent files , and it
> will make a shorter patch ;)

If that is the group consensus I can submit a v2.  Anyone else feel that
way?
Don't know if a "group consensus" can exist here. (it is a public list
where anyone can raise remarks) and there is no "vote".

Mine was not a "cons" for you patch, what you did is completely valid,
I just wanted to say that there was a more concise way of doing it.

Feel free to send a v2 if you think my remark is relevant.


>
>
>

--
Ryan Eatmon                reatmon@ti.com<mailto:reatmon@ti.com>
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS
Ryan Eatmon Aug. 31, 2023, 6:26 p.m. UTC | #5
With two votes I'll send a v2.

No, I have not done that thorough of an investigation into what happened 
to the source file.  My thought was just to get the build working so 
that our nightly upstream testing (latest kernel, uboot, optee-os, 
trusted-firmeware) would not be blocked.  But I can look into it deeper 
and let you know.


On 8/31/2023 12:58 PM, Peter Kjellerstedt wrote:
> For what it’s worth, I would also go with rm -f.
> 
> Also, have you checked so that the files have not just been 
> moved/renamed? I.e., are they produced in some other location where they 
> should now also be removed from?
> 
> //Peter
> 
> *From:*openembedded-core@lists.openembedded.org 
> <openembedded-core@lists.openembedded.org> *On Behalf Of *Frederic 
> Martinsons
> *Sent:* den 31 augusti 2023 18:57
> *To:* Ryan Eatmon <reatmon@ti.com>
> *Cc:* openembedded-core@lists.openembedded.org
> *Subject:* Re: [OE-core][PATCH] kernel.bbclass: Add file exist checks 
> around removes
> 
> On Thu, 31 Aug 2023 at 15:49, Ryan Eatmon <reatmon@ti.com 
> <mailto:reatmon@ti.com>> wrote:
> 
> 
> 
>     On 8/31/2023 8:47 AM, Frédéric Martinsons wrote:
>      > Hello,
>      >
>      > On Thu, 31 Aug 2023 at 15:38, Ryan Eatmon via
>     lists.openembedded.org <http://lists.openembedded.org>
>      > <http://lists.openembedded.org <http://lists.openembedded.org>>
>     <reatmon=ti.com@lists.openembedded.org
>     <mailto:ti.com@lists.openembedded.org>
>      > <mailto:ti.com@lists.openembedded.org
>     <mailto:ti.com@lists.openembedded.org>>> wrote:
>      >
>      >     The latest 6.5 kernels do not appear to create the source file in
>      >     ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source
>     so the
>      >     recipe errors out when trying to remove it.  Simple fix is to
>     add an
>      >     exists check around the call.
>     > 
>     >     Signed-off-by: Ryan Eatmon <reatmon@ti.com <mailto:reatmon@ti.com><mailto:reatmon@ti.com
>     <mailto:reatmon@ti.com>>>
>     >     ---
>     >       meta/classes-recipe/kernel.bbclass | 8 ++++++--
>     >       1 file changed, 6 insertions(+), 2 deletions(-)
>     > 
>     >     diff --git a/meta/classes-recipe/kernel.bbclass
>     >     b/meta/classes-recipe/kernel.bbclass
>     >     index acb43bd4d5..4df052061b 100644
>     >     --- a/meta/classes-recipe/kernel.bbclass
>     >     +++ b/meta/classes-recipe/kernel.bbclass
>     >     @@ -454,8 +454,12 @@ kernel_do_install() {
>     >              unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
>     >              if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
>     >                      oe_runmake DEPMOD=echoMODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
>     >     -               rm"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
>     >     -               rm"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
>     >     +               if [ -e"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" ]; then
>     >     +                       rm"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
>     >     +               fi
>     >     +               if [ -e"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source" ]; then
>     >     +                       rm"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
>     >     +               fi
>     >                      # Remove empty module directories to prevent QA issues
>     >                      find"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -typed
>     -empty -delete
>     >              else
>     >     -- 
>     >     2.17.1
>     > 
>     > 
>     > My 2 cents: the "-f" switch makes rm ignore nonexistent files , and it 
>     > will make a shorter patch ;)
> 
>     If that is the group consensus I can submit a v2. Anyone else feel that
>     way?
> 
> Don't know if a "group consensus" can exist here. (it is a public list
> 
> where anyone can raise remarks) and there is no "vote".
> 
> Mine was not a "cons" for you patch, what you did is completely valid,
> 
> I just wanted to say that there was a more concise way of doing it.
> 
> Feel free to send a v2 if you think my remark is relevant.
> 
> 
>      >
>      >
>      >
> 
>     -- 
>     Ryan Eatmon reatmon@ti.com <mailto:reatmon@ti.com>
>     -----------------------------------------
>     Texas Instruments, Inc.  -  LCPD  -  MGTS
>
Ryan Eatmon Aug. 31, 2023, 6:57 p.m. UTC | #6
On 8/31/2023 1:26 PM, Ryan Eatmon via lists.openembedded.org wrote:
> 
> With two votes I'll send a v2.
> 
> No, I have not done that thorough of an investigation into what happened 
> to the source file.  My thought was just to get the build working so 
> that our nightly upstream testing (latest kernel, uboot, optee-os, 
> trusted-firmeware) would not be blocked.  But I can look into it deeper 
> and let you know.

It looks like they reworked how make modules_install worked.  They moved 
the logic into a files scripts/Makefile.modinst.  And all they seem to 
have removed was the symlink to the source tree.  The symlink build is 
still there.


> 
> On 8/31/2023 12:58 PM, Peter Kjellerstedt wrote:
>> For what it’s worth, I would also go with rm -f.
>>
>> Also, have you checked so that the files have not just been 
>> moved/renamed? I.e., are they produced in some other location where 
>> they should now also be removed from?
>>
>> //Peter
>>
>> *From:*openembedded-core@lists.openembedded.org 
>> <openembedded-core@lists.openembedded.org> *On Behalf Of *Frederic 
>> Martinsons
>> *Sent:* den 31 augusti 2023 18:57
>> *To:* Ryan Eatmon <reatmon@ti.com>
>> *Cc:* openembedded-core@lists.openembedded.org
>> *Subject:* Re: [OE-core][PATCH] kernel.bbclass: Add file exist checks 
>> around removes
>>
>> On Thu, 31 Aug 2023 at 15:49, Ryan Eatmon <reatmon@ti.com 
>> <mailto:reatmon@ti.com>> wrote:
>>
>>
>>
>>     On 8/31/2023 8:47 AM, Frédéric Martinsons wrote:
>>      > Hello,
>>      >
>>      > On Thu, 31 Aug 2023 at 15:38, Ryan Eatmon via
>>     lists.openembedded.org <http://lists.openembedded.org>
>>      > <http://lists.openembedded.org <http://lists.openembedded.org>>
>>     <reatmon=ti.com@lists.openembedded.org
>>     <mailto:ti.com@lists.openembedded.org>
>>      > <mailto:ti.com@lists.openembedded.org
>>     <mailto:ti.com@lists.openembedded.org>>> wrote:
>>      >
>>      >     The latest 6.5 kernels do not appear to create the source 
>> file in
>>      >     ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source
>>     so the
>>      >     recipe errors out when trying to remove it.  Simple fix is to
>>     add an
>>      >     exists check around the call.
>>     >     >     Signed-off-by: Ryan Eatmon <reatmon@ti.com 
>> <mailto:reatmon@ti.com><mailto:reatmon@ti.com
>>     <mailto:reatmon@ti.com>>>
>>     >     ---
>>     >       meta/classes-recipe/kernel.bbclass | 8 ++++++--
>>     >       1 file changed, 6 insertions(+), 2 deletions(-)
>>     >     >     diff --git a/meta/classes-recipe/kernel.bbclass
>>     >     b/meta/classes-recipe/kernel.bbclass
>>     >     index acb43bd4d5..4df052061b 100644
>>     >     --- a/meta/classes-recipe/kernel.bbclass
>>     >     +++ b/meta/classes-recipe/kernel.bbclass
>>     >     @@ -454,8 +454,12 @@ kernel_do_install() {
>>     >              unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
>>     >              if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
>>     >                      oe_runmake 
>> DEPMOD=echoMODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
>>     >     -              
>>  rm"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
>>     >     -              
>>  rm"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
>>     >     +               if [ 
>> -e"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" ]; then
>>     >     +                      
>>  rm"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
>>     >     +               fi
>>     >     +               if [ 
>> -e"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source" ]; then
>>     >     +                      
>>  rm"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
>>     >     +               fi
>>     >                      # Remove empty module directories to 
>> prevent QA issues
>>     >                      
>> find"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -typed
>>     -empty -delete
>>     >              else
>>     >     --     >     2.17.1
>>     >     >     > My 2 cents: the "-f" switch 
>> makes rm ignore nonexistent files , and it     > will make a shorter 
>> patch ;)
>>
>>     If that is the group consensus I can submit a v2. Anyone else feel 
>> that
>>     way?
>>
>> Don't know if a "group consensus" can exist here. (it is a public list
>>
>> where anyone can raise remarks) and there is no "vote".
>>
>> Mine was not a "cons" for you patch, what you did is completely valid,
>>
>> I just wanted to say that there was a more concise way of doing it.
>>
>> Feel free to send a v2 if you think my remark is relevant.
>>
>>
>>      >
>>      >
>>      >
>>
>>     --     Ryan Eatmon reatmon@ti.com <mailto:reatmon@ti.com>
>>     -----------------------------------------
>>     Texas Instruments, Inc.  -  LCPD  -  MGTS
>>
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#186986): https://lists.openembedded.org/g/openembedded-core/message/186986
> Mute This Topic: https://lists.openembedded.org/mt/101073782/6551054
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [reatmon@ti.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index acb43bd4d5..4df052061b 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -454,8 +454,12 @@  kernel_do_install() {
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
 	if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
 		oe_runmake DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
-		rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
-		rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
+		if [ -e "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" ]; then
+			rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
+		fi
+		if [ -e "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source" ]; then
+			rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
+		fi
 		# Remove empty module directories to prevent QA issues
 		find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete
 	else