cpb- / yocto-cooker

Meta buildtool for Yocto Project based Linux embedded systems
GNU General Public License v2.0
43 stars 22 forks source link

[DEV] Add support for executing a command in a poky-initialized shell #145

Closed amine-smile closed 1 year ago

amine-smile commented 1 year ago

Updated the shell command to support executing a command within the poky-initialized shell. Introduced the -c/--cmd option, which allows users to specify a command to be executed. When the -c option is provided, the specified command is executed within the shell environment.

Example: cooker shell <cooker-build> --cmd 'bitbake -c cve_check <package-name>'

pboettch commented 1 year ago

Looks good, could you please add a test to the test-suite?

pboettch commented 1 year ago

Why do we need to the --cmd-switch? Wouldn't it be more unix-like having just the command afterwards:

cooker shell <build> bitbake -c cve_check <package-name>

Like for example with ssh?

cpb- commented 1 year ago

I think that it would be interesting to be able to pass a list of commands, each command with its parameters in a single string. So it would be possible to execute the sequence of commands successively in the same shell (useful for example to cd before running a command)

pboettch commented 1 year ago

I think that it would be interesting to be able to pass a list of commands, each command with its parameters in a single string. So it would be possible to execute the sequence of commands successively in the same shell (useful for example to cd before running a command)

This can be achieved by creating a script-file and run

cooker shell <build> $(realpath batch.sh)

if batch.sh is executable.

I'd prefer this rather than bloating cooker.

ycongal-smile commented 1 year ago

I think that it would be interesting to be able to pass a list of commands, each command with its parameters in a single string. So it would be possible to execute the sequence of commands successively in the same shell (useful for example to cd before running a command)

This can be achieved by creating a script-file and run

cooker shell <build> $(realpath batch.sh)

if batch.sh is executable.

I'd prefer this rather than bloating cooker.

That or supporting shell based sequence (like ssh) : cooker shell <build> "cmd1; cmd2; cmd3 && cmd4" ?

pboettch commented 1 year ago

I think that it would be interesting to be able to pass a list of commands, each command with its parameters in a single string. So it would be possible to execute the sequence of commands successively in the same shell (useful for example to cd before running a command)

This can be achieved by creating a script-file and run cooker shell <build> $(realpath batch.sh) if batch.sh is executable. I'd prefer this rather than bloating cooker.

That or supporting shell based sequence (like ssh) : cooker shell <build> "cmd1; cmd2; cmd3 && cmd4" ?

Both would work without any change to cooker ;-), except (the adapted version of) this patch.

ycongal-smile commented 1 year ago

@amine-smile has (sadly) no time to work on this anymore... I'll take over and send a new PR with :

ycongal-smile commented 1 year ago

@amine-smile has (sadly) no time to work on this anymore... I'll take over and send a new PR with :

* `nargs='*'` (patch is ready)

* a test in the test-suite

=> #146