* [PATCH] rust-cross-canadian: rename shell variables for easier appends
@ 2022-08-23 11:02 Peter Bergin
2022-08-23 14:03 ` [OE-core] " Otavio Salvador
0 siblings, 1 reply; 5+ messages in thread
From: Peter Bergin @ 2022-08-23 11:02 UTC (permalink / raw)
To: openembedded-core; +Cc: Peter Bergin
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 <peter@berginkonsult.se>
---
meta/recipes-devtools/rust/rust-cross-canadian.inc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc b/meta/recipes-devtools/rust/rust-cross-canadian.inc
index 77d45a37a31..7bf75a4712e 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc
@@ -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.
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] rust-cross-canadian: rename shell variables for easier appends
2022-08-23 11:02 [PATCH] rust-cross-canadian: rename shell variables for easier appends Peter Bergin
@ 2022-08-23 14:03 ` Otavio Salvador
2022-08-23 20:38 ` Peter Bergin
0 siblings, 1 reply; 5+ messages in thread
From: Otavio Salvador @ 2022-08-23 14:03 UTC (permalink / raw)
To: Peter Bergin; +Cc: Patches and discussions about the oe-core layer
[-- Attachment #1: Type: text/plain, Size: 678 bytes --]
Em ter., 23 de ago. de 2022 às 08:02, Peter Bergin <peter@berginkonsult.se>
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.
>
> Signed-off-by: Peter Bergin <peter@berginkonsult.se>
>
Why do you want to append them?
--
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
[-- Attachment #2: Type: text/html, Size: 1282 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] rust-cross-canadian: rename shell variables for easier appends
2022-08-23 14:03 ` [OE-core] " Otavio Salvador
@ 2022-08-23 20:38 ` Peter Bergin
2022-08-23 21:32 ` Otavio Salvador
0 siblings, 1 reply; 5+ messages in thread
From: Peter Bergin @ 2022-08-23 20:38 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1573 bytes --]
Hi Otavio,
On 2022-08-23 16:03, Otavio Salvador wrote:
>
>
> Em ter., 23 de ago. de 2022 às 08:02, Peter Bergin
> <peter@berginkonsult.se> 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.
>
> Signed-off-by: Peter Bergin <peter@berginkonsult.se>
>
>
> 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
[-- Attachment #2: Type: text/html, Size: 3024 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] rust-cross-canadian: rename shell variables for easier appends
2022-08-23 20:38 ` Peter Bergin
@ 2022-08-23 21:32 ` Otavio Salvador
2022-08-24 6:16 ` Peter Bergin
0 siblings, 1 reply; 5+ messages in thread
From: Otavio Salvador @ 2022-08-23 21:32 UTC (permalink / raw)
To: Peter Bergin; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]
Em ter., 23 de ago. de 2022 às 17:38, Peter Bergin <peter@berginkonsult.se>
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 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.
>
The protoc could have this set in environment-setup.d so it doesn't need
change in rust and avoids rebuilds.
--
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
[-- Attachment #2: Type: text/html, Size: 1880 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] rust-cross-canadian: rename shell variables for easier appends
2022-08-23 21:32 ` Otavio Salvador
@ 2022-08-24 6:16 ` Peter Bergin
0 siblings, 0 replies; 5+ messages in thread
From: Peter Bergin @ 2022-08-24 6:16 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1260 bytes --]
On 2022-08-23 23:32, Otavio Salvador wrote:
>
>
> Em ter., 23 de ago. de 2022 às 17:38, Peter Bergin
> <peter@berginkonsult.se> 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 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.
>
> 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
[-- Attachment #2: Type: text/html, Size: 2653 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-24 6:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-23 11:02 [PATCH] rust-cross-canadian: rename shell variables for easier appends Peter Bergin
2022-08-23 14:03 ` [OE-core] " Otavio Salvador
2022-08-23 20:38 ` Peter Bergin
2022-08-23 21:32 ` Otavio Salvador
2022-08-24 6:16 ` Peter Bergin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.