On 9/10/2024 10:02 AM, Ryan Eatmon via lists.openembedded.org wrote:


On 9/9/2024 4:33 AM, Alexander Kanavin wrote:
On Thu, 5 Sept 2024 at 23:10, Ryan Eatmon <[email protected]> wrote:


7) I'm getting an error when running the setup-build script:

    File "/scratch/builds/bitbake-setup-test/layers/setup-build", line
107, in setup_build_env
      subprocess.run(cmd, shell=True, executable=os.environ['SHELL'])
    File "/usr/lib/python3.10/os.py", line 679, in __getitem__
      raise KeyError(key) from None
KeyError: 'SHELL'


SHELL is set to /bin/sh so I'm at a loss to see why this would be
failing.  But because of this I never get a build.sh script.

For this I would really appreciate if you can get to the bottom of.

I'll take a look today and try to track it down.


Ok...  I run this:

yoctouser@uda0214219:/workdir$ echo $SHELL
/bin/sh

It *looks* like SHELL is set...  but:

yoctouser@uda0214219:/workdir$ env | grep SHELL
yoctouser@uda0214219:/workdir$

which means it is, in fact, not set. Thus does not get passed through to the bitbake-setup code to be read and processed.

So the issue is, why does my docker container not have it set?  No idea.


I can see in scripts/combo-layer that the command:

    shell = os.environ.get('SHELL', 'bash')

passes a default if SHELL is not set. I'll send a patch for this in the scripts/oe-setup-build as well. But there is a line in this patch for bitbake-setup that also needs to be tweaked if you send out another version.

Might be worth changing it from:

    shell = os.environ["SHELL"]
    with open(build_script,'w') as f:
        f.write("#!{}\n. {} && {}\n".format(shell, init_script, targets))


To:

    shell = os.environ.get("SHELL","bash")
    with open(build_script,'w') as f:
f.write("#!/usr/bin/env {}\n. {} && {}\n".format(shell, init_script, targets))

Note the change to using /usr/bin/env in case the shell variable just gets set to "bash".


Thanks,
Alex






--
Ryan Eatmon                [email protected]
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#63819): https://lists.yoctoproject.org/g/yocto/message/63819
Mute This Topic: https://lists.yoctoproject.org/mt/108293733/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to