rust-cross-canadian: rename shell variables for easier appends
PATCH 1/1 rust-cross-canadian: rename shell variables for easier appends
Make unique shell variable names for cargo and rust setup scripts. This change will make it easier to append to the scripts in a bbappend file by using the variable for the script. Before this change it was only possible for the last script as they shared the same variable name.
--- meta/recipes-devtools/rust/rust-cross-canadian.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
meta/recipes-devtools/rust/rust-cross-canadian.inc +4 -4
@@ -37,17 +37,17 @@ do_install () { ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d mkdir "${ENV_SETUP_DIR}" - ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh" + RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh" - cat <<- EOF > "${ENV_SETUP_SH}" + cat <<- EOF > "${RUST_ENV_SETUP_SH}" export RUSTFLAGS="--sysroot=\$OECORE_TARGET_SYSROOT/usr -C link-arg=--sysroot=\$OECORE_TARGET_SYSROOT" export RUST_TARGET_PATH="\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib" EOF chown -R root.root ${D} - ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh" - cat <<- EOF > "${ENV_SETUP_SH}" + CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh" + cat <<- EOF > "${CARGO_ENV_SETUP_SH}" export CARGO_HOME="\$OECORE_TARGET_SYSROOT/home/cargo" mkdir -p "\$CARGO_HOME" # Init the default target once, it might be otherwise user modified.
Signature · 1 line
2.34.1
Em ter., 23 de ago. de 2022 às 08:02, Peter Bergin <[email protected]> escreveu:
Quoted 8 lines
Make unique shell variable names for cargo and rust setup scripts. This change will make it easier to append to the scripts in a bbappend file by using the variable for the script. Before this change it was only possible for the last script as they shared the same variable name.
Signed-off-by Peter Bergin <[email protected]>
Why do you want to append them?
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9 9981-7854 Mobile: +1 (347) 903-9750
Hi Otavio,
Quoted 10 lines · Otavio Salvador
Em ter., 23 de ago. de 2022 às 08:02, Peter Bergin <[email protected]> escreveu:
Make unique shell variable names for cargo and rust setup scripts. This change will make it easier to append to the scripts in a bbappend file by using the variable for the script. Before this change it was only possible for the last script as they shared the same variable name.
Quoted 4 lines
Signed-off-by Peter Bergin <[email protected]>Why do you want to append them?
In my particular case the rust application I'm building against the SDK is using the crate prost-build (https://crates.io/crates/prost-build) that is used to generate code from .proto files. It is using the tool protoc from protobuf and in order to get it working the variable PROTOC needs to be set. Then my solution was to add that variable to environment-setup.d/rust.sh in the SDK as I thought that was an easy solution and rust.sh is in some way connected to the variable setting. Then looking in to do_install of rust-cross-canadian I saw that the variable ENV_SETUP_SH is first used for rust.sh then for cargo.sh so I could not use it to point out rust.sh. Then I had the idea that it would be better to have one variable for rust.sh and one for cargo.sh.
No strong opinion if this is a good solution or not. I can find other solutions of course. If this break things for other people I hope it will not be accepted. Just wanted to share if it can also help others.
Best regards,
/Peter
Em ter., 23 de ago. de 2022 às 17:38, Peter Bergin <[email protected]> escreveu:
Quoted 12 lines
In my particular case the rust application I'm building against the SDK is using the crate prost-build (https://crates.io/crates/prost-build) that is used to generate code from .proto files. It is using the tool protoc from protobuf and in order to get it working the variable PROTOC needs to be set. Then my solution was to add that variable to
environment-setup.d/rust.shin the SDK as I thought that was an easy solution andrust.shis in some way connected to the variable setting. Then looking in todo_installof rust-cross-canadian I saw that the variableENV_SETUP_SHis first used forrust.shthen forcargo.shso I could not use it to point outrust.sh. Then I had the idea that it would be better to have one variable forrust.shand one forcargo.sh.
The protoc could have this set in environment-setup.d so it doesn't need change in rust and avoids rebuilds.
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9 9981-7854 Mobile: +1 (347) 903-9750
Quoted 18 lines · Otavio Salvador
Em ter., 23 de ago. de 2022 às 17:38, Peter Bergin <[email protected]> escreveu:
In my particular case the rust application I'm building against the SDK is using the crate prost-build
(https://crates.io/crates/prost-build) that is used to generate code from .proto files. It is using the tool protoc from protobuf and in order to get it working the variable PROTOC needs to be set. Then my solution was to add that variable toenvironment-setup.d/rust.shin the SDK as I thought that was an easy solution andrust.shis in some way connected to the variable setting. Then looking in todo_installof rust-cross-canadian I saw that the variableENV_SETUP_SHis first used forrust.shthen forcargo.shso I could not use it to point outrust.sh. Then I had the idea that it would be better to have one variable forrust.shand one forcargo.sh.
Quoted 2 lines
The protoc could have this set in environment-setup.d so it doesn't need change in rust and avoids rebuilds.
Yes. As I wrote there are many different solutions to my problem. In this patch I just wanted to share in what I think an improvement for a recipe.
/Peter