diff mbox series

package: split strip cmd when ccache is used

Message ID 20231031042735.3842176-1-javier.tia@linaro.org
State New
Headers show
Series package: split strip cmd when ccache is used | expand

Commit Message

Javier Tia Oct. 31, 2023, 4:27 a.m. UTC
Using ccache stopped to work after 77497dbdca with following error:

  FileNotFoundError: [Errno 2] No such file or directory: 'ccache aarch64-trs-linux-strip'

Signed-off-by: Javier Tia <javier.tia@linaro.org>
---
 meta/lib/oe/package.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Purdie Oct. 31, 2023, 12:26 p.m. UTC | #1
On Mon, 2023-10-30 at 22:27 -0600, Javier Tia wrote:
> Using ccache stopped to work after 77497dbdca with following error:
> 
>   FileNotFoundError: [Errno 2] No such file or directory: 'ccache aarch64-trs-linux-strip'
> 
> Signed-off-by: Javier Tia <javier.tia@linaro.org>
> ---
>  meta/lib/oe/package.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
> index 1dd20f85eb..2685da0af9 100644
> --- a/meta/lib/oe/package.py
> +++ b/meta/lib/oe/package.py
> @@ -39,7 +39,7 @@ def runstrip(arg):
>          newmode = origmode | stat.S_IWRITE | stat.S_IREAD
>          os.chmod(file, newmode)
>  
> -    stripcmd = [strip]
> +    stripcmd = strip.split() if "ccache" in strip else [strip]
>      skip_strip = False
>      # kernel module
>      if elftype & 16:

That looks very like a hack/workaround rather than a real fix. The
packaging code shouldn't know/care about ccache.

Should we always be splitting strip?

Cheers,

Richard
Christopher Larson Oct. 31, 2023, 3:29 p.m. UTC | #2
I'd suggest using shlex.split() all the time when dealing with pieces of a
shell command-line, rather than assuming single-word or using str.split().

On Tue, Oct 31, 2023 at 5:26 AM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> On Mon, 2023-10-30 at 22:27 -0600, Javier Tia wrote:
> > Using ccache stopped to work after 77497dbdca with following error:
> >
> >   FileNotFoundError: [Errno 2] No such file or directory: 'ccache
> aarch64-trs-linux-strip'
> >
> > Signed-off-by: Javier Tia <javier.tia@linaro.org>
> > ---
> >  meta/lib/oe/package.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
> > index 1dd20f85eb..2685da0af9 100644
> > --- a/meta/lib/oe/package.py
> > +++ b/meta/lib/oe/package.py
> > @@ -39,7 +39,7 @@ def runstrip(arg):
> >          newmode = origmode | stat.S_IWRITE | stat.S_IREAD
> >          os.chmod(file, newmode)
> >
> > -    stripcmd = [strip]
> > +    stripcmd = strip.split() if "ccache" in strip else [strip]
> >      skip_strip = False
> >      # kernel module
> >      if elftype & 16:
>
> That looks very like a hack/workaround rather than a real fix. The
> packaging code shouldn't know/care about ccache.
>
> Should we always be splitting strip?
>
> Cheers,
>
> Richard
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#189838):
> https://lists.openembedded.org/g/openembedded-core/message/189838
> Mute This Topic: https://lists.openembedded.org/mt/102291706/3617123
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> kergoth@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Javier Tia Nov. 20, 2023, 3:28 p.m. UTC | #3
On 10/31/23 06:26, Richard Purdie wrote:
>
> That looks very like a hack/workaround rather than a real fix. The 
> packaging code shouldn't know/care about ccache.
Took another look at the problem to find a proper solution. Removing
CCACHE from KERNEL_STRIP along with the rest of the KERNEL_* variables, 
except for the compiler.

As of right now, ccache is limited to compilers. Attempting to use it 
with other tools is not beneficial. I received the confirmation from 
ccache's maintainer. [1]

I will be submitting another patch.

[1] 
https://github.com/ccache/ccache/discussions/1346#discussioncomment-7616180

Regards,
» Javier Tia 
Martin Jansa Nov. 20, 2023, 4:06 p.m. UTC | #4
It was already removed from KERNEL_STRIP in:
https://git.openembedded.org/openembedded-core/commit/?id=41f019afc41f800b622c46a6d7cf1beffc97716a

On Mon, Nov 20, 2023 at 4:28 PM Javier Tia <javier.tia@linaro.org> wrote:

> On 10/31/23 06:26, Richard Purdie wrote:
> >
> > That looks very like a hack/workaround rather than a real fix. The
> > packaging code shouldn't know/care about ccache.
> Took another look at the problem to find a proper solution. Removing
> CCACHE from KERNEL_STRIP along with the rest of the KERNEL_* variables,
> except for the compiler.
>
> As of right now, ccache is limited to compilers. Attempting to use it
> with other tools is not beneficial. I received the confirmation from
> ccache's maintainer. [1]
>
> I will be submitting another patch.
>
> [1]
> https://github.com/ccache/ccache/discussions/1346#discussioncomment-7616180
>
> Regards,
> » Javier Tia 
Javier Tia Nov. 21, 2023, 1:14 p.m. UTC | #5
On 11/20/23 10:06, Martin Jansa wrote:

> It was already removed from KERNEL_STRIP in:
> https://git.openembedded.org/openembedded-core/commit/?id=41f019afc41f800b622c46a6d7cf1beffc97716a <https://git.openembedded.org/openembedded-core/commit/?id=41f019afc41f800b622c46a6d7cf1beffc97716a>
> 

Oh, great! Submitting a difference change as CCACHE need to be removed 
from the rest of tooling like LD and AR. Keeping only the compiler.

Thanks,
» Javier Tia 
diff mbox series

Patch

diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 1dd20f85eb..2685da0af9 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -39,7 +39,7 @@  def runstrip(arg):
         newmode = origmode | stat.S_IWRITE | stat.S_IREAD
         os.chmod(file, newmode)
 
-    stripcmd = [strip]
+    stripcmd = strip.split() if "ccache" in strip else [strip]
     skip_strip = False
     # kernel module
     if elftype & 16: